You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ah...@apache.org on 2013/11/20 16:35:10 UTC
[23/51] [partial] Reformat all source code. Added checkstyle to check
the source code
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerRule.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerRule.java b/api/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerRule.java
index f4acb73..85a7aae 100644
--- a/api/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerRule.java
+++ b/api/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerRule.java
@@ -19,6 +19,6 @@ package org.apache.cloudstack.network.lb;
import com.cloud.network.rules.LoadBalancer;
-public interface ApplicationLoadBalancerRule extends ApplicationLoadBalancerContainer, LoadBalancer{
+public interface ApplicationLoadBalancerRule extends ApplicationLoadBalancerContainer, LoadBalancer {
int getInstancePort();
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerService.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerService.java b/api/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerService.java
index b2ac358..e043e3f 100644
--- a/api/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerService.java
+++ b/api/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerService.java
@@ -28,15 +28,15 @@ import com.cloud.network.rules.LoadBalancerContainer.Scheme;
import com.cloud.utils.Pair;
public interface ApplicationLoadBalancerService {
-
- ApplicationLoadBalancerRule createApplicationLoadBalancer(String name, String description, Scheme scheme, long sourceIpNetworkId, String sourceIp,
- int sourcePort, int instancePort, String algorithm, long networkId, long lbOwnerId) throws InsufficientAddressCapacityException,
- NetworkRuleConflictException, InsufficientVirtualNetworkCapcityException;
-
+
+ ApplicationLoadBalancerRule createApplicationLoadBalancer(String name, String description, Scheme scheme, long sourceIpNetworkId, String sourceIp, int sourcePort,
+ int instancePort, String algorithm, long networkId, long lbOwnerId) throws InsufficientAddressCapacityException, NetworkRuleConflictException,
+ InsufficientVirtualNetworkCapcityException;
+
boolean deleteApplicationLoadBalancer(long id);
-
+
Pair<List<? extends ApplicationLoadBalancerRule>, Integer> listApplicationLoadBalancers(ListApplicationLoadBalancersCmd cmd);
-
+
ApplicationLoadBalancerRule getApplicationLoadBalancer(long ruleId);
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/network/lb/InternalLoadBalancerVMService.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/network/lb/InternalLoadBalancerVMService.java b/api/src/org/apache/cloudstack/network/lb/InternalLoadBalancerVMService.java
index 91cd88d..2d81efd 100644
--- a/api/src/org/apache/cloudstack/network/lb/InternalLoadBalancerVMService.java
+++ b/api/src/org/apache/cloudstack/network/lb/InternalLoadBalancerVMService.java
@@ -25,10 +25,9 @@ import com.cloud.user.Account;
public interface InternalLoadBalancerVMService {
- VirtualRouter startInternalLbVm(long internalLbVmId, Account caller, long callerUserId)
- throws StorageUnavailableException, InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException;
+ VirtualRouter startInternalLbVm(long internalLbVmId, Account caller, long callerUserId) throws StorageUnavailableException, InsufficientCapacityException,
+ ConcurrentOperationException, ResourceUnavailableException;
- VirtualRouter stopInternalLbVm(long vmId, boolean forced, Account caller, long callerUserId)
- throws ConcurrentOperationException, ResourceUnavailableException;
+ VirtualRouter stopInternalLbVm(long vmId, boolean forced, Account caller, long callerUserId) throws ConcurrentOperationException, ResourceUnavailableException;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/query/QueryService.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/query/QueryService.java b/api/src/org/apache/cloudstack/query/QueryService.java
index 4a9e218..57131ee 100644
--- a/api/src/org/apache/cloudstack/query/QueryService.java
+++ b/api/src/org/apache/cloudstack/query/QueryService.java
@@ -85,20 +85,20 @@ public interface QueryService {
public ListResponse<AccountResponse> searchForAccounts(ListAccountsCmd cmd);
- public ListResponse<AsyncJobResponse> searchForAsyncJobs(ListAsyncJobsCmd cmd);
+ public ListResponse<AsyncJobResponse> searchForAsyncJobs(ListAsyncJobsCmd cmd);
- public ListResponse<DiskOfferingResponse> searchForDiskOfferings(ListDiskOfferingsCmd cmd);
+ public ListResponse<DiskOfferingResponse> searchForDiskOfferings(ListDiskOfferingsCmd cmd);
- public ListResponse<ServiceOfferingResponse> searchForServiceOfferings(ListServiceOfferingsCmd cmd);
+ public ListResponse<ServiceOfferingResponse> searchForServiceOfferings(ListServiceOfferingsCmd cmd);
- public ListResponse<ZoneResponse> listDataCenters(ListZonesByCmd cmd);
+ public ListResponse<ZoneResponse> listDataCenters(ListZonesByCmd cmd);
public ListResponse<TemplateResponse> listTemplates(ListTemplatesCmd cmd);
public ListResponse<TemplateResponse> listIsos(ListIsosCmd cmd);
- public ListResponse<AffinityGroupResponse> listAffinityGroups(Long affinityGroupId, String affinityGroupName,
- String affinityGroupType, Long vmId, String accountName, Long domainId, boolean isRecursive,
- boolean listAll, Long startIndex, Long pageSize);
+
+ public ListResponse<AffinityGroupResponse> listAffinityGroups(Long affinityGroupId, String affinityGroupName, String affinityGroupType, Long vmId, String accountName,
+ Long domainId, boolean isRecursive, boolean listAll, Long startIndex, Long pageSize);
public List<ResourceDetailResponse> listResourceDetails(ListResourceDetailsCmd cmd);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/region/PortableIp.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/region/PortableIp.java b/api/src/org/apache/cloudstack/region/PortableIp.java
index b95071e..b7aa66c 100644
--- a/api/src/org/apache/cloudstack/region/PortableIp.java
+++ b/api/src/org/apache/cloudstack/region/PortableIp.java
@@ -21,7 +21,7 @@ import java.util.Date;
import com.cloud.utils.net.Ip;
import org.apache.cloudstack.api.InternalIdentity;
-public interface PortableIp extends InternalIdentity {
+public interface PortableIp extends InternalIdentity {
enum State {
Allocating, // The IP Address is being propagated to other network elements and is not ready for use yet.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/region/Region.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/region/Region.java b/api/src/org/apache/cloudstack/region/Region.java
index c696fb2..df64e44 100644
--- a/api/src/org/apache/cloudstack/region/Region.java
+++ b/api/src/org/apache/cloudstack/region/Region.java
@@ -22,15 +22,15 @@ import java.util.List;
/**
*
*/
-public interface Region {
-
+public interface Region {
+
public int getId();
- public String getName();
+ public String getName();
- public void setName(String name);
+ public void setName(String name);
- public String getEndPoint();
+ public String getEndPoint();
public boolean checkIfServiceEnabled(Service service);
@@ -48,7 +48,7 @@ public interface Region {
public static final Service Gslb = new Service("Gslb");
public static final Service PortableIp = new Service("PortableIp");
- public Service(String name ) {
+ public Service(String name) {
this.name = name;
regionServices.add(this);
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/region/RegionService.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/region/RegionService.java b/api/src/org/apache/cloudstack/region/RegionService.java
index 303b58c..b5a2866 100644
--- a/api/src/org/apache/cloudstack/region/RegionService.java
+++ b/api/src/org/apache/cloudstack/region/RegionService.java
@@ -36,39 +36,38 @@ import com.cloud.exception.ResourceUnavailableException;
import com.cloud.user.Account;
import com.cloud.user.UserAccount;
-
public interface RegionService {
- /**
- * Adds a Region to the local Region
- * @param id
- * @param name
- * @param endPoint
- * @return Return added Region object
- */
- public Region addRegion(int id, String name, String endPoint);
-
- /**
- * Update details of the Region with specified Id
- * @param id
- * @param name
- * @param endPoint
- * @return Return updated Region object
- */
- public Region updateRegion(int id, String name, String endPoint);
-
- /**
- * @param id
- * @return True if region is successfully removed
- */
- public boolean removeRegion(int id);
-
- /** List all Regions or by Id/Name
- * @param id
- * @param name
- * @return List of Regions
- */
- public List<? extends Region> listRegions(ListRegionsCmd cmd);
-
+ /**
+ * Adds a Region to the local Region
+ * @param id
+ * @param name
+ * @param endPoint
+ * @return Return added Region object
+ */
+ public Region addRegion(int id, String name, String endPoint);
+
+ /**
+ * Update details of the Region with specified Id
+ * @param id
+ * @param name
+ * @param endPoint
+ * @return Return updated Region object
+ */
+ public Region updateRegion(int id, String name, String endPoint);
+
+ /**
+ * @param id
+ * @return True if region is successfully removed
+ */
+ public boolean removeRegion(int id);
+
+ /** List all Regions or by Id/Name
+ * @param id
+ * @param name
+ * @return List of Regions
+ */
+ public List<? extends Region> listRegions(ListRegionsCmd cmd);
+
/**
* Deletes a user by userId
* isPopagate flag is set to true if sent from peer Region
@@ -76,8 +75,8 @@ public interface RegionService {
*
* @return true if delete was successful, false otherwise
*/
- boolean deleteUserAccount(DeleteAccountCmd cmd);
-
+ boolean deleteUserAccount(DeleteAccountCmd cmd);
+
/**
* Updates an account
* isPopagate falg is set to true if sent from peer Region
@@ -87,30 +86,30 @@ public interface RegionService {
* @return updated account object
*/
Account updateAccount(UpdateAccountCmd cmd);
-
- /**
- * Disables an account by accountName and domainId or accountId
- * @param cmd
- * @return
- * @throws ResourceUnavailableException
- * @throws ConcurrentOperationException
- */
- Account disableAccount(DisableAccountCmd cmd) throws ConcurrentOperationException, ResourceUnavailableException;
-
- /**
- * Enables an account by accountId
- * @param cmd
- * @return
- */
- Account enableAccount(EnableAccountCmd cmd);
+
+ /**
+ * Disables an account by accountName and domainId or accountId
+ * @param cmd
+ * @return
+ * @throws ResourceUnavailableException
+ * @throws ConcurrentOperationException
+ */
+ Account disableAccount(DisableAccountCmd cmd) throws ConcurrentOperationException, ResourceUnavailableException;
+
+ /**
+ * Enables an account by accountId
+ * @param cmd
+ * @return
+ */
+ Account enableAccount(EnableAccountCmd cmd);
/**
* Deletes user by Id
* @param deleteUserCmd
* @return true if delete was successful, false otherwise
*/
- boolean deleteUser(DeleteUserCmd deleteUserCmd);
-
+ boolean deleteUser(DeleteUserCmd deleteUserCmd);
+
/**
* update an existing domain
*
@@ -118,36 +117,36 @@ public interface RegionService {
* - the command containing domainId and new domainName
* @return Domain object if the command succeeded
*/
- public Domain updateDomain(UpdateDomainCmd updateDomainCmd);
-
- /**
- * Deletes domain
- * @param cmd
- * @return true if delete was successful, false otherwise
- */
- public boolean deleteDomain(DeleteDomainCmd cmd);
-
+ public Domain updateDomain(UpdateDomainCmd updateDomainCmd);
+
+ /**
+ * Deletes domain
+ * @param cmd
+ * @return true if delete was successful, false otherwise
+ */
+ public boolean deleteDomain(DeleteDomainCmd cmd);
+
/**
* Update a user by userId
*
* @param userId
* @return UserAccount object
*/
- public UserAccount updateUser(UpdateUserCmd updateUserCmd);
-
+ public UserAccount updateUser(UpdateUserCmd updateUserCmd);
+
/**
* Disables a user by userId
*
* @param cmd
* @return UserAccount object
*/
- public UserAccount disableUser(DisableUserCmd cmd);
-
+ public UserAccount disableUser(DisableUserCmd cmd);
+
/**
* Enables a user
*
* @param cmd
* @return UserAccount object
*/
- public UserAccount enableUser(EnableUserCmd cmd);
+ public UserAccount enableUser(EnableUserCmd cmd);
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/region/RegionSync.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/region/RegionSync.java b/api/src/org/apache/cloudstack/region/RegionSync.java
index 5a1f5a6..fee4c91 100644
--- a/api/src/org/apache/cloudstack/region/RegionSync.java
+++ b/api/src/org/apache/cloudstack/region/RegionSync.java
@@ -21,13 +21,13 @@ import java.util.Date;
/**
*
*/
-public interface RegionSync {
-
+public interface RegionSync {
+
public long getId();
-
+
public int getRegionId();
-
- public String getApi();
- Date getCreateDate();
+ public String getApi();
+
+ Date getCreateDate();
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/usage/Usage.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/usage/Usage.java b/api/src/org/apache/cloudstack/usage/Usage.java
index 1bb1e90..20dc189 100644
--- a/api/src/org/apache/cloudstack/usage/Usage.java
+++ b/api/src/org/apache/cloudstack/usage/Usage.java
@@ -19,20 +19,20 @@ package org.apache.cloudstack.usage;
import java.util.Date;
public interface Usage {
-
- public long getId();
- public Long getZoneId();
+ public long getId();
- public Long getAccountId();
+ public Long getZoneId();
+
+ public Long getAccountId();
public Long getDomainId();
public String getDescription();
- public String getUsageDisplay();
+ public String getUsageDisplay();
- public int getUsageType();
+ public int getUsageType();
public Double getRawUsage();
@@ -45,16 +45,16 @@ public interface Usage {
public Long getTemplateId();
public Long getUsageId();
-
+
public String getType();
-
+
public Long getNetworkId();
public Long getSize();
-
- public Date getStartDate();
- public Date getEndDate();
+ public Date getStartDate();
+
+ public Date getEndDate();
public Long getVirtualSize();
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/usage/UsageService.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/usage/UsageService.java b/api/src/org/apache/cloudstack/usage/UsageService.java
index e203c3f..d8468ab 100755
--- a/api/src/org/apache/cloudstack/usage/UsageService.java
+++ b/api/src/org/apache/cloudstack/usage/UsageService.java
@@ -38,7 +38,7 @@ public interface UsageService {
* system will use the current time.
*/
boolean generateUsageRecords(GenerateUsageRecordsCmd cmd);
-
+
/**
* Retrieves all Usage Records generated between the start and end date specified
*
@@ -61,6 +61,6 @@ public interface UsageService {
*/
TimeZone getUsageTimezone();
- List<UsageTypeResponse> listUsageTypes();
+ List<UsageTypeResponse> listUsageTypes();
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/src/org/apache/cloudstack/usage/UsageTypes.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/usage/UsageTypes.java b/api/src/org/apache/cloudstack/usage/UsageTypes.java
index 52d2644..3edfd0b 100644
--- a/api/src/org/apache/cloudstack/usage/UsageTypes.java
+++ b/api/src/org/apache/cloudstack/usage/UsageTypes.java
@@ -41,28 +41,28 @@ public class UsageTypes {
public static final int VM_DISK_BYTES_READ = 23;
public static final int VM_DISK_BYTES_WRITE = 24;
public static final int VM_SNAPSHOT = 25;
-
- public static List<UsageTypeResponse> listUsageTypes(){
- List<UsageTypeResponse> responseList = new ArrayList<UsageTypeResponse>();
- responseList.add(new UsageTypeResponse(RUNNING_VM, "Running Vm Usage"));
- responseList.add(new UsageTypeResponse(ALLOCATED_VM, "Allocated Vm Usage"));
- responseList.add(new UsageTypeResponse(IP_ADDRESS, "IP Address Usage"));
- responseList.add(new UsageTypeResponse(NETWORK_BYTES_SENT, "Network Usage (Bytes Sent)"));
- responseList.add(new UsageTypeResponse(NETWORK_BYTES_RECEIVED, "Network Usage (Bytes Received)"));
- responseList.add(new UsageTypeResponse(VOLUME, "Volume Usage"));
- responseList.add(new UsageTypeResponse(TEMPLATE, "Template Usage"));
- responseList.add(new UsageTypeResponse(ISO, "ISO Usage"));
- responseList.add(new UsageTypeResponse(SNAPSHOT, "Snapshot Usage"));
- responseList.add(new UsageTypeResponse(SECURITY_GROUP, "Security Group Usage"));
- responseList.add(new UsageTypeResponse(LOAD_BALANCER_POLICY, "Load Balancer Usage"));
- responseList.add(new UsageTypeResponse(PORT_FORWARDING_RULE, "Port Forwarding Usage"));
- responseList.add(new UsageTypeResponse(NETWORK_OFFERING, "Network Offering Usage"));
- responseList.add(new UsageTypeResponse(VPN_USERS, "VPN users usage"));
+
+ public static List<UsageTypeResponse> listUsageTypes() {
+ List<UsageTypeResponse> responseList = new ArrayList<UsageTypeResponse>();
+ responseList.add(new UsageTypeResponse(RUNNING_VM, "Running Vm Usage"));
+ responseList.add(new UsageTypeResponse(ALLOCATED_VM, "Allocated Vm Usage"));
+ responseList.add(new UsageTypeResponse(IP_ADDRESS, "IP Address Usage"));
+ responseList.add(new UsageTypeResponse(NETWORK_BYTES_SENT, "Network Usage (Bytes Sent)"));
+ responseList.add(new UsageTypeResponse(NETWORK_BYTES_RECEIVED, "Network Usage (Bytes Received)"));
+ responseList.add(new UsageTypeResponse(VOLUME, "Volume Usage"));
+ responseList.add(new UsageTypeResponse(TEMPLATE, "Template Usage"));
+ responseList.add(new UsageTypeResponse(ISO, "ISO Usage"));
+ responseList.add(new UsageTypeResponse(SNAPSHOT, "Snapshot Usage"));
+ responseList.add(new UsageTypeResponse(SECURITY_GROUP, "Security Group Usage"));
+ responseList.add(new UsageTypeResponse(LOAD_BALANCER_POLICY, "Load Balancer Usage"));
+ responseList.add(new UsageTypeResponse(PORT_FORWARDING_RULE, "Port Forwarding Usage"));
+ responseList.add(new UsageTypeResponse(NETWORK_OFFERING, "Network Offering Usage"));
+ responseList.add(new UsageTypeResponse(VPN_USERS, "VPN users usage"));
responseList.add(new UsageTypeResponse(VM_DISK_IO_READ, "VM Disk usage(I/O Read)"));
responseList.add(new UsageTypeResponse(VM_DISK_IO_WRITE, "VM Disk usage(I/O Write)"));
responseList.add(new UsageTypeResponse(VM_DISK_BYTES_READ, "VM Disk usage(Bytes Read)"));
responseList.add(new UsageTypeResponse(VM_DISK_BYTES_WRITE, "VM Disk usage(Bytes Write)"));
responseList.add(new UsageTypeResponse(VM_SNAPSHOT, "VM Snapshot storage usage"));
- return responseList;
+ return responseList;
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/test/com/cloud/network/NetworksTest.java
----------------------------------------------------------------------
diff --git a/api/test/com/cloud/network/NetworksTest.java b/api/test/com/cloud/network/NetworksTest.java
index 87f69d6..438e49e 100644
--- a/api/test/com/cloud/network/NetworksTest.java
+++ b/api/test/com/cloud/network/NetworksTest.java
@@ -40,9 +40,7 @@ public class NetworksTest {
@Test
public void emptyBroadcastDomainTypeTest() throws URISyntaxException {
BroadcastDomainType type = BroadcastDomainType.getTypeOf("");
- Assert.assertEquals(
- "an empty uri should mean a broadcasttype of undecided",
- BroadcastDomainType.UnDecided, type);
+ Assert.assertEquals("an empty uri should mean a broadcasttype of undecided", BroadcastDomainType.UnDecided, type);
}
@Test
@@ -53,8 +51,7 @@ public class NetworksTest {
BroadcastDomainType type1 = BroadcastDomainType.getTypeOf(uri1);
String id1 = BroadcastDomainType.getValue(uri1);
String id2 = BroadcastDomainType.getValue(uri2);
- Assert.assertEquals("uri1 should be of broadcasttype vlan",
- BroadcastDomainType.Vlan, type1);
+ Assert.assertEquals("uri1 should be of broadcasttype vlan", BroadcastDomainType.Vlan, type1);
Assert.assertEquals("id1 should be \"1\"", "1", id1);
Assert.assertEquals("id2 should be \"2\"", "2", id2);
}
@@ -75,18 +72,15 @@ public class NetworksTest {
String uri2 = "mido://2";
BroadcastDomainType type = BroadcastDomainType.getTypeOf(bogeyUri);
String id = BroadcastDomainType.getValue(bogeyUri);
- Assert.assertEquals("uri0 should be of broadcasttype vlan",
- BroadcastDomainType.Lswitch, type);
+ Assert.assertEquals("uri0 should be of broadcasttype vlan", BroadcastDomainType.Lswitch, type);
Assert.assertEquals("id0 should be \"//0\"", "//0", id);
type = BroadcastDomainType.getTypeOf(uri1);
id = BroadcastDomainType.getValue(uri1);
- Assert.assertEquals("uri1 should be of broadcasttype vlan",
- BroadcastDomainType.Lswitch, type);
+ Assert.assertEquals("uri1 should be of broadcasttype vlan", BroadcastDomainType.Lswitch, type);
Assert.assertEquals("id1 should be \"1\"", "1", id);
type = BroadcastDomainType.getTypeOf(uri2);
id = BroadcastDomainType.getValue(uri2);
- Assert.assertEquals("uri2 should be of broadcasttype vlan",
- BroadcastDomainType.Mido, type);
+ Assert.assertEquals("uri2 should be of broadcasttype vlan", BroadcastDomainType.Mido, type);
Assert.assertEquals("id2 should be \"2\"", "2", id);
}
@@ -96,18 +90,14 @@ public class NetworksTest {
String uri2 = "bla:0";
BroadcastDomainType type = BroadcastDomainType.getTypeOf(uri1);
try {
- /* URI result = */ BroadcastDomainType.fromString(uri1);
+ /* URI result = */BroadcastDomainType.fromString(uri1);
} catch (CloudRuntimeException e) {
- Assert.assertEquals("unexpected parameter exception",
- "string 'https://1' has an unknown BroadcastDomainType.",
- e.getMessage());
+ Assert.assertEquals("unexpected parameter exception", "string 'https://1' has an unknown BroadcastDomainType.", e.getMessage());
}
try {
- /* URI result = */ BroadcastDomainType.fromString(uri2);
+ /* URI result = */BroadcastDomainType.fromString(uri2);
} catch (CloudRuntimeException e) {
- Assert.assertEquals("unexpected parameter exception",
- "string 'bla:0' has an unknown BroadcastDomainType.",
- e.getMessage());
+ Assert.assertEquals("unexpected parameter exception", "string 'bla:0' has an unknown BroadcastDomainType.", e.getMessage());
}
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/test/org/apache/cloudstack/api/command/test/ActivateProjectCmdTest.java
----------------------------------------------------------------------
diff --git a/api/test/org/apache/cloudstack/api/command/test/ActivateProjectCmdTest.java b/api/test/org/apache/cloudstack/api/command/test/ActivateProjectCmdTest.java
index 49b5b0e..02b3920 100644
--- a/api/test/org/apache/cloudstack/api/command/test/ActivateProjectCmdTest.java
+++ b/api/test/org/apache/cloudstack/api/command/test/ActivateProjectCmdTest.java
@@ -54,15 +54,13 @@ public class ActivateProjectCmdTest extends TestCase {
@Test
public void testGetEntityOwnerIdForNullProject() {
ProjectService projectService = Mockito.mock(ProjectService.class);
- Mockito.when(projectService.getProject(Mockito.anyLong())).thenReturn(
- null);
+ Mockito.when(projectService.getProject(Mockito.anyLong())).thenReturn(null);
activateProjectCmd._projectService = projectService;
try {
activateProjectCmd.getEntityOwnerId();
} catch (InvalidParameterValueException exception) {
- Assert.assertEquals("Unable to find project by id 2",
- exception.getLocalizedMessage());
+ Assert.assertEquals("Unable to find project by id 2", exception.getLocalizedMessage());
}
}
@@ -73,11 +71,9 @@ public class ActivateProjectCmdTest extends TestCase {
ProjectService projectService = Mockito.mock(ProjectService.class);
Account account = Mockito.mock(Account.class);
Mockito.when(account.getId()).thenReturn(2L);
- Mockito.when(projectService.getProject(Mockito.anyLong())).thenReturn(
- project);
+ Mockito.when(projectService.getProject(Mockito.anyLong())).thenReturn(project);
- Mockito.when(projectService.getProjectOwner(Mockito.anyLong()))
- .thenReturn(account);
+ Mockito.when(projectService.getProjectOwner(Mockito.anyLong())).thenReturn(account);
activateProjectCmd._projectService = projectService;
Assert.assertEquals(2L, activateProjectCmd.getEntityOwnerId());
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/test/org/apache/cloudstack/api/command/test/AddAccountToProjectCmdTest.java
----------------------------------------------------------------------
diff --git a/api/test/org/apache/cloudstack/api/command/test/AddAccountToProjectCmdTest.java b/api/test/org/apache/cloudstack/api/command/test/AddAccountToProjectCmdTest.java
index 4d2000d..77b18ba 100644
--- a/api/test/org/apache/cloudstack/api/command/test/AddAccountToProjectCmdTest.java
+++ b/api/test/org/apache/cloudstack/api/command/test/AddAccountToProjectCmdTest.java
@@ -98,11 +98,9 @@ public class AddAccountToProjectCmdTest extends TestCase {
Account account = Mockito.mock(Account.class);
Mockito.when(account.getId()).thenReturn(2L);
- Mockito.when(projectService.getProject(Mockito.anyLong())).thenReturn(
- project);
+ Mockito.when(projectService.getProject(Mockito.anyLong())).thenReturn(project);
- Mockito.when(projectService.getProjectOwner(Mockito.anyLong()))
- .thenReturn(account);
+ Mockito.when(projectService.getProjectOwner(Mockito.anyLong())).thenReturn(account);
addAccountToProjectCmd._projectService = projectService;
Assert.assertEquals(2L, addAccountToProjectCmd.getEntityOwnerId());
@@ -126,10 +124,10 @@ public class AddAccountToProjectCmdTest extends TestCase {
*/
/***
- *
- *
- *
- * ***/
+ *
+ *
+ *
+ * ***/
/*
* @Test public void testGetEventDescriptionForAccount() {
@@ -147,8 +145,7 @@ public class AddAccountToProjectCmdTest extends TestCase {
try {
addAccountToProjectCmd.execute();
} catch (InvalidParameterValueException exception) {
- Assert.assertEquals("Either accountName or email is required",
- exception.getLocalizedMessage());
+ Assert.assertEquals("Either accountName or email is required", exception.getLocalizedMessage());
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/test/org/apache/cloudstack/api/command/test/AddClusterCmdTest.java
----------------------------------------------------------------------
diff --git a/api/test/org/apache/cloudstack/api/command/test/AddClusterCmdTest.java b/api/test/org/apache/cloudstack/api/command/test/AddClusterCmdTest.java
index ab79b17..f79b207 100644
--- a/api/test/org/apache/cloudstack/api/command/test/AddClusterCmdTest.java
+++ b/api/test/org/apache/cloudstack/api/command/test/AddClusterCmdTest.java
@@ -61,8 +61,7 @@ public class AddClusterCmdTest extends TestCase {
ResourceService resourceService = Mockito.mock(ResourceService.class);
try {
- Mockito.when(resourceService.discoverCluster(addClusterCmd))
- .thenReturn(null);
+ Mockito.when(resourceService.discoverCluster(addClusterCmd)).thenReturn(null);
} catch (ResourceInUseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -79,8 +78,7 @@ public class AddClusterCmdTest extends TestCase {
try {
addClusterCmd.execute();
} catch (ServerApiException exception) {
- Assert.assertEquals("Failed to add cluster",
- exception.getDescription());
+ Assert.assertEquals("Failed to add cluster", exception.getDescription());
}
}
@@ -94,8 +92,7 @@ public class AddClusterCmdTest extends TestCase {
try {
addClusterCmd.execute();
} catch (ServerApiException exception) {
- Assert.assertEquals("Failed to add cluster",
- exception.getDescription());
+ Assert.assertEquals("Failed to add cluster", exception.getDescription());
}
}
@@ -110,7 +107,7 @@ public class AddClusterCmdTest extends TestCase {
addClusterCmd._responseGenerator = responseGenerator;
Cluster cluster = Mockito.mock(Cluster.class);
- Cluster[] clusterArray = new Cluster[] { cluster };
+ Cluster[] clusterArray = new Cluster[] {cluster};
Mockito.doReturn(Arrays.asList(clusterArray)).when(resourceService).discoverCluster(addClusterCmd);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/test/org/apache/cloudstack/api/command/test/AddHostCmdTest.java
----------------------------------------------------------------------
diff --git a/api/test/org/apache/cloudstack/api/command/test/AddHostCmdTest.java b/api/test/org/apache/cloudstack/api/command/test/AddHostCmdTest.java
index eb78e7b..36e66ce 100644
--- a/api/test/org/apache/cloudstack/api/command/test/AddHostCmdTest.java
+++ b/api/test/org/apache/cloudstack/api/command/test/AddHostCmdTest.java
@@ -63,8 +63,7 @@ public class AddHostCmdTest extends TestCase {
try {
addHostCmd.execute();
} catch (ServerApiException exception) {
- Assert.assertEquals("Failed to add host",
- exception.getDescription());
+ Assert.assertEquals("Failed to add host", exception.getDescription());
}
}
@@ -76,8 +75,7 @@ public class AddHostCmdTest extends TestCase {
addHostCmd._resourceService = resourceService;
try {
- Mockito.when(resourceService.discoverHosts(addHostCmd)).thenReturn(
- null);
+ Mockito.when(resourceService.discoverHosts(addHostCmd)).thenReturn(null);
} catch (InvalidParameterValueException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -92,8 +90,7 @@ public class AddHostCmdTest extends TestCase {
try {
addHostCmd.execute();
} catch (ServerApiException exception) {
- Assert.assertEquals("Failed to add host",
- exception.getDescription());
+ Assert.assertEquals("Failed to add host", exception.getDescription());
}
}
@@ -123,7 +120,7 @@ public class AddHostCmdTest extends TestCase {
addHostCmd._resourceService = resourceService;
addHostCmd._responseGenerator = responseGenerator;
Host host = Mockito.mock(Host.class);
- Host[] mockArray = new Host[] { host };
+ Host[] mockArray = new Host[] {host};
HostResponse responseHost = new HostResponse();
responseHost.setName("Test");
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/test/org/apache/cloudstack/api/command/test/AddIpToVmNicTest.java
----------------------------------------------------------------------
diff --git a/api/test/org/apache/cloudstack/api/command/test/AddIpToVmNicTest.java b/api/test/org/apache/cloudstack/api/command/test/AddIpToVmNicTest.java
index e5015cb..d7eacb1 100644
--- a/api/test/org/apache/cloudstack/api/command/test/AddIpToVmNicTest.java
+++ b/api/test/org/apache/cloudstack/api/command/test/AddIpToVmNicTest.java
@@ -26,8 +26,6 @@ import org.apache.cloudstack.api.command.user.vm.RemoveIpFromVmNicCmd;
import org.apache.cloudstack.api.response.NicSecondaryIpResponse;
import org.apache.cloudstack.api.response.SuccessResponse;
-
-
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -67,8 +65,8 @@ public class AddIpToVmNicTest extends TestCase {
AddIpToVmNicCmd ipTonicCmd = Mockito.mock(AddIpToVmNicCmd.class);
NicSecondaryIp secIp = Mockito.mock(NicSecondaryIp.class);
- Mockito.when(
- networkService.allocateSecondaryGuestIP(Mockito.any(Account.class), Mockito.anyLong(), Mockito.anyLong(), Mockito.anyLong(), Mockito.anyString())).thenReturn(secIp);
+ Mockito.when(networkService.allocateSecondaryGuestIP(Mockito.any(Account.class), Mockito.anyLong(), Mockito.anyLong(), Mockito.anyLong(), Mockito.anyString())).thenReturn(
+ secIp);
ipTonicCmd._networkService = networkService;
responseGenerator = Mockito.mock(ResponseGenerator.class);
@@ -86,8 +84,8 @@ public class AddIpToVmNicTest extends TestCase {
NetworkService networkService = Mockito.mock(NetworkService.class);
AddIpToVmNicCmd ipTonicCmd = Mockito.mock(AddIpToVmNicCmd.class);
- Mockito.when(
- networkService.allocateSecondaryGuestIP(Mockito.any(Account.class), Mockito.anyLong(), Mockito.anyLong(), Mockito.anyLong(), Mockito.anyString())).thenReturn(null);
+ Mockito.when(networkService.allocateSecondaryGuestIP(Mockito.any(Account.class), Mockito.anyLong(), Mockito.anyLong(), Mockito.anyLong(), Mockito.anyString())).thenReturn(
+ null);
ipTonicCmd._networkService = networkService;
@@ -104,8 +102,7 @@ public class AddIpToVmNicTest extends TestCase {
NetworkService networkService = Mockito.mock(NetworkService.class);
RemoveIpFromVmNicCmd removeIpFromNic = Mockito.mock(RemoveIpFromVmNicCmd.class);
- Mockito.when(
- networkService.releaseSecondaryIpFromNic(Mockito.anyInt())).thenReturn(true);
+ Mockito.when(networkService.releaseSecondaryIpFromNic(Mockito.anyInt())).thenReturn(true);
removeIpFromNic._networkService = networkService;
successResponseGenerator = Mockito.mock(SuccessResponse.class);
@@ -118,8 +115,7 @@ public class AddIpToVmNicTest extends TestCase {
NetworkService networkService = Mockito.mock(NetworkService.class);
RemoveIpFromVmNicCmd removeIpFromNic = Mockito.mock(RemoveIpFromVmNicCmd.class);
- Mockito.when(
- networkService.releaseSecondaryIpFromNic(Mockito.anyInt())).thenReturn(false);
+ Mockito.when(networkService.releaseSecondaryIpFromNic(Mockito.anyInt())).thenReturn(false);
removeIpFromNic._networkService = networkService;
successResponseGenerator = Mockito.mock(SuccessResponse.class);
@@ -127,8 +123,7 @@ public class AddIpToVmNicTest extends TestCase {
try {
removeIpFromNic.execute();
} catch (InvalidParameterValueException exception) {
- Assert.assertEquals("Failed to remove secondary ip address for the nic",
- exception.getLocalizedMessage());
+ Assert.assertEquals("Failed to remove secondary ip address for the nic", exception.getLocalizedMessage());
}
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/test/org/apache/cloudstack/api/command/test/AddNetworkServiceProviderCmdTest.java
----------------------------------------------------------------------
diff --git a/api/test/org/apache/cloudstack/api/command/test/AddNetworkServiceProviderCmdTest.java b/api/test/org/apache/cloudstack/api/command/test/AddNetworkServiceProviderCmdTest.java
index 2046052..5123178 100644
--- a/api/test/org/apache/cloudstack/api/command/test/AddNetworkServiceProviderCmdTest.java
+++ b/api/test/org/apache/cloudstack/api/command/test/AddNetworkServiceProviderCmdTest.java
@@ -81,13 +81,9 @@ public class AddNetworkServiceProviderCmdTest extends TestCase {
NetworkService networkService = Mockito.mock(NetworkService.class);
addNetworkServiceProviderCmd._networkService = networkService;
- PhysicalNetworkServiceProvider physicalNetworkServiceProvider = Mockito
- .mock(PhysicalNetworkServiceProvider.class);
- Mockito.when(
- networkService.addProviderToPhysicalNetwork(Mockito.anyLong(),
- Mockito.anyString(), Mockito.anyLong(),
- Mockito.anyList())).thenReturn(
- physicalNetworkServiceProvider);
+ PhysicalNetworkServiceProvider physicalNetworkServiceProvider = Mockito.mock(PhysicalNetworkServiceProvider.class);
+ Mockito.when(networkService.addProviderToPhysicalNetwork(Mockito.anyLong(), Mockito.anyString(), Mockito.anyLong(), Mockito.anyList())).thenReturn(
+ physicalNetworkServiceProvider);
try {
addNetworkServiceProviderCmd.create();
@@ -98,23 +94,17 @@ public class AddNetworkServiceProviderCmdTest extends TestCase {
}
@Test
- public void testCreateProviderToPhysicalNetworkFailure()
- throws ResourceAllocationException {
+ public void testCreateProviderToPhysicalNetworkFailure() throws ResourceAllocationException {
NetworkService networkService = Mockito.mock(NetworkService.class);
addNetworkServiceProviderCmd._networkService = networkService;
- Mockito.when(
- networkService.addProviderToPhysicalNetwork(Mockito.anyLong(),
- Mockito.anyString(), Mockito.anyLong(),
- Mockito.anyList())).thenReturn(null);
+ Mockito.when(networkService.addProviderToPhysicalNetwork(Mockito.anyLong(), Mockito.anyString(), Mockito.anyLong(), Mockito.anyList())).thenReturn(null);
try {
addNetworkServiceProviderCmd.create();
} catch (ServerApiException exception) {
- Assert.assertEquals(
- "Failed to add service provider entity to physical network",
- exception.getDescription());
+ Assert.assertEquals("Failed to add service provider entity to physical network", exception.getDescription());
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/test/org/apache/cloudstack/api/command/test/AddSecondaryStorageCmdTest.java
----------------------------------------------------------------------
diff --git a/api/test/org/apache/cloudstack/api/command/test/AddSecondaryStorageCmdTest.java b/api/test/org/apache/cloudstack/api/command/test/AddSecondaryStorageCmdTest.java
index c221ace..88b1747 100644
--- a/api/test/org/apache/cloudstack/api/command/test/AddSecondaryStorageCmdTest.java
+++ b/api/test/org/apache/cloudstack/api/command/test/AddSecondaryStorageCmdTest.java
@@ -56,29 +56,24 @@ public class AddSecondaryStorageCmdTest extends TestCase {
ImageStore store = Mockito.mock(ImageStore.class);
- Mockito.when(resourceService.discoverImageStore(addImageStoreCmd))
- .thenReturn(store);
+ Mockito.when(resourceService.discoverImageStore(addImageStoreCmd)).thenReturn(store);
- ResponseGenerator responseGenerator = Mockito
- .mock(ResponseGenerator.class);
+ ResponseGenerator responseGenerator = Mockito.mock(ResponseGenerator.class);
addImageStoreCmd._responseGenerator = responseGenerator;
ImageStoreResponse responseHost = new ImageStoreResponse();
responseHost.setName("Test");
- Mockito.when(responseGenerator.createImageStoreResponse(store)).thenReturn(
- responseHost);
+ Mockito.when(responseGenerator.createImageStoreResponse(store)).thenReturn(responseHost);
addImageStoreCmd.execute();
Mockito.verify(responseGenerator).createImageStoreResponse(store);
- ImageStoreResponse actualResponse = (ImageStoreResponse) addImageStoreCmd
- .getResponseObject();
+ ImageStoreResponse actualResponse = (ImageStoreResponse)addImageStoreCmd.getResponseObject();
Assert.assertEquals(responseHost, actualResponse);
- Assert.assertEquals("addimagestoreresponse",
- actualResponse.getResponseName());
+ Assert.assertEquals("addimagestoreresponse", actualResponse.getResponseName());
}
@@ -88,14 +83,12 @@ public class AddSecondaryStorageCmdTest extends TestCase {
StorageService resourceService = Mockito.mock(StorageService.class);
addImageStoreCmd._storageService = resourceService;
- Mockito.when(resourceService.discoverImageStore(addImageStoreCmd))
- .thenReturn(null);
+ Mockito.when(resourceService.discoverImageStore(addImageStoreCmd)).thenReturn(null);
try {
addImageStoreCmd.execute();
} catch (ServerApiException exception) {
- Assert.assertEquals("Failed to add secondary storage",
- exception.getDescription());
+ Assert.assertEquals("Failed to add secondary storage", exception.getDescription());
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/test/org/apache/cloudstack/api/command/test/AddVpnUserCmdTest.java
----------------------------------------------------------------------
diff --git a/api/test/org/apache/cloudstack/api/command/test/AddVpnUserCmdTest.java b/api/test/org/apache/cloudstack/api/command/test/AddVpnUserCmdTest.java
index 69b9050..16f2ac2 100644
--- a/api/test/org/apache/cloudstack/api/command/test/AddVpnUserCmdTest.java
+++ b/api/test/org/apache/cloudstack/api/command/test/AddVpnUserCmdTest.java
@@ -99,18 +99,14 @@ public class AddVpnUserCmdTest extends TestCase {
AccountService accountService = Mockito.mock(AccountService.class);
Account account = Mockito.mock(Account.class);
- Mockito.when(accountService.getAccount(Mockito.anyLong())).thenReturn(
- account);
+ Mockito.when(accountService.getAccount(Mockito.anyLong())).thenReturn(account);
addVpnUserCmd._accountService = accountService;
- RemoteAccessVpnService ravService = Mockito
- .mock(RemoteAccessVpnService.class);
+ RemoteAccessVpnService ravService = Mockito.mock(RemoteAccessVpnService.class);
VpnUser vpnUser = Mockito.mock(VpnUser.class);
- Mockito.when(
- ravService.addVpnUser(Mockito.anyLong(), Mockito.anyString(),
- Mockito.anyString())).thenReturn(vpnUser);
+ Mockito.when(ravService.addVpnUser(Mockito.anyLong(), Mockito.anyString(), Mockito.anyString())).thenReturn(vpnUser);
addVpnUserCmd._ravService = ravService;
@@ -123,24 +119,19 @@ public class AddVpnUserCmdTest extends TestCase {
AccountService accountService = Mockito.mock(AccountService.class);
Account account = Mockito.mock(Account.class);
- Mockito.when(accountService.getAccount(Mockito.anyLong())).thenReturn(
- account);
+ Mockito.when(accountService.getAccount(Mockito.anyLong())).thenReturn(account);
addVpnUserCmd._accountService = accountService;
- RemoteAccessVpnService ravService = Mockito
- .mock(RemoteAccessVpnService.class);
- Mockito.when(
- ravService.addVpnUser(Mockito.anyLong(), Mockito.anyString(),
- Mockito.anyString())).thenReturn(null);
+ RemoteAccessVpnService ravService = Mockito.mock(RemoteAccessVpnService.class);
+ Mockito.when(ravService.addVpnUser(Mockito.anyLong(), Mockito.anyString(), Mockito.anyString())).thenReturn(null);
addVpnUserCmd._ravService = ravService;
try {
addVpnUserCmd.create();
} catch (ServerApiException exception) {
- Assert.assertEquals("Failed to add vpn user",
- exception.getDescription());
+ Assert.assertEquals("Failed to add vpn user", exception.getDescription());
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/test/org/apache/cloudstack/api/command/test/ListCfgCmdTest.java
----------------------------------------------------------------------
diff --git a/api/test/org/apache/cloudstack/api/command/test/ListCfgCmdTest.java b/api/test/org/apache/cloudstack/api/command/test/ListCfgCmdTest.java
index 230a6c0..b838946 100644
--- a/api/test/org/apache/cloudstack/api/command/test/ListCfgCmdTest.java
+++ b/api/test/org/apache/cloudstack/api/command/test/ListCfgCmdTest.java
@@ -41,7 +41,7 @@ import org.mockito.Mockito;
import java.util.ArrayList;
import java.util.List;
-public class ListCfgCmdTest extends TestCase{
+public class ListCfgCmdTest extends TestCase {
private ListCfgsByCmd listCfgsByCmd;
private ManagementService mgr;
@@ -64,18 +64,14 @@ public class ListCfgCmdTest extends TestCase{
listCfgsByCmd._mgr = mgr;
listCfgsByCmd._responseGenerator = responseGenerator;
-
-
List<Configuration> configList = new ArrayList<Configuration>();
configList.add(cfg);
Pair<List<? extends Configuration>, Integer> result = new Pair<List<? extends Configuration>, Integer>(configList, 1);
try {
- Mockito.when(
- mgr.searchForConfigurations(listCfgsByCmd))
- .thenReturn(result);
- }catch (Exception e){
+ Mockito.when(mgr.searchForConfigurations(listCfgsByCmd)).thenReturn(result);
+ } catch (Exception e) {
Assert.fail("Received exception when success expected " + e.getMessage());
}
ConfigurationResponse cfgResponse = new ConfigurationResponse();
@@ -85,7 +81,7 @@ public class ListCfgCmdTest extends TestCase{
listCfgsByCmd.execute();
Mockito.verify(responseGenerator).createConfigurationResponse(cfg);
- ListResponse<ConfigurationResponse> actualResponse = (ListResponse<ConfigurationResponse>) listCfgsByCmd.getResponseObject();
+ ListResponse<ConfigurationResponse> actualResponse = (ListResponse<ConfigurationResponse>)listCfgsByCmd.getResponseObject();
Assert.assertEquals(cfgResponse, actualResponse.getResponses().get(0));
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/test/org/apache/cloudstack/api/command/test/RegionCmdTest.java
----------------------------------------------------------------------
diff --git a/api/test/org/apache/cloudstack/api/command/test/RegionCmdTest.java b/api/test/org/apache/cloudstack/api/command/test/RegionCmdTest.java
index f57dc08..9ed4752 100644
--- a/api/test/org/apache/cloudstack/api/command/test/RegionCmdTest.java
+++ b/api/test/org/apache/cloudstack/api/command/test/RegionCmdTest.java
@@ -42,7 +42,7 @@ public class RegionCmdTest extends TestCase {
@Before
public void setUp() {
- addRegionCmd = new AddRegionCmd() {
+ addRegionCmd = new AddRegionCmd() {
@Override
public Integer getId() {
@@ -63,19 +63,16 @@ public class RegionCmdTest extends TestCase {
RegionService regionService = Mockito.mock(RegionService.class);
Region region = Mockito.mock(Region.class);
- Mockito.when(
- regionService.addRegion(Mockito.anyInt(), Mockito.anyString(), Mockito.anyString()))
- .thenReturn(region);
+ Mockito.when(regionService.addRegion(Mockito.anyInt(), Mockito.anyString(), Mockito.anyString())).thenReturn(region);
addRegionCmd._regionService = regionService;
responseGenerator = Mockito.mock(ResponseGenerator.class);
-
+
RegionResponse regionResponse = Mockito.mock(RegionResponse.class);
- Mockito.when(responseGenerator.createRegionResponse(region)).thenReturn(
- regionResponse);
-
- addRegionCmd._responseGenerator = responseGenerator;
+ Mockito.when(responseGenerator.createRegionResponse(region)).thenReturn(regionResponse);
+
+ addRegionCmd._responseGenerator = responseGenerator;
addRegionCmd.execute();
}
@@ -86,19 +83,16 @@ public class RegionCmdTest extends TestCase {
RegionService regionService = Mockito.mock(RegionService.class);
Region region = Mockito.mock(Region.class);
- Mockito.when(
- regionService.addRegion(Mockito.anyInt(), Mockito.anyString(), Mockito.anyString()))
- .thenReturn(null);
+ Mockito.when(regionService.addRegion(Mockito.anyInt(), Mockito.anyString(), Mockito.anyString())).thenReturn(null);
addRegionCmd._regionService = regionService;
try {
- addRegionCmd.execute();
+ addRegionCmd.execute();
} catch (ServerApiException exception) {
- Assert.assertEquals("Failed to add Region",
- exception.getDescription());
+ Assert.assertEquals("Failed to add Region", exception.getDescription());
}
- }
+ }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/test/org/apache/cloudstack/api/command/test/ScaleVMCmdTest.java
----------------------------------------------------------------------
diff --git a/api/test/org/apache/cloudstack/api/command/test/ScaleVMCmdTest.java b/api/test/org/apache/cloudstack/api/command/test/ScaleVMCmdTest.java
index 1e71739..7c6f492 100644
--- a/api/test/org/apache/cloudstack/api/command/test/ScaleVMCmdTest.java
+++ b/api/test/org/apache/cloudstack/api/command/test/ScaleVMCmdTest.java
@@ -33,7 +33,7 @@ import org.mockito.Mockito;
import java.util.LinkedList;
import java.util.List;
-public class ScaleVMCmdTest extends TestCase{
+public class ScaleVMCmdTest extends TestCase {
private ScaleVMCmd scaleVMCmd;
private ResponseGenerator responseGenerator;
@@ -45,11 +45,12 @@ public class ScaleVMCmdTest extends TestCase{
@Before
public void setUp() {
- scaleVMCmd = new ScaleVMCmd(){
+ scaleVMCmd = new ScaleVMCmd() {
@Override
public Long getId() {
return 2L;
}
+
@Override
public String getCommandName() {
return "scalevirtualmachineresponse";
@@ -57,20 +58,16 @@ public class ScaleVMCmdTest extends TestCase{
};
}
-
@Test
public void testCreateSuccess() {
UserVmService userVmService = Mockito.mock(UserVmService.class);
UserVm userVm = Mockito.mock(UserVm.class);
-
try {
- Mockito.when(
- userVmService.upgradeVirtualMachine(scaleVMCmd))
- .thenReturn(userVm);
- }catch (Exception e){
- Assert.fail("Received exception when success expected " +e.getMessage());
+ Mockito.when(userVmService.upgradeVirtualMachine(scaleVMCmd)).thenReturn(userVm);
+ } catch (Exception e) {
+ Assert.fail("Received exception when success expected " + e.getMessage());
}
ResponseGenerator responseGenerator = Mockito.mock(ResponseGenerator.class);
@@ -85,8 +82,7 @@ public class ScaleVMCmdTest extends TestCase{
List<UserVmResponse> list = new LinkedList<UserVmResponse>();
list.add(userVmResponse);
- Mockito.when(responseGenerator.createUserVmResponse("virtualmachine", userVm)).thenReturn(
- list);
+ Mockito.when(responseGenerator.createUserVmResponse("virtualmachine", userVm)).thenReturn(list);
scaleVMCmd._userVmService = userVmService;
@@ -100,11 +96,9 @@ public class ScaleVMCmdTest extends TestCase{
UserVmService userVmService = Mockito.mock(UserVmService.class);
try {
- Mockito.when(
- userVmService.upgradeVirtualMachine(scaleVMCmd))
- .thenReturn(null);
- }catch (Exception e){
- Assert.fail("Received exception when success expected " +e.getMessage());
+ Mockito.when(userVmService.upgradeVirtualMachine(scaleVMCmd)).thenReturn(null);
+ } catch (Exception e) {
+ Assert.fail("Received exception when success expected " + e.getMessage());
}
scaleVMCmd._userVmService = userVmService;
@@ -112,8 +106,7 @@ public class ScaleVMCmdTest extends TestCase{
try {
scaleVMCmd.execute();
} catch (ServerApiException exception) {
- Assert.assertEquals("Failed to scale vm",
- exception.getDescription());
+ Assert.assertEquals("Failed to scale vm", exception.getDescription());
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/test/org/apache/cloudstack/api/command/test/UpdateCfgCmdTest.java
----------------------------------------------------------------------
diff --git a/api/test/org/apache/cloudstack/api/command/test/UpdateCfgCmdTest.java b/api/test/org/apache/cloudstack/api/command/test/UpdateCfgCmdTest.java
index a31b7c3..5a860cd 100644
--- a/api/test/org/apache/cloudstack/api/command/test/UpdateCfgCmdTest.java
+++ b/api/test/org/apache/cloudstack/api/command/test/UpdateCfgCmdTest.java
@@ -35,7 +35,7 @@ import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.mockito.Mockito;
-public class UpdateCfgCmdTest extends TestCase{
+public class UpdateCfgCmdTest extends TestCase {
private UpdateCfgCmd updateCfgCmd;
private ConfigurationService configService;
@@ -58,8 +58,7 @@ public class UpdateCfgCmdTest extends TestCase{
try {
updateCfgCmd.execute();
} catch (ServerApiException exception) {
- Assert.assertEquals("Failed to update config",
- exception.getDescription());
+ Assert.assertEquals("Failed to update config", exception.getDescription());
}
}
@@ -70,9 +69,7 @@ public class UpdateCfgCmdTest extends TestCase{
updateCfgCmd._configService = configService;
try {
- Mockito.when(
- configService.updateConfiguration(updateCfgCmd))
- .thenReturn(null);
+ Mockito.when(configService.updateConfiguration(updateCfgCmd)).thenReturn(null);
} catch (InvalidParameterValueException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -83,13 +80,11 @@ public class UpdateCfgCmdTest extends TestCase{
try {
updateCfgCmd.execute();
} catch (ServerApiException exception) {
- Assert.assertEquals("Failed to update config",
- exception.getDescription());
+ Assert.assertEquals("Failed to update config", exception.getDescription());
}
}
-
@Test
public void testCreateSuccess() {
@@ -98,10 +93,8 @@ public class UpdateCfgCmdTest extends TestCase{
updateCfgCmd._responseGenerator = responseGenerator;
try {
- Mockito.when(
- configService.updateConfiguration(updateCfgCmd))
- .thenReturn(cfg);
- }catch (Exception e){
+ Mockito.when(configService.updateConfiguration(updateCfgCmd)).thenReturn(cfg);
+ } catch (Exception e) {
Assert.fail("Received exception when success expected " + e.getMessage());
}
@@ -111,7 +104,7 @@ public class UpdateCfgCmdTest extends TestCase{
updateCfgCmd.execute();
Mockito.verify(responseGenerator).createConfigurationResponse(cfg);
- ConfigurationResponse actualResponse = (ConfigurationResponse) updateCfgCmd.getResponseObject();
+ ConfigurationResponse actualResponse = (ConfigurationResponse)updateCfgCmd.getResponseObject();
Assert.assertEquals(response, actualResponse);
Assert.assertEquals("updateconfigurationresponse", response.getResponseName());
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/api/test/org/apache/cloudstack/api/command/test/UsageCmdTest.java
----------------------------------------------------------------------
diff --git a/api/test/org/apache/cloudstack/api/command/test/UsageCmdTest.java b/api/test/org/apache/cloudstack/api/command/test/UsageCmdTest.java
index b8dfb0a..ca31eda 100644
--- a/api/test/org/apache/cloudstack/api/command/test/UsageCmdTest.java
+++ b/api/test/org/apache/cloudstack/api/command/test/UsageCmdTest.java
@@ -61,8 +61,7 @@ public class UsageCmdTest extends TestCase {
Pair<List<? extends Usage>, Integer> usageRecords = new Pair<List<? extends Usage>, Integer>(new ArrayList<Usage>(), new Integer(0));
- Mockito.when(usageService.getUsageRecords(getUsageRecordsCmd)).thenReturn(
- usageRecords);
+ Mockito.when(usageService.getUsageRecords(getUsageRecordsCmd)).thenReturn(usageRecords);
getUsageRecordsCmd._usageService = usageService;
getUsageRecordsCmd.execute();
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d627446/awsapi/src/com/amazon/ec2/ActivateLicense.java
----------------------------------------------------------------------
diff --git a/awsapi/src/com/amazon/ec2/ActivateLicense.java b/awsapi/src/com/amazon/ec2/ActivateLicense.java
index 397fcb8..11fda56 100644
--- a/awsapi/src/com/amazon/ec2/ActivateLicense.java
+++ b/awsapi/src/com/amazon/ec2/ActivateLicense.java
@@ -21,295 +21,252 @@
* This file was auto-generated from WSDL
* by the Apache Axis2 version: 1.5.6 Built on : Aug 30, 2011 (10:01:01 CEST)
*/
-
- package com.amazon.ec2;
-
-
- /**
- * ActivateLicense bean class
- */
-
- public class ActivateLicense
- implements org.apache.axis2.databinding.ADBBean{
-
- public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName(
- "http://ec2.amazonaws.com/doc/2012-08-15/",
- "ActivateLicense",
- "ns1");
-
-
-
- private static java.lang.String generatePrefix(java.lang.String namespace) {
- if(namespace.equals("http://ec2.amazonaws.com/doc/2012-08-15/")){
- return "ns1";
- }
- return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
- }
-
-
- /**
- * field for ActivateLicense
- */
-
-
- protected com.amazon.ec2.ActivateLicenseType localActivateLicense ;
-
-
- /**
- * Auto generated getter method
- * @return com.amazon.ec2.ActivateLicenseType
- */
- public com.amazon.ec2.ActivateLicenseType getActivateLicense(){
- return localActivateLicense;
- }
-
-
-
- /**
- * Auto generated setter method
- * @param param ActivateLicense
- */
- public void setActivateLicense(com.amazon.ec2.ActivateLicenseType param){
-
- this.localActivateLicense=param;
-
-
- }
-
-
- /**
- * isReaderMTOMAware
- * @return true if the reader supports MTOM
- */
- public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) {
+package com.amazon.ec2;
+
+/**
+* ActivateLicense bean class
+*/
+
+public class ActivateLicense implements org.apache.axis2.databinding.ADBBean {
+
+ public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName("http://ec2.amazonaws.com/doc/2012-08-15/", "ActivateLicense", "ns1");
+
+ private static java.lang.String generatePrefix(java.lang.String namespace) {
+ if (namespace.equals("http://ec2.amazonaws.com/doc/2012-08-15/")) {
+ return "ns1";
+ }
+ return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
+ }
+
+ /**
+ * field for ActivateLicense
+ */
+
+ protected com.amazon.ec2.ActivateLicenseType localActivateLicense;
+
+ /**
+ * Auto generated getter method
+ * @return com.amazon.ec2.ActivateLicenseType
+ */
+ public com.amazon.ec2.ActivateLicenseType getActivateLicense() {
+ return localActivateLicense;
+ }
+
+ /**
+ * Auto generated setter method
+ * @param param ActivateLicense
+ */
+ public void setActivateLicense(com.amazon.ec2.ActivateLicenseType param) {
+
+ this.localActivateLicense = param;
+
+ }
+
+ /**
+ * isReaderMTOMAware
+ * @return true if the reader supports MTOM
+ */
+ public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) {
boolean isReaderMTOMAware = false;
-
- try{
- isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE));
- }catch(java.lang.IllegalArgumentException e){
- isReaderMTOMAware = false;
+
+ try {
+ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE));
+ } catch (java.lang.IllegalArgumentException e) {
+ isReaderMTOMAware = false;
}
return isReaderMTOMAware;
- }
-
-
- /**
- *
- * @param parentQName
- * @param factory
- * @return org.apache.axiom.om.OMElement
- */
- public org.apache.axiom.om.OMElement getOMElement (
- final javax.xml.namespace.QName parentQName,
- final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{
-
-
-
- org.apache.axiom.om.OMDataSource dataSource =
- new org.apache.axis2.databinding.ADBDataSource(this,MY_QNAME){
-
- public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
- ActivateLicense.this.serialize(MY_QNAME,factory,xmlWriter);
- }
- };
- return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl(
- MY_QNAME,factory,dataSource);
-
- }
-
- public void serialize(final javax.xml.namespace.QName parentQName,
- final org.apache.axiom.om.OMFactory factory,
- org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter)
- throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{
- serialize(parentQName,factory,xmlWriter,false);
- }
-
- public void serialize(final javax.xml.namespace.QName parentQName,
- final org.apache.axiom.om.OMFactory factory,
- org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter,
- boolean serializeType)
- throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{
-
-
- //We can safely assume an element has only one type associated with it
-
- if (localActivateLicense==null){
- throw new org.apache.axis2.databinding.ADBException("Property cannot be null!");
- }
- localActivateLicense.serialize(MY_QNAME,factory,xmlWriter);
-
+ }
+
+ /**
+ *
+ * @param parentQName
+ * @param factory
+ * @return org.apache.axiom.om.OMElement
+ */
+ public org.apache.axiom.om.OMElement getOMElement(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory)
+ throws org.apache.axis2.databinding.ADBException {
+
+ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this, MY_QNAME) {
+
+ public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
+ ActivateLicense.this.serialize(MY_QNAME, factory, xmlWriter);
+ }
+ };
+ return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl(MY_QNAME, factory, dataSource);
+
+ }
+
+ public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory,
+ org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException {
+ serialize(parentQName, factory, xmlWriter, false);
+ }
+
+ public void serialize(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory,
+ org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException,
+ org.apache.axis2.databinding.ADBException {
+ //We can safely assume an element has only one type associated with it
+
+ if (localActivateLicense == null) {
+ throw new org.apache.axis2.databinding.ADBException("Property cannot be null!");
}
+ localActivateLicense.serialize(MY_QNAME, factory, xmlWriter);
- /**
- * Util method to write an attribute with the ns prefix
- */
- private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName,
- java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{
- if (xmlWriter.getPrefix(namespace) == null) {
- xmlWriter.writeNamespace(prefix, namespace);
- xmlWriter.setPrefix(prefix, namespace);
+ }
- }
+ /**
+ * Util method to write an attribute with the ns prefix
+ */
+ private void
+ writeAttribute(java.lang.String prefix, java.lang.String namespace, java.lang.String attName, java.lang.String attValue, javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws javax.xml.stream.XMLStreamException {
+ if (xmlWriter.getPrefix(namespace) == null) {
+ xmlWriter.writeNamespace(prefix, namespace);
+ xmlWriter.setPrefix(prefix, namespace);
- xmlWriter.writeAttribute(namespace,attName,attValue);
+ }
- }
+ xmlWriter.writeAttribute(namespace, attName, attValue);
- /**
- * Util method to write an attribute without the ns prefix
- */
- private void writeAttribute(java.lang.String namespace,java.lang.String attName,
- java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{
- if (namespace.equals(""))
- {
- xmlWriter.writeAttribute(attName,attValue);
- }
- else
- {
- registerPrefix(xmlWriter, namespace);
- xmlWriter.writeAttribute(namespace,attName,attValue);
- }
- }
-
-
- /**
- * Util method to write an attribute without the ns prefix
- */
- private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName,
- javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
-
- java.lang.String attributeNamespace = qname.getNamespaceURI();
- java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace);
- if (attributePrefix == null) {
- attributePrefix = registerPrefix(xmlWriter, attributeNamespace);
- }
- java.lang.String attributeValue;
- if (attributePrefix.trim().length() > 0) {
- attributeValue = attributePrefix + ":" + qname.getLocalPart();
- } else {
- attributeValue = qname.getLocalPart();
- }
+ }
- if (namespace.equals("")) {
- xmlWriter.writeAttribute(attName, attributeValue);
- } else {
- registerPrefix(xmlWriter, namespace);
- xmlWriter.writeAttribute(namespace, attName, attributeValue);
- }
- }
- /**
- * method to handle Qnames
- */
-
- private void writeQName(javax.xml.namespace.QName qname,
- javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
- java.lang.String namespaceURI = qname.getNamespaceURI();
- if (namespaceURI != null) {
- java.lang.String prefix = xmlWriter.getPrefix(namespaceURI);
- if (prefix == null) {
- prefix = generatePrefix(namespaceURI);
- xmlWriter.writeNamespace(prefix, namespaceURI);
- xmlWriter.setPrefix(prefix,namespaceURI);
- }
+ /**
+ * Util method to write an attribute without the ns prefix
+ */
+ private void writeAttribute(java.lang.String namespace, java.lang.String attName, java.lang.String attValue, javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws javax.xml.stream.XMLStreamException {
+ if (namespace.equals("")) {
+ xmlWriter.writeAttribute(attName, attValue);
+ } else {
+ registerPrefix(xmlWriter, namespace);
+ xmlWriter.writeAttribute(namespace, attName, attValue);
+ }
+ }
- if (prefix.trim().length() > 0){
- xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
- } else {
- // i.e this is the default namespace
- xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
- }
+ /**
+ * Util method to write an attribute without the ns prefix
+ */
+ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws javax.xml.stream.XMLStreamException {
+
+ java.lang.String attributeNamespace = qname.getNamespaceURI();
+ java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace);
+ if (attributePrefix == null) {
+ attributePrefix = registerPrefix(xmlWriter, attributeNamespace);
+ }
+ java.lang.String attributeValue;
+ if (attributePrefix.trim().length() > 0) {
+ attributeValue = attributePrefix + ":" + qname.getLocalPart();
+ } else {
+ attributeValue = qname.getLocalPart();
+ }
+
+ if (namespace.equals("")) {
+ xmlWriter.writeAttribute(attName, attributeValue);
+ } else {
+ registerPrefix(xmlWriter, namespace);
+ xmlWriter.writeAttribute(namespace, attName, attributeValue);
+ }
+ }
+
+ /**
+ * method to handle Qnames
+ */
+
+ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
+ java.lang.String namespaceURI = qname.getNamespaceURI();
+ if (namespaceURI != null) {
+ java.lang.String prefix = xmlWriter.getPrefix(namespaceURI);
+ if (prefix == null) {
+ prefix = generatePrefix(namespaceURI);
+ xmlWriter.writeNamespace(prefix, namespaceURI);
+ xmlWriter.setPrefix(prefix, namespaceURI);
+ }
+ if (prefix.trim().length() > 0) {
+ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
} else {
+ // i.e this is the default namespace
xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
}
+
+ } else {
+ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
}
+ }
- private void writeQNames(javax.xml.namespace.QName[] qnames,
- javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
+ private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
- if (qnames != null) {
- // we have to store this data until last moment since it is not possible to write any
- // namespace data after writing the charactor data
- java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer();
- java.lang.String namespaceURI = null;
- java.lang.String prefix = null;
+ if (qnames != null) {
+ // we have to store this data until last moment since it is not possible to write any
+ // namespace data after writing the charactor data
+ java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer();
+ java.lang.String namespaceURI = null;
+ java.lang.String prefix = null;
- for (int i = 0; i < qnames.length; i++) {
- if (i > 0) {
- stringToWrite.append(" ");
+ for (int i = 0; i < qnames.length; i++) {
+ if (i > 0) {
+ stringToWrite.append(" ");
+ }
+ namespaceURI = qnames[i].getNamespaceURI();
+ if (namespaceURI != null) {
+ prefix = xmlWriter.getPrefix(namespaceURI);
+ if ((prefix == null) || (prefix.length() == 0)) {
+ prefix = generatePrefix(namespaceURI);
+ xmlWriter.writeNamespace(prefix, namespaceURI);
+ xmlWriter.setPrefix(prefix, namespaceURI);
}
- namespaceURI = qnames[i].getNamespaceURI();
- if (namespaceURI != null) {
- prefix = xmlWriter.getPrefix(namespaceURI);
- if ((prefix == null) || (prefix.length() == 0)) {
- prefix = generatePrefix(namespaceURI);
- xmlWriter.writeNamespace(prefix, namespaceURI);
- xmlWriter.setPrefix(prefix,namespaceURI);
- }
- if (prefix.trim().length() > 0){
- stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
- } else {
- stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
- }
+ if (prefix.trim().length() > 0) {
+ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
} else {
stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
}
+ } else {
+ stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
}
- xmlWriter.writeCharacters(stringToWrite.toString());
}
-
+ xmlWriter.writeCharacters(stringToWrite.toString());
}
+ }
- /**
- * Register a namespace prefix
- */
- private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException {
- java.lang.String prefix = xmlWriter.getPrefix(namespace);
+ /**
+ * Register a namespace prefix
+ */
+ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException {
+ java.lang.String prefix = xmlWriter.getPrefix(namespace);
- if (prefix == null) {
- prefix = generatePrefix(namespace);
+ if (prefix == null) {
+ prefix = generatePrefix(namespace);
- while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) {
- prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
- }
-
- xmlWriter.writeNamespace(prefix, namespace);
- xmlWriter.setPrefix(prefix, namespace);
- }
-
- return prefix;
+ while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) {
+ prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
}
+ xmlWriter.writeNamespace(prefix, namespace);
+ xmlWriter.setPrefix(prefix, namespace);
+ }
-
- /**
- * databinding method to get an XML representation of this object
- *
- */
- public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)
- throws org.apache.axis2.databinding.ADBException{
-
+ return prefix;
+ }
-
-
- //We can safely assume an element has only one type associated with it
- return localActivateLicense.getPullParser(MY_QNAME);
+ /**
+ * databinding method to get an XML representation of this object
+ *
+ */
+ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException {
- }
+ //We can safely assume an element has only one type associated with it
+ return localActivateLicense.getPullParser(MY_QNAME);
-
+ }
- /**
- * Factory class that keeps the parse method
- */
- public static class Factory{
-
-
-
+ /**
+ * Factory class that keeps the parse method
+ */
+ public static class Factory {
/**
* static method to create the object
@@ -318,49 +275,40 @@
* Postcondition: If this object is an element, the reader is positioned at its end element
* If this object is a complex type, the reader is positioned at the end element of its outer element
*/
- public static ActivateLicense parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{
- ActivateLicense object =
- new ActivateLicense();
+ public static ActivateLicense parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception {
+ ActivateLicense object = new ActivateLicense();
int event;
java.lang.String nillableValue = null;
- java.lang.String prefix ="";
- java.lang.String namespaceuri ="";
+ java.lang.String prefix = "";
+ java.lang.String namespaceuri = "";
try {
-
+
while (!reader.isStartElement() && !reader.isEndElement())
reader.next();
-
-
-
// Note all attributes that were handled. Used to differ normal attributes
// from anyAttributes.
java.util.Vector handledAttributes = new java.util.Vector();
-
-
-
- while(!reader.isEndElement()) {
- if (reader.isStartElement() ){
-
- if (reader.isStartElement() && new javax.xml.namespace.QName("http://ec2.amazonaws.com/doc/2012-08-15/","ActivateLicense").equals(reader.getName())){
-
- object.setActivateLicense(com.amazon.ec2.ActivateLicenseType.Factory.parse(reader));
-
- } // End of if for expected property start element
-
- else{
- // A start element we are not expecting indicates an invalid parameter was passed
- throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName());
- }
-
- } else {
- reader.next();
- }
- } // end of while loop
-
+ while (!reader.isEndElement()) {
+ if (reader.isStartElement()) {
+ if (reader.isStartElement() && new javax.xml.namespace.QName("http://ec2.amazonaws.com/doc/2012-08-15/", "ActivateLicense").equals(reader.getName())) {
+
+ object.setActivateLicense(com.amazon.ec2.ActivateLicenseType.Factory.parse(reader));
+
+ } // End of if for expected property start element
+
+ else {
+ // A start element we are not expecting indicates an invalid parameter was passed
+ throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName());
+ }
+
+ } else {
+ reader.next();
+ }
+ } // end of while loop
} catch (javax.xml.stream.XMLStreamException e) {
throw new java.lang.Exception(e);
@@ -369,10 +317,6 @@
return object;
}
- }//end of factory class
+ }//end of factory class
-
-
- }
-
-
\ No newline at end of file
+}