mirror of https://github.com/apache/jclouds.git
Enable whitespace around Checkstyle rule
This commit is contained in:
parent
2d88f5164e
commit
67c2b5f6b9
|
@ -46,7 +46,7 @@ public class CloudStackSecurityGroupExtensionLiveTest extends BaseSecurityGroupE
|
|||
super.setupContext();
|
||||
|
||||
CloudStackApi api = view.unwrapApi(CloudStackApi.class);
|
||||
for (Zone z: api.getZoneApi().listZones()) {
|
||||
for (Zone z : api.getZoneApi().listZones()) {
|
||||
if (z.isSecurityGroupsEnabled()) {
|
||||
zone = z;
|
||||
break;
|
||||
|
|
|
@ -106,7 +106,7 @@ public class VirtualMachineToNodeMetadataTest {
|
|||
}
|
||||
}), namingConvention);
|
||||
|
||||
VirtualMachine guest =VirtualMachine.builder()
|
||||
VirtualMachine guest = VirtualMachine.builder()
|
||||
.id("54")
|
||||
.name("i-3-54-VM")
|
||||
.displayName("i-3-54-VM")
|
||||
|
|
|
@ -29,7 +29,7 @@ import java.util.Map;
|
|||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
|
||||
@Test(singleThreaded = true, testName="OptionsConverterTest")
|
||||
@Test(singleThreaded = true, testName = "OptionsConverterTest")
|
||||
public class OptionsConverterTest {
|
||||
|
||||
private static final Map<String, Network> EMPTY_NETWORKS_MAP = ImmutableMap.<String, Network>of();
|
||||
|
|
|
@ -205,7 +205,7 @@ public class ISOApiExpectTest extends BaseCloudStackExpectTest<ISOApi> {
|
|||
.isExtractable(false).build());
|
||||
}
|
||||
|
||||
@Test(expectedExceptions=ResourceNotFoundException.class)
|
||||
@Test(expectedExceptions = ResourceNotFoundException.class)
|
||||
public void testRegisterISOWhenResponseIs404() {
|
||||
ISOApi client = requestSendsResponse(registerIso,
|
||||
HttpResponse.builder()
|
||||
|
|
|
@ -123,7 +123,7 @@ public class TemplateApiLiveTest extends BaseCloudStackApiLiveTest {
|
|||
|
||||
// Create a template
|
||||
CreateTemplateOptions options = CreateTemplateOptions.Builder.volumeId(volume.getId());
|
||||
AsyncCreateResponse response = client.getTemplateApi().createTemplate(TemplateMetadata.builder().name(prefix+"-createTemplate").osTypeId(vmForCreation.getGuestOSId()).displayText("jclouds live testCreateTemplate").build(), options);
|
||||
AsyncCreateResponse response = client.getTemplateApi().createTemplate(TemplateMetadata.builder().name(prefix + "-createTemplate").osTypeId(vmForCreation.getGuestOSId()).displayText("jclouds live testCreateTemplate").build(), options);
|
||||
assertTrue(jobComplete.apply(response.getJobId()), vmForCreation.toString());
|
||||
createdTemplate = client.getTemplateApi().getTemplateInZone(response.getId(), vmForCreation.getZoneId());
|
||||
|
||||
|
@ -168,7 +168,7 @@ public class TemplateApiLiveTest extends BaseCloudStackApiLiveTest {
|
|||
|
||||
// Register a template
|
||||
RegisterTemplateOptions options = RegisterTemplateOptions.Builder.bits(32).isExtractable(true);
|
||||
TemplateMetadata templateMetadata = TemplateMetadata.builder().name(prefix+"-registerTemplate").osTypeId(osType.getId()).displayText("jclouds live testRegisterTemplate").build();
|
||||
TemplateMetadata templateMetadata = TemplateMetadata.builder().name(prefix + "-registerTemplate").osTypeId(osType.getId()).displayText("jclouds live testRegisterTemplate").build();
|
||||
Set<Template> templates = client.getTemplateApi().registerTemplate(templateMetadata, "VHD", "XenServer", IMPORT_VHD_URL, zone.getId(), options);
|
||||
registeredTemplate = Iterables.getOnlyElement(templates, null);
|
||||
assertNotNull(registeredTemplate);
|
||||
|
|
|
@ -54,7 +54,7 @@ public class VolumeApiLiveTest extends BaseCloudStackApiLiveTest {
|
|||
|
||||
@Resource Logger logger = Logger.NULL;
|
||||
|
||||
protected String prefix = System.getProperty("user.name")+"-"+getClass().getSimpleName();
|
||||
protected String prefix = System.getProperty("user.name") + "-" + getClass().getSimpleName();
|
||||
|
||||
private String zoneId;
|
||||
|
||||
|
@ -132,7 +132,7 @@ public class VolumeApiLiveTest extends BaseCloudStackApiLiveTest {
|
|||
}
|
||||
protected Snapshot getPreferredSnapshot() {
|
||||
for (Snapshot candidate : client.getSnapshotApi().listSnapshots()) {
|
||||
if (candidate.getState()==Snapshot.State.BACKED_UP)
|
||||
if (candidate.getState() == Snapshot.State.BACKED_UP)
|
||||
return candidate;
|
||||
}
|
||||
throw new AssertionError("No suitable Snapshot found.");
|
||||
|
@ -141,7 +141,7 @@ public class VolumeApiLiveTest extends BaseCloudStackApiLiveTest {
|
|||
protected VirtualMachine getPreferredVirtualMachine() {
|
||||
for (VirtualMachine candidate : client.getVirtualMachineApi().listVirtualMachines()) {
|
||||
// this is a guess::
|
||||
if (candidate.getState()==VirtualMachine.State.RUNNING || candidate.getState()==VirtualMachine.State.STOPPED)
|
||||
if (candidate.getState() == VirtualMachine.State.RUNNING || candidate.getState() == VirtualMachine.State.STOPPED)
|
||||
return candidate;
|
||||
}
|
||||
throw new AssertionError("No suitable VirtualMachine found.");
|
||||
|
@ -178,7 +178,7 @@ public class VolumeApiLiveTest extends BaseCloudStackApiLiveTest {
|
|||
AsyncCreateResponse job = client.getVolumeApi().createVolumeFromCustomDiskOfferingInZone(
|
||||
prefix + "-jclouds-volume", offering.getId(), zoneId, size);
|
||||
assertTrue(jobComplete.apply(job.getJobId()));
|
||||
logger.info("created volume "+job.getId());
|
||||
logger.info("created volume " + job.getId());
|
||||
|
||||
Volume volume = findVolumeWithId(job.getId());
|
||||
try {
|
||||
|
@ -245,9 +245,9 @@ public class VolumeApiLiveTest extends BaseCloudStackApiLiveTest {
|
|||
}
|
||||
|
||||
static Volume findVolumeWithId(final CloudStackApi client, final String id) {
|
||||
for (Volume v: client.getVolumeApi().listVolumes())
|
||||
for (Volume v : client.getVolumeApi().listVolumes())
|
||||
if (v.getId().equals(id)) return v;
|
||||
throw new NoSuchElementException("no volume with id "+id);
|
||||
throw new NoSuchElementException("no volume with id " + id);
|
||||
}
|
||||
|
||||
// //uncomment to force a cleanup of volumes (since test failures can leave messes)
|
||||
|
|
|
@ -484,7 +484,7 @@ public class EC2HardwareBuilder extends HardwareBuilder {
|
|||
*/
|
||||
public static EC2HardwareBuilder g2_2xlarge() {
|
||||
return new EC2HardwareBuilder(InstanceType.G2_2XLARGE)
|
||||
.ram(15*1024)
|
||||
.ram(15 * 1024)
|
||||
.processors(ImmutableList.of(new Processor(8.0, 3.25)))
|
||||
.volumes(ImmutableList.<Volume> of(
|
||||
new VolumeBuilder().type(LOCAL).size(10.0f).device("/dev/sda1").bootDevice(true).durable(false).build(),
|
||||
|
|
|
@ -180,7 +180,7 @@ public class EC2TemplateBuilderTest {
|
|||
assertEquals(template.getImage().getId(), "us-east-1/cc-image");
|
||||
}
|
||||
|
||||
@Test(expectedExceptions={NoSuchElementException.class})
|
||||
@Test(expectedExceptions = {NoSuchElementException.class})
|
||||
public void testNegativeTemplateChoiceForInstanceByImageId() throws Exception {
|
||||
newTemplateBuilder().imageId("wrongregion/wrongimageid").build();
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ import com.google.common.base.Throwables;
|
|||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "live", testName="TestCanRecreateGroupLiveTest")
|
||||
@Test(groups = "live", testName = "TestCanRecreateGroupLiveTest")
|
||||
public class TestCanRecreateGroupLiveTest extends BaseComputeServiceContextLiveTest {
|
||||
public TestCanRecreateGroupLiveTest() {
|
||||
provider = "ec2";
|
||||
|
|
|
@ -93,7 +93,7 @@ public class EC2TemplateBuilderImplTest extends TemplateBuilderImplTest {
|
|||
|
||||
@Override
|
||||
protected String getProviderFormatId(String uniqueLabel) {
|
||||
return "us-east-1/"+uniqueLabel;
|
||||
return "us-east-1/" + uniqueLabel;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -46,7 +46,7 @@ public class Utils {
|
|||
if (!file.delete()) {
|
||||
// On windows, often the directory does not register as empty right away.
|
||||
Uninterruptibles.sleepUninterruptibly(5, TimeUnit.SECONDS);
|
||||
if(!file.delete()) {
|
||||
if (!file.delete()) {
|
||||
throw new IOException("Could not delete: " + file);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ public class PaginatedCollection<T> extends IterableWithMarker<T> {
|
|||
|
||||
@Override
|
||||
public Optional<Object> nextMarker() {
|
||||
for (Link link: getLinks()) {
|
||||
for (Link link : getLinks()) {
|
||||
if (Link.Relation.NEXT == link.getRelation()) {
|
||||
return Optional.of(toPaginationOptions(link));
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ public class ServerInZoneToNodeMetadata implements Function<ServerInZone, NodeMe
|
|||
AddressToStringTransformationFunction.INSTANCE),
|
||||
isInet4Address));
|
||||
|
||||
for (Link link: from.getLinks()) {
|
||||
for (Link link : from.getLinks()) {
|
||||
if (link.getRelation().equals(Link.Relation.SELF)) {
|
||||
builder.uri(link.getHref());
|
||||
}
|
||||
|
|
|
@ -226,13 +226,13 @@ public class CreateServerOptions implements MapBinder {
|
|||
for (Network network : novaNetworks) {
|
||||
// Avoid serializing null values, which are common here.
|
||||
ImmutableMap.Builder<String, String> networkMap = new ImmutableMap.Builder<String, String>();
|
||||
if(network.getNetworkUuid() != null) {
|
||||
if (network.getNetworkUuid() != null) {
|
||||
networkMap.put("uuid", network.getNetworkUuid());
|
||||
}
|
||||
if(network.getPortUuid() != null) {
|
||||
if (network.getPortUuid() != null) {
|
||||
networkMap.put("port", network.getPortUuid());
|
||||
}
|
||||
if(network.getFixedIp() != null) {
|
||||
if (network.getFixedIp() != null) {
|
||||
networkMap.put("fixed_ip", network.getFixedIp());
|
||||
}
|
||||
server.networks.add(networkMap.build());
|
||||
|
|
|
@ -198,7 +198,7 @@ public class ServerInZoneToNodeMetadataTest {
|
|||
|
||||
@Test
|
||||
public void testPortableNodeStatusNotNull() {
|
||||
for (Server.Status serverStatus: Server.Status.values()) {
|
||||
for (Server.Status serverStatus : Server.Status.values()) {
|
||||
assertNotNull(NovaComputeServiceContextModule.toPortableNodeStatus.get(serverStatus));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,6 +59,6 @@ public class AvailabilityZoneApiExpectTest extends BaseNovaApiExpectTest {
|
|||
|
||||
assertTrue(zone.isPresent(), "Couldn't find zone");
|
||||
assertTrue(zone.get().getName().equals("nova"), "Expected zone name to be nova but it was: " + zone.get().getName());
|
||||
assertTrue(zone.get().getState().available(), "Zone: "+ zone.get().getName() + " is not available.");
|
||||
assertTrue(zone.get().getState().available(), "Zone: " + zone.get().getName() + " is not available.");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -193,7 +193,7 @@ public class ImageApiExpectTest extends BaseNovaApiExpectTest {
|
|||
HttpRequest setMetadata = HttpRequest
|
||||
.builder()
|
||||
.method("PUT")
|
||||
.endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/images/" +imageId + "/metadata")
|
||||
.endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/images/" + imageId + "/metadata")
|
||||
.addHeader("Accept", "*/*")
|
||||
.addHeader("X-Auth-Token", authToken)
|
||||
.payload(payloadFromStringWithContentType("{\"metadata\":{\"Server Label\":\"Web Head 1\",\"Image Version\":\"2.1\"}}", "application/json"))
|
||||
|
|
|
@ -272,7 +272,7 @@ public class ServerApiExpectTest extends BaseNovaApiExpectTest {
|
|||
HttpRequest rebuildServer = HttpRequest
|
||||
.builder()
|
||||
.method("POST")
|
||||
.endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/" + serverId +"/action")
|
||||
.endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/" + serverId + "/action")
|
||||
.addHeader("Accept", "*/*")
|
||||
.addHeader("X-Auth-Token", authToken)
|
||||
.payload(payloadFromStringWithContentType(
|
||||
|
@ -746,7 +746,7 @@ public class ServerApiExpectTest extends BaseNovaApiExpectTest {
|
|||
.builder()
|
||||
.method("GET")
|
||||
.addHeader("Accept", "application/json")
|
||||
.endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/"+ serverId + "/diagnostics")
|
||||
.endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/" + serverId + "/diagnostics")
|
||||
.addHeader("X-Auth-Token", authToken)
|
||||
.build();
|
||||
|
||||
|
@ -768,7 +768,7 @@ public class ServerApiExpectTest extends BaseNovaApiExpectTest {
|
|||
.builder()
|
||||
.method("GET")
|
||||
.addHeader("Accept", "application/json")
|
||||
.endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/"+ serverId + "/diagnostics")
|
||||
.endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/" + serverId + "/diagnostics")
|
||||
.addHeader("X-Auth-Token", authToken)
|
||||
.build();
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ public class ServerApiLiveTest extends BaseNovaApiLiveTest {
|
|||
Server server = serverApi.get(serverId);
|
||||
assertEquals(server.getStatus(), ACTIVE);
|
||||
} finally {
|
||||
if (serverId!=null) {
|
||||
if (serverId != null) {
|
||||
serverApi.delete(serverId);
|
||||
}
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ public class ServerApiLiveTest extends BaseNovaApiLiveTest {
|
|||
// Vanilla OpenStack will error out with a 400 Bad Request
|
||||
assertEquals(e.getResponse().getStatusCode(), 400);
|
||||
} finally {
|
||||
if (serverId!=null) {
|
||||
if (serverId != null) {
|
||||
serverApi.delete(serverId);
|
||||
}
|
||||
}
|
||||
|
@ -179,7 +179,7 @@ public class ServerApiLiveTest extends BaseNovaApiLiveTest {
|
|||
assertEquals("fe80::100", rebuiltServer.getAccessIPv6());
|
||||
|
||||
} finally {
|
||||
if (serverId!=null) {
|
||||
if (serverId != null) {
|
||||
serverApi.delete(serverId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ public class NovaErrorHandlerTest {
|
|||
// should wait until ips are associated w/the server
|
||||
HttpResponse noFixedIps = HttpResponse.builder().statusCode(400)
|
||||
.message("HTTP/1.1 400 Bad Request")
|
||||
.payload("{\"badRequest\": {\"message\": "+
|
||||
.payload("{\"badRequest\": {\"message\": " +
|
||||
"\"instance |71554| has no fixed_ips. unable to associate floating ip\", \"code\": 400}}")
|
||||
.build();
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ public class ServerPredicatesMockTest extends BaseOpenStackMockTest<NovaApi> {
|
|||
MockWebServer server = mockOpenStackServer();
|
||||
server.enqueue(new MockResponse().setBody(stringFromResource("/access.json")));
|
||||
|
||||
for (int i=0; i < 20; i++) {
|
||||
for (int i = 0; i < 20; i++) {
|
||||
server.enqueue(new MockResponse().setBody(stringFromResource("/server_details.json")));
|
||||
}
|
||||
|
||||
|
|
|
@ -41,9 +41,9 @@ public class BindCreateUserToJson implements MapBinder {
|
|||
@Override
|
||||
public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
|
||||
Set<User> users = Sets.newHashSet();
|
||||
if( postParams.get("name") != null ) {
|
||||
if (postParams.get("name") != null) {
|
||||
Set<String> databases = Sets.newHashSet();
|
||||
if(postParams.get("databaseName")!=null)
|
||||
if (postParams.get("databaseName") != null)
|
||||
databases.add((String) postParams.get("databaseName"));
|
||||
|
||||
Builder builder = User.builder();
|
||||
|
@ -56,7 +56,7 @@ public class BindCreateUserToJson implements MapBinder {
|
|||
User user = builder.build();
|
||||
users.add(user);
|
||||
}
|
||||
else if( postParams.get("users") != null ) {
|
||||
else if (postParams.get("users") != null) {
|
||||
users = (Set<User>) postParams.get("users");
|
||||
}
|
||||
return jsonBinder.bindToRequest(request, ImmutableMap.of("users", users));
|
||||
|
|
|
@ -38,15 +38,15 @@ public class BindGrantUserToJson implements MapBinder {
|
|||
@Override
|
||||
public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
|
||||
List<String> databases = Lists.newArrayList();
|
||||
if( postParams.get("databaseName")!=null ) {
|
||||
if (postParams.get("databaseName") != null) {
|
||||
databases.add((String)postParams.get("databaseName"));
|
||||
}
|
||||
else if( postParams.get("databases")!=null ) {
|
||||
else if (postParams.get("databases") != null) {
|
||||
databases = (List<String>) postParams.get("databases");
|
||||
}
|
||||
|
||||
List<Map<String, String>> databaseList = Lists.newArrayList();
|
||||
for(String databaseName : databases) {
|
||||
List<Map<String, String>> databaseList = Lists.newArrayList();
|
||||
for (String databaseName : databases) {
|
||||
Map<String, String> singleDatabase = Maps.newHashMap();
|
||||
singleDatabase.put("name", databaseName);
|
||||
databaseList.add(singleDatabase);
|
||||
|
|
|
@ -47,7 +47,7 @@ public class User implements Comparable<User>{
|
|||
this.password = password;
|
||||
this.host = host;
|
||||
// Set databases to an empty list instead of null
|
||||
if(databases == null) {
|
||||
if (databases == null) {
|
||||
this.databases = Lists.newArrayList();
|
||||
}
|
||||
else {
|
||||
|
@ -60,14 +60,14 @@ public class User implements Comparable<User>{
|
|||
this.password = password;
|
||||
this.host = host;
|
||||
// Set databases to an empty list instead of null
|
||||
if(databases == null) {
|
||||
if (databases == null) {
|
||||
this.databases = Lists.newArrayList();
|
||||
}
|
||||
else {
|
||||
// Using List<Map<String, String>> as the internal representation makes it easy to serialize properly
|
||||
// with less code; this code is to present databases as List<String> to the user.
|
||||
List<Map<String, String>> databaseList = Lists.newArrayList();
|
||||
for(String databaseName : databases) {
|
||||
for (String databaseName : databases) {
|
||||
Map<String, String> singleDatabase = Maps.newHashMap();
|
||||
singleDatabase.put("name", databaseName);
|
||||
databaseList.add(singleDatabase);
|
||||
|
@ -105,7 +105,7 @@ public class User implements Comparable<User>{
|
|||
* @return a unique identifier for this user. In most cases, this is just the name. If the user is restricted to connections from a specific host, the hostname must be appended to the user name with a "@".
|
||||
*/
|
||||
public String getIdentifier() {
|
||||
if(host==null || "%".equals(host))
|
||||
if (host == null || "%".equals(host))
|
||||
return name;
|
||||
else
|
||||
return name + "@" + host;
|
||||
|
@ -117,7 +117,7 @@ public class User implements Comparable<User>{
|
|||
*/
|
||||
public List<String> getDatabases() {
|
||||
List<String> databaseList = Lists.newArrayList();
|
||||
for(Map<String, String> database : this.databases) {
|
||||
for (Map<String, String> database : this.databases) {
|
||||
databaseList.add(database.get("name"));
|
||||
}
|
||||
return ImmutableList.copyOf(databaseList);
|
||||
|
|
|
@ -39,7 +39,7 @@ public class EncodeDotsForUserGet implements HttpRequestFilter {
|
|||
public HttpRequest filter(HttpRequest request) throws HttpException {
|
||||
String endpoint = request.getEndpoint().toString();
|
||||
Matcher matcher = pattern.matcher(endpoint);
|
||||
if(!matcher.find())
|
||||
if (!matcher.find())
|
||||
return request; // do not modify if not found. This however is not expected to happen.
|
||||
String encodable = matcher.group();
|
||||
String encoded = encodable.replace(".", "%2e");
|
||||
|
|
|
@ -46,7 +46,7 @@ public class ParseDatabaseListForUser implements Function<HttpResponse, FluentIt
|
|||
public FluentIterable<String> apply(HttpResponse from) {
|
||||
List<String> resultDatabases = Lists.newArrayList();
|
||||
Map<String, List<Map<String, String>>> result = json.apply(from);
|
||||
for(Map<String, String> database : result.get("databases")) {
|
||||
for (Map<String, String> database : result.get("databases")) {
|
||||
resultDatabases.add(database.get("name"));
|
||||
}
|
||||
return FluentIterable.from(resultDatabases);
|
||||
|
|
|
@ -42,7 +42,7 @@ public class ParsePasswordFromRootedInstance implements Function<HttpResponse, S
|
|||
*/
|
||||
public String apply(HttpResponse from) {
|
||||
Map<String, Map<String, String>> result = json.apply(from);
|
||||
if(result.get("user") == null)
|
||||
if (result.get("user") == null)
|
||||
return null;
|
||||
return result.get("user").get("password");
|
||||
}
|
||||
|
|
|
@ -69,8 +69,8 @@ public class DatabaseApiLiveTest extends BaseTroveApiLiveTest {
|
|||
public void tearDown(){
|
||||
for (String zone : api.getConfiguredZones()) {
|
||||
InstanceApi instanceApi = api.getInstanceApiForZone(zone);
|
||||
for(Instance instance : instancesToDelete.get(zone)){
|
||||
if( !instanceApi.delete(instance.getId() ) )
|
||||
for (Instance instance : instancesToDelete.get(zone)) {
|
||||
if (!instanceApi.delete(instance.getId()))
|
||||
throw new RuntimeException("Could not delete a database instance after tests!");
|
||||
}
|
||||
}
|
||||
|
@ -82,11 +82,12 @@ public class DatabaseApiLiveTest extends BaseTroveApiLiveTest {
|
|||
for (String zone : api.getConfiguredZones()) {
|
||||
InstanceApi instanceApi = api.getInstanceApiForZone(zone);
|
||||
assertTrue(instanceApi.list().size() >= 2);
|
||||
for(Instance instance : instancesToDelete.get(zone)) {
|
||||
for (Instance instance : instancesToDelete.get(zone)) {
|
||||
DatabaseApi databaseApi = api.getDatabaseApiForZoneAndInstance(zone, instance.getId());
|
||||
if(!instance.getName().contains("database_testing"))continue;
|
||||
assertTrue(databaseApi.list().size() >=1);
|
||||
for(String database : databaseApi.list()){
|
||||
if (!instance.getName().contains("database_testing"))
|
||||
continue;
|
||||
assertTrue(databaseApi.list().size() >= 1);
|
||||
for (String database : databaseApi.list()) {
|
||||
assertNotNull(database);
|
||||
}
|
||||
}
|
||||
|
@ -98,11 +99,12 @@ public class DatabaseApiLiveTest extends BaseTroveApiLiveTest {
|
|||
for (String zone : api.getConfiguredZones()) {
|
||||
InstanceApi instanceApi = api.getInstanceApiForZone(zone);
|
||||
assertTrue(instanceApi.list().size() >= 2);
|
||||
for(Instance instance : instancesToDelete.get(zone)) {
|
||||
for (Instance instance : instancesToDelete.get(zone)) {
|
||||
DatabaseApi databaseApi = api.getDatabaseApiForZoneAndInstance(zone, instance.getId());
|
||||
if(!instance.getName().contains("database_testing"))continue;
|
||||
assertTrue(databaseApi.list().size() >=1);
|
||||
for(String database : databaseApi.list()){
|
||||
if (!instance.getName().contains("database_testing"))
|
||||
continue;
|
||||
assertTrue(databaseApi.list().size() >= 1);
|
||||
for (String database : databaseApi.list()) {
|
||||
assertNotNull(database);
|
||||
assertTrue(database.equals("livetest_db1") || database.equals("livetest_db2") || database.equals("livetest_db3") );
|
||||
assertTrue(databaseApi.delete(database));
|
||||
|
|
|
@ -50,7 +50,7 @@ public class InstanceApiLiveTest extends BaseTroveApiLiveTest {
|
|||
@BeforeClass(groups = { "integration", "live" })
|
||||
public void setup() {
|
||||
super.setup();
|
||||
TroveUtils utils= new TroveUtils(api);
|
||||
TroveUtils utils = new TroveUtils(api);
|
||||
for (String zone : api.getConfiguredZones()) {
|
||||
List<Instance> zoneList = Lists.newArrayList();
|
||||
InstanceApi instanceApi = api.getInstanceApiForZone(zone);
|
||||
|
@ -67,8 +67,8 @@ public class InstanceApiLiveTest extends BaseTroveApiLiveTest {
|
|||
public void tearDown(){
|
||||
for (String zone : api.getConfiguredZones()) {
|
||||
InstanceApi instanceApi = api.getInstanceApiForZone(zone);
|
||||
for(Instance instance : created.get(zone)){
|
||||
if( !instanceApi.delete(instance.getId() ) )
|
||||
for (Instance instance : created.get(zone)){
|
||||
if (!instanceApi.delete(instance.getId()))
|
||||
throw new RuntimeException("Could not delete a database instance after tests!");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ public class UserApiLiveTest extends BaseTroveApiLiveTest {
|
|||
@BeforeClass(groups = { "integration", "live" })
|
||||
public void setup() {
|
||||
super.setup();
|
||||
TroveUtils utils= new TroveUtils(api);
|
||||
TroveUtils utils = new TroveUtils(api);
|
||||
for (String zone : api.getConfiguredZones()) {
|
||||
// create instances
|
||||
List<Instance> instanceList = Lists.newArrayList();
|
||||
|
@ -96,8 +96,8 @@ public class UserApiLiveTest extends BaseTroveApiLiveTest {
|
|||
public void tearDown(){
|
||||
for (String zone : api.getConfiguredZones()) {
|
||||
InstanceApi instanceApi = api.getInstanceApiForZone(zone);
|
||||
for(Instance instance : instancesToDelete.get(zone)){
|
||||
if( !instanceApi.delete(instance.getId() ) )
|
||||
for (Instance instance : instancesToDelete.get(zone)) {
|
||||
if (!instanceApi.delete(instance.getId()))
|
||||
throw new RuntimeException("Could not delete a database instance after tests!");
|
||||
}
|
||||
}
|
||||
|
@ -115,11 +115,12 @@ public class UserApiLiveTest extends BaseTroveApiLiveTest {
|
|||
for (String zone : api.getConfiguredZones()) {
|
||||
InstanceApi instanceApi = api.getInstanceApiForZone(zone);
|
||||
assertTrue(instanceApi.list().size() >= 2);
|
||||
for(Instance instance : instancesToDelete.get(zone)) {
|
||||
for (Instance instance : instancesToDelete.get(zone)) {
|
||||
UserApi userApi = api.getUserApiForZoneAndInstance(zone, instance.getId());
|
||||
if(!instance.getName().contains("user_trove_live_testing"))continue;
|
||||
assertTrue(userApi.list().size() >=1);
|
||||
for(User user : userApi.list()){
|
||||
if (!instance.getName().contains("user_trove_live_testing"))
|
||||
continue;
|
||||
assertTrue(userApi.list().size() >= 1);
|
||||
for (User user : userApi.list()) {
|
||||
checkUser(user);
|
||||
}
|
||||
}
|
||||
|
@ -131,11 +132,12 @@ public class UserApiLiveTest extends BaseTroveApiLiveTest {
|
|||
for (String zone : api.getConfiguredZones()) {
|
||||
InstanceApi instanceApi = api.getInstanceApiForZone(zone);
|
||||
assertTrue(instanceApi.list().size() >= 2);
|
||||
for(Instance instance : instancesToDelete.get(zone)) {
|
||||
for (Instance instance : instancesToDelete.get(zone)) {
|
||||
UserApi userApi = api.getUserApiForZoneAndInstance(zone, instance.getId());
|
||||
if(!instance.getName().contains("user_trove_live_testing"))continue;
|
||||
assertTrue(userApi.list().size() >=1);
|
||||
for(User user : userApi.list()){
|
||||
if (!instance.getName().contains("user_trove_live_testing"))
|
||||
continue;
|
||||
assertTrue(userApi.list().size() >= 1);
|
||||
for (User user : userApi.list()) {
|
||||
User userFromGet = userApi.get(user.getIdentifier());
|
||||
assertEquals(userFromGet.getName(), user.getName());
|
||||
assertEquals(userFromGet.getHost(), user.getHost());
|
||||
|
@ -152,11 +154,12 @@ public class UserApiLiveTest extends BaseTroveApiLiveTest {
|
|||
for (String zone : api.getConfiguredZones()) {
|
||||
InstanceApi instanceApi = api.getInstanceApiForZone(zone);
|
||||
assertTrue(instanceApi.list().size() >= 2 );
|
||||
for(Instance instance : instancesToDelete.get(zone)) {
|
||||
for (Instance instance : instancesToDelete.get(zone)) {
|
||||
UserApi userApi = api.getUserApiForZoneAndInstance(zone, instance.getId());
|
||||
if(!instance.getName().contains("user_trove_live_testing"))continue;
|
||||
assertTrue(userApi.list().size() >=1);
|
||||
for(User user : userApi.list()){
|
||||
if (!instance.getName().contains("user_trove_live_testing"))
|
||||
continue;
|
||||
assertTrue(userApi.list().size() >= 1);
|
||||
for (User user : userApi.list()) {
|
||||
assertFalse(userApi.getDatabaseList(user.getIdentifier()).isEmpty());
|
||||
}
|
||||
}
|
||||
|
@ -168,11 +171,12 @@ public class UserApiLiveTest extends BaseTroveApiLiveTest {
|
|||
for (String zone : api.getConfiguredZones()) {
|
||||
InstanceApi instanceApi = api.getInstanceApiForZone(zone);
|
||||
assertTrue(instanceApi.list().size() >= 2);
|
||||
for(Instance instance : instancesToDelete.get(zone)) {
|
||||
for (Instance instance : instancesToDelete.get(zone)) {
|
||||
UserApi userApi = api.getUserApiForZoneAndInstance(zone, instance.getId());
|
||||
if(!instance.getName().contains("user_trove_live_testing"))continue;
|
||||
assertTrue(userApi.list().size() >=1);
|
||||
for(User user : userApi.list()){
|
||||
if (!instance.getName().contains("user_trove_live_testing"))
|
||||
continue;
|
||||
assertTrue(userApi.list().size() >= 1);
|
||||
for (User user : userApi.list()) {
|
||||
userApi.grant(user.getIdentifier(), "dbA");
|
||||
userApi.grant(user.getIdentifier(), ImmutableList.of(
|
||||
"dbB",
|
||||
|
|
|
@ -58,7 +58,7 @@ public class UpdateDomainsToJSON implements MapBinder {
|
|||
private String toJSON(Iterable<Integer> ids, String updateTemplate, String key, String value) {
|
||||
List<String> json = Lists.newArrayList();
|
||||
|
||||
for (Integer id: ids) {
|
||||
for (Integer id : ids) {
|
||||
json.add(format(updateTemplate, id, key, value));
|
||||
}
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ public class UpdateRecordsToJSON implements Binder {
|
|||
static List<UpdateRecord> toUpdateRecordList(Map<String, Record> idsToRecords) {
|
||||
List<UpdateRecord> updateRecords = Lists.newArrayList();
|
||||
|
||||
for (String recordId: idsToRecords.keySet()) {
|
||||
for (String recordId : idsToRecords.keySet()) {
|
||||
Record record = idsToRecords.get(recordId);
|
||||
|
||||
UpdateRecord updateRecord = new UpdateRecord();
|
||||
|
|
|
@ -81,7 +81,7 @@ public class ParseDomain implements Function<HttpResponse, Domain> {
|
|||
private static Set<String> transform(Iterable<Map<String, String>> nameserversNasty) {
|
||||
Builder<String> nameservers = ImmutableSet.builder();
|
||||
|
||||
for (Map<String, String> nameToNameserver: nameserversNasty) {
|
||||
for (Map<String, String> nameToNameserver : nameserversNasty) {
|
||||
nameservers.add(nameToNameserver.get("name"));
|
||||
}
|
||||
|
||||
|
|
|
@ -139,7 +139,7 @@ public class DomainApiExpectTest extends BaseCloudDNSApiExpectTest<CloudDNSApi>
|
|||
ImmutableList<Domain> domains = api.list().concat().toList();
|
||||
assertEquals(domains.size(), 4);
|
||||
|
||||
for (Domain domain: domains) {
|
||||
for (Domain domain : domains) {
|
||||
assertTrue(domain.getName().contains(JCLOUDS_EXAMPLE));
|
||||
}
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ public class DomainApiExpectTest extends BaseCloudDNSApiExpectTest<CloudDNSApi>
|
|||
ImmutableList<Domain> domains = api.list().concat().toList();
|
||||
assertEquals(domains.size(), 8);
|
||||
|
||||
for (Domain domain: domains) {
|
||||
for (Domain domain : domains) {
|
||||
assertTrue(domain.getName().contains(JCLOUDS_EXAMPLE));
|
||||
}
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ public class DomainApiExpectTest extends BaseCloudDNSApiExpectTest<CloudDNSApi>
|
|||
ImmutableList<Subdomain> subdomains = api.listSubdomains(3650908).concat().toList();
|
||||
assertEquals(subdomains.size(), 4);
|
||||
|
||||
for (Subdomain subdomain: subdomains) {
|
||||
for (Subdomain subdomain : subdomains) {
|
||||
assertTrue(subdomain.getName().contains(JCLOUDS_EXAMPLE));
|
||||
}
|
||||
}
|
||||
|
@ -196,7 +196,7 @@ public class DomainApiExpectTest extends BaseCloudDNSApiExpectTest<CloudDNSApi>
|
|||
ImmutableList<Subdomain> subdomains = api.listSubdomains(3650908).concat().toList();
|
||||
assertEquals(subdomains.size(), 8);
|
||||
|
||||
for (Subdomain subdomain: subdomains) {
|
||||
for (Subdomain subdomain : subdomains) {
|
||||
assertTrue(subdomain.getName().contains(JCLOUDS_EXAMPLE));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -131,7 +131,7 @@ public class DomainApiLiveTest extends BaseCloudDNSApiLiveTest {
|
|||
Subdomain devjclouds = null;
|
||||
Subdomain testjclouds = null;
|
||||
|
||||
for (Subdomain subdomain: jclouds.getSubdomains()) {
|
||||
for (Subdomain subdomain : jclouds.getSubdomains()) {
|
||||
if (subdomain.getName().equals("dev." + JCLOUDS_EXAMPLE)) {
|
||||
devjclouds = subdomain;
|
||||
} else if (subdomain.getName().equals("test." + JCLOUDS_EXAMPLE)) {
|
||||
|
@ -158,7 +158,7 @@ public class DomainApiLiveTest extends BaseCloudDNSApiLiveTest {
|
|||
RecordDetail mxRecord = null;
|
||||
RecordDetail aRecord = null;
|
||||
|
||||
for (RecordDetail record: jclouds.getRecords()) {
|
||||
for (RecordDetail record : jclouds.getRecords()) {
|
||||
if (record.getType().equals("MX")) {
|
||||
mxRecord = record;
|
||||
} else if (record.getType().equals("A")) {
|
||||
|
@ -252,7 +252,7 @@ public class DomainApiLiveTest extends BaseCloudDNSApiLiveTest {
|
|||
Subdomain devjclouds = null;
|
||||
Subdomain testjclouds = null;
|
||||
|
||||
for (Subdomain subdomain: jclouds.getSubdomains()) {
|
||||
for (Subdomain subdomain : jclouds.getSubdomains()) {
|
||||
if (subdomain.getName().equals("dev." + JCLOUDS_EXAMPLE)) {
|
||||
devjclouds = subdomain;
|
||||
} else if (subdomain.getName().equals("test." + JCLOUDS_EXAMPLE)) {
|
||||
|
@ -280,7 +280,7 @@ public class DomainApiLiveTest extends BaseCloudDNSApiLiveTest {
|
|||
RecordDetail aRecord = null;
|
||||
RecordDetail nsRecord = null;
|
||||
|
||||
for (RecordDetail record: jclouds.getRecords()) {
|
||||
for (RecordDetail record : jclouds.getRecords()) {
|
||||
if (record.getType().equals("MX")) {
|
||||
mxRecord = record;
|
||||
} else if (record.getType().equals("A")) {
|
||||
|
@ -390,7 +390,7 @@ public class DomainApiLiveTest extends BaseCloudDNSApiLiveTest {
|
|||
protected void tearDown() {
|
||||
List<Integer> domainIds = Lists.newArrayList();
|
||||
|
||||
for (Domain domain: testDomains.values()) {
|
||||
for (Domain domain : testDomains.values()) {
|
||||
domainIds.add(domain.getId());
|
||||
}
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ public class RecordApiExpectTest extends BaseCloudDNSApiExpectTest<CloudDNSApi>
|
|||
RecordDetail mxRecord = null;
|
||||
RecordDetail aRecord = null;
|
||||
|
||||
for (RecordDetail record: records) {
|
||||
for (RecordDetail record : records) {
|
||||
if (record.getType().equals("MX")) {
|
||||
mxRecord = record;
|
||||
} else if (record.getType().equals("A")) {
|
||||
|
@ -126,7 +126,7 @@ public class RecordApiExpectTest extends BaseCloudDNSApiExpectTest<CloudDNSApi>
|
|||
ImmutableList<RecordDetail> records = api.list().concat().toList();
|
||||
assertEquals(records.size(), 4); // 2 created above + 2 nameserver (NS) records
|
||||
|
||||
for (RecordDetail record: records) {
|
||||
for (RecordDetail record : records) {
|
||||
assertTrue(record.getName().contains(JCLOUDS_EXAMPLE));
|
||||
}
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ public class RecordApiExpectTest extends BaseCloudDNSApiExpectTest<CloudDNSApi>
|
|||
ImmutableList<RecordDetail> records = api.list().concat().toList();
|
||||
assertEquals(records.size(), 8);
|
||||
|
||||
for (RecordDetail record: records) {
|
||||
for (RecordDetail record : records) {
|
||||
assertTrue(record.getName().contains(JCLOUDS_EXAMPLE));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ public class RecordApiLiveTest extends BaseCloudDNSApiLiveTest {
|
|||
RecordDetail aRecord = null;
|
||||
RecordDetail srvRecord = null;
|
||||
|
||||
for (RecordDetail record: records) {
|
||||
for (RecordDetail record : records) {
|
||||
if (record.getType().equals("MX")) {
|
||||
mxRecord = record;
|
||||
} else if (record.getType().equals("A")) {
|
||||
|
@ -246,7 +246,7 @@ public class RecordApiLiveTest extends BaseCloudDNSApiLiveTest {
|
|||
|
||||
recordDetails = api.getRecordApiForDomain(domainId).list().concat().toSet();
|
||||
|
||||
for (RecordDetail recordDetail: recordDetails) {
|
||||
for (RecordDetail recordDetail : recordDetails) {
|
||||
assertEquals(recordDetail.getTTL(), 35813);
|
||||
assertEquals(recordDetail.getComment(), "New TTL");
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ public class ReverseDNSApiExpectTest extends BaseCloudDNSApiExpectTest<CloudDNSA
|
|||
RecordDetail ptrRecordIPv4 = null;
|
||||
RecordDetail ptrRecordIPv6 = null;
|
||||
|
||||
for (RecordDetail record: records) {
|
||||
for (RecordDetail record : records) {
|
||||
if (record.getData().startsWith("166")) {
|
||||
ptrRecordIPv4 = record;
|
||||
} else if (record.getData().startsWith("2001")) {
|
||||
|
@ -133,7 +133,7 @@ public class ReverseDNSApiExpectTest extends BaseCloudDNSApiExpectTest<CloudDNSA
|
|||
ImmutableList<RecordDetail> records = api.list(SERVER_URI).concat().toList();
|
||||
assertEquals(records.size(), 2);
|
||||
|
||||
for (RecordDetail record: records) {
|
||||
for (RecordDetail record : records) {
|
||||
assertTrue(record.getType().contains("PTR"));
|
||||
assertTrue(record.getName().contains(JCLOUDS_EXAMPLE));
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ public class ReverseDNSApiLiveTest extends BaseCloudDNSApiLiveTest {
|
|||
RecordDetail ptrRecordIPv4 = null;
|
||||
RecordDetail ptrRecordIPv6 = null;
|
||||
|
||||
for (RecordDetail record: records) {
|
||||
for (RecordDetail record : records) {
|
||||
if (record.getData().equals(serverIPv4)) {
|
||||
ptrRecordIPv4 = record;
|
||||
ptrRecordIPv4Id = record.getId();
|
||||
|
|
|
@ -55,7 +55,7 @@ public class ParseAlgorithms implements Function<HttpResponse, List<String>>, In
|
|||
List<Map<String, String>> list = Iterables.get(map.values(), 0);
|
||||
List<String> algorithms = Lists.newArrayList();
|
||||
|
||||
for (Map<String, String> nameAlgorithmPair: list) {
|
||||
for (Map<String, String> nameAlgorithmPair : list) {
|
||||
algorithms.add(Iterables.get(nameAlgorithmPair.values(), 0));
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ public class ParseMetadata extends ParseJson<Metadata> {
|
|||
public static Metadata transformCLBMetadataToMetadata(List<CLBMetadata> clbMetadatum) {
|
||||
Metadata metadata = new Metadata();
|
||||
|
||||
for (CLBMetadata clbMetadata: clbMetadatum) {
|
||||
for (CLBMetadata clbMetadata : clbMetadatum) {
|
||||
metadata.put(clbMetadata.key, clbMetadata.value);
|
||||
metadata.putId(clbMetadata.key, clbMetadata.id);
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ public class AccessRuleApiLiveTest extends BaseCloudLoadBalancersApiLiveTest {
|
|||
public void testCreateLoadBalancer() {
|
||||
AddNode addNode = AddNode.builder().address("192.168.1.1").port(8080).build();
|
||||
CreateLoadBalancer createLB = CreateLoadBalancer.builder()
|
||||
.name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(addNode).build();
|
||||
.name(prefix + "-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(addNode).build();
|
||||
|
||||
zone = "ORD";//Iterables.getFirst(api.getConfiguredZones(), null);
|
||||
lb = api.getLoadBalancerApiForZone(zone).create(createLB);
|
||||
|
@ -126,7 +126,7 @@ public class AccessRuleApiLiveTest extends BaseCloudLoadBalancersApiLiveTest {
|
|||
private void assertExpectedAccessRules(Map<String, AccessRule> expectedAccessList) {
|
||||
Iterable<AccessRuleWithId> actualAccessList = api.getAccessRuleApiForZoneAndLoadBalancer(zone, lb.getId()).list();
|
||||
|
||||
for (AccessRule actualAccessRule: actualAccessList) {
|
||||
for (AccessRule actualAccessRule : actualAccessList) {
|
||||
assertEquals(expectedAccessList.containsKey(actualAccessRule.getAddress()), true,
|
||||
"The AccessRule " + actualAccessRule + " was not found in " + expectedAccessList);
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ public class ConnectionApiLiveTest extends BaseCloudLoadBalancersApiLiveTest {
|
|||
public void testCreateLoadBalancer() {
|
||||
AddNode addNode = AddNode.builder().address("192.168.1.1").port(8080).build();
|
||||
CreateLoadBalancer createLB = CreateLoadBalancer.builder()
|
||||
.name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(addNode).build();
|
||||
.name(prefix + "-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(addNode).build();
|
||||
|
||||
zone = Iterables.getFirst(api.getConfiguredZones(), null);
|
||||
lb = api.getLoadBalancerApiForZone(zone).create(createLB);
|
||||
|
|
|
@ -42,7 +42,7 @@ public class ContentCachingApiLiveTest extends BaseCloudLoadBalancersApiLiveTest
|
|||
public void testCreateLoadBalancer() {
|
||||
AddNode addNode = AddNode.builder().address("192.168.1.1").port(8080).build();
|
||||
CreateLoadBalancer createLB = CreateLoadBalancer.builder()
|
||||
.name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(addNode).build();
|
||||
.name(prefix + "-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(addNode).build();
|
||||
|
||||
zone = Iterables.getFirst(api.getConfiguredZones(), null);
|
||||
lb = api.getLoadBalancerApiForZone(zone).create(createLB);
|
||||
|
|
|
@ -54,7 +54,7 @@ public class ErrorPageApiLiveTest extends BaseCloudLoadBalancersApiLiveTest {
|
|||
public void testCreateLoadBalancer() {
|
||||
AddNode addNode = AddNode.builder().address("192.168.1.1").port(8080).build();
|
||||
CreateLoadBalancer createLB = CreateLoadBalancer.builder()
|
||||
.name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(addNode).build();
|
||||
.name(prefix + "-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(addNode).build();
|
||||
|
||||
zone = Iterables.getFirst(api.getConfiguredZones(), null);
|
||||
lb = api.getLoadBalancerApiForZone(zone).create(createLB);
|
||||
|
|
|
@ -44,7 +44,7 @@ public class HealthMonitorApiLiveTest extends BaseCloudLoadBalancersApiLiveTest
|
|||
public void testCreateLoadBalancer() {
|
||||
AddNode addNode = AddNode.builder().address("192.168.1.1").port(8080).build();
|
||||
CreateLoadBalancer createLB = CreateLoadBalancer.builder()
|
||||
.name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(addNode).build();
|
||||
.name(prefix + "-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(addNode).build();
|
||||
|
||||
zone = Iterables.getFirst(api.getConfiguredZones(), null);
|
||||
lb = api.getLoadBalancerApiForZone(zone).create(createLB);
|
||||
|
|
|
@ -52,7 +52,7 @@ public class LoadBalancerApiLiveTest extends BaseCloudLoadBalancersApiLiveTest {
|
|||
@Override
|
||||
@AfterGroups(groups = "live")
|
||||
protected void tearDown() {
|
||||
for (LoadBalancer lb: lbs) {
|
||||
for (LoadBalancer lb : lbs) {
|
||||
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(lb.getRegion())).apply(lb));
|
||||
api.getLoadBalancerApiForZone(lb.getRegion()).delete(lb.getId());
|
||||
assertTrue(awaitDeleted(api.getLoadBalancerApiForZone(lb.getRegion())).apply(lb));
|
||||
|
@ -61,7 +61,7 @@ public class LoadBalancerApiLiveTest extends BaseCloudLoadBalancersApiLiveTest {
|
|||
}
|
||||
|
||||
public void testCreateLoadBalancer() throws Exception {
|
||||
for (String zone: api.getConfiguredZones()) {
|
||||
for (String zone : api.getConfiguredZones()) {
|
||||
Logger.getAnonymousLogger().info("starting lb in region " + zone);
|
||||
|
||||
LoadBalancer lb = api.getLoadBalancerApiForZone(zone).create(
|
||||
|
@ -92,7 +92,7 @@ public class LoadBalancerApiLiveTest extends BaseCloudLoadBalancersApiLiveTest {
|
|||
|
||||
@Test(dependsOnMethods = "testCreateLoadBalancer")
|
||||
public void testUpdateLoadBalancer() throws Exception {
|
||||
for (LoadBalancer lb: lbs) {
|
||||
for (LoadBalancer lb : lbs) {
|
||||
api.getLoadBalancerApiForZone(lb.getRegion()).update(lb.getId(),
|
||||
UpdateLoadBalancer.builder().name("foo" + "-" + lb.getRegion()).build());
|
||||
|
||||
|
@ -107,14 +107,14 @@ public class LoadBalancerApiLiveTest extends BaseCloudLoadBalancersApiLiveTest {
|
|||
|
||||
@Test(dependsOnMethods = "testUpdateLoadBalancer")
|
||||
public void testListLoadBalancers() throws Exception {
|
||||
for (String zone: api.getConfiguredZones()) {
|
||||
for (String zone : api.getConfiguredZones()) {
|
||||
|
||||
Set<LoadBalancer> response = api.getLoadBalancerApiForZone(zone).list().concat().toSet();
|
||||
|
||||
assertNotNull(response);
|
||||
assertTrue(response.size() >= 0);
|
||||
|
||||
for (LoadBalancer lb: response) {
|
||||
for (LoadBalancer lb : response) {
|
||||
if (!lbs.contains(lb))
|
||||
continue;
|
||||
assert lb.getRegion() != null : lb;
|
||||
|
@ -152,7 +152,7 @@ public class LoadBalancerApiLiveTest extends BaseCloudLoadBalancersApiLiveTest {
|
|||
|
||||
@Test(dependsOnMethods = "testListLoadBalancers")
|
||||
public void testLoadBalancerMetadata() throws Exception {
|
||||
for (LoadBalancer lb: lbs) {
|
||||
for (LoadBalancer lb : lbs) {
|
||||
Map<String, String> metadataMap = ImmutableMap.<String, String> of(
|
||||
"key1", "value1",
|
||||
"key2", "value2",
|
||||
|
|
|
@ -52,7 +52,7 @@ public class ReportApiLiveTest extends BaseCloudLoadBalancersApiLiveTest {
|
|||
public void testCreateLoadBalancer() {
|
||||
AddNode addNode = AddNode.builder().address("192.168.1.1").port(8080).build();
|
||||
CreateLoadBalancer createLB = CreateLoadBalancer.builder()
|
||||
.name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(addNode).build();
|
||||
.name(prefix + "-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(addNode).build();
|
||||
|
||||
zone = Iterables.getFirst(api.getConfiguredZones(), null);
|
||||
lb = api.getLoadBalancerApiForZone(zone).create(createLB);
|
||||
|
|
|
@ -44,7 +44,7 @@ public class SSLTerminationApiLiveTest extends BaseCloudLoadBalancersApiLiveTest
|
|||
public void testCreateLoadBalancer() {
|
||||
AddNode addNode = AddNode.builder().address("192.168.1.1").port(8080).build();
|
||||
CreateLoadBalancer createLB = CreateLoadBalancer.builder()
|
||||
.name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(addNode).build();
|
||||
.name(prefix + "-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(addNode).build();
|
||||
|
||||
zone = Iterables.getFirst(api.getConfiguredZones(), null);
|
||||
lb = api.getLoadBalancerApiForZone(zone).create(createLB);
|
||||
|
|
|
@ -44,7 +44,7 @@ public class SessionPersistenceApiLiveTest extends BaseCloudLoadBalancersApiLive
|
|||
public void testCreateLoadBalancer() {
|
||||
AddNode addNode = AddNode.builder().address("192.168.1.1").port(8080).build();
|
||||
CreateLoadBalancer createLB = CreateLoadBalancer.builder()
|
||||
.name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(addNode).build();
|
||||
.name(prefix + "-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(addNode).build();
|
||||
|
||||
zone = Iterables.getFirst(api.getConfiguredZones(), null);
|
||||
lb = api.getLoadBalancerApiForZone(zone).create(createLB);
|
||||
|
|
|
@ -48,7 +48,7 @@ public class VirtualIPApiLiveTest extends BaseCloudLoadBalancersApiLiveTest {
|
|||
public void testCreateLoadBalancer() {
|
||||
AddNode addNode = AddNode.builder().address("192.168.1.1").port(8080).build();
|
||||
CreateLoadBalancer createLB = CreateLoadBalancer.builder()
|
||||
.name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(addNode).build();
|
||||
.name(prefix + "-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(addNode).build();
|
||||
|
||||
zone = Iterables.getFirst(api.getConfiguredZones(), null);
|
||||
lb = api.getLoadBalancerApiForZone(zone).create(createLB);
|
||||
|
|
|
@ -222,7 +222,7 @@ public class BucketsLiveTest extends BaseBlobStoreIntegrationTest {
|
|||
public void run() {
|
||||
try {
|
||||
BucketLogging newLogging = getApi().getBucketLogging(bucketName);
|
||||
assert newLogging !=null;
|
||||
assert newLogging != null;
|
||||
AccessControlList acl = new AccessControlList();
|
||||
for (Grant grant : newLogging.getTargetGrants()) { // TODO: add permission
|
||||
// checking features to
|
||||
|
|
|
@ -61,7 +61,7 @@ public class BindIterableToHeadersWithContainerDeleteMetadataPrefix implements B
|
|||
Iterable<String> metadataKeys = Iterables.transform((Iterable<String>) input, FN);
|
||||
HashMultimap<String, String> headers = HashMultimap.create();
|
||||
|
||||
for (String metadataKey: metadataKeys) {
|
||||
for (String metadataKey : metadataKeys) {
|
||||
headers.put(metadataKey, "");
|
||||
}
|
||||
|
||||
|
|
|
@ -358,7 +358,7 @@ public abstract class CommonSwiftClientLiveTest<C extends CommonSwiftClient> ext
|
|||
|
||||
protected void testGetObjectContentType(SwiftObject getBlob) {
|
||||
String contentType = getBlob.getPayload().getContentMetadata().getContentType();
|
||||
assert contentType.startsWith("text/plain") || "application/x-www-form-urlencoded".equals(contentType): contentType;
|
||||
assert contentType.startsWith("text/plain") || "application/x-www-form-urlencoded".equals(contentType) : contentType;
|
||||
}
|
||||
|
||||
protected SwiftObject newSwiftObject(String data, String key) throws IOException {
|
||||
|
|
|
@ -37,7 +37,7 @@ public class BaseSwiftExpectTest<T> extends BaseRestClientExpectTest<T> {
|
|||
credential = "testing";
|
||||
authRequest = HttpRequest.builder()
|
||||
.method("GET")
|
||||
.endpoint(endpoint+ "/v1.0")
|
||||
.endpoint(endpoint + "/v1.0")
|
||||
.addHeader("X-Auth-User", identity)
|
||||
.addHeader("X-Auth-Key", credential)
|
||||
.addHeader("Accept", "*/*")
|
||||
|
@ -62,7 +62,7 @@ public class BaseSwiftExpectTest<T> extends BaseRestClientExpectTest<T> {
|
|||
|
||||
protected Properties setupProperties() {
|
||||
Properties props = super.setupProperties();
|
||||
props.put(provider+".endpoint", endpoint);
|
||||
props.put(provider + ".endpoint", endpoint);
|
||||
return props;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ public abstract class BaseVCloudComputeServiceExpectTest extends BaseRestClientE
|
|||
// login response includes a cookie and also a vcloud extended header with the session token in it
|
||||
// NOTE: vCloud Director 1.5 returns ;version=1.0 on responses to requests made in 1.0 format.
|
||||
protected HttpResponse successfulVersion1_0LoginResponseFromVCD1_5WithSingleOrg = HttpResponse.builder().statusCode(200)
|
||||
.message("HTTP/1.1 200 OK").payload(payloadFromResourceWithContentType("/orgList1.0-vcd15.xml", VCloudMediaType.ORGLIST_XML +";version=1.0"))
|
||||
.message("HTTP/1.1 200 OK").payload(payloadFromResourceWithContentType("/orgList1.0-vcd15.xml", VCloudMediaType.ORGLIST_XML + ";version=1.0"))
|
||||
.addHeader("x-vcloud-authorization", sessionToken)
|
||||
.addHeader(HttpHeaders.SET_COOKIE, String.format("vcloud-token=%s; Secure; Path=/", sessionToken)).build();
|
||||
|
||||
|
@ -71,7 +71,7 @@ public abstract class BaseVCloudComputeServiceExpectTest extends BaseRestClientE
|
|||
.addHeader(HttpHeaders.COOKIE, "vcloud-token=" + sessionToken).build();
|
||||
|
||||
protected HttpResponse successfulVersion1_0GetOrgResponseFromVCD1_5WithSingleTasksListVDCAndNetwork = HttpResponse.builder().statusCode(200)
|
||||
.message("HTTP/1.1 200 OK").payload(payloadFromResourceWithContentType("/org1.0-vcd15.xml", VCloudMediaType.ORG_XML +";version=1.0"))
|
||||
.message("HTTP/1.1 200 OK").payload(payloadFromResourceWithContentType("/org1.0-vcd15.xml", VCloudMediaType.ORG_XML + ";version=1.0"))
|
||||
.build();
|
||||
|
||||
protected String catalogId = "3155f393-1e1d-4572-8c9c-d76f72ddb658";
|
||||
|
@ -83,7 +83,7 @@ public abstract class BaseVCloudComputeServiceExpectTest extends BaseRestClientE
|
|||
.addHeader(HttpHeaders.COOKIE, "vcloud-token=" + sessionToken).build();
|
||||
|
||||
protected HttpResponse successfulVersion1_0GetCatalogResponseFromVCD1_5WithSingleTemplate = HttpResponse.builder().statusCode(200)
|
||||
.message("HTTP/1.1 200 OK").payload(payloadFromResourceWithContentType("/catalog1.0-vcd15.xml", VCloudMediaType.CATALOG_XML +";version=1.0"))
|
||||
.message("HTTP/1.1 200 OK").payload(payloadFromResourceWithContentType("/catalog1.0-vcd15.xml", VCloudMediaType.CATALOG_XML + ";version=1.0"))
|
||||
.build();
|
||||
|
||||
protected String catalogItemId = "ceb369f7-1d07-4e32-9dbd-ebb5aa6ca55c";
|
||||
|
@ -94,7 +94,7 @@ public abstract class BaseVCloudComputeServiceExpectTest extends BaseRestClientE
|
|||
.addHeader(HttpHeaders.COOKIE, "vcloud-token=" + sessionToken).build();
|
||||
|
||||
protected HttpResponse successfulVersion1_0GetCatalogItemResponseFromVCD1_5ForTemplate = HttpResponse.builder().statusCode(200)
|
||||
.message("HTTP/1.1 200 OK").payload(payloadFromResourceWithContentType("/catalogItem1.0-vcd15.xml", VCloudMediaType.CATALOGITEM_XML +";version=1.0"))
|
||||
.message("HTTP/1.1 200 OK").payload(payloadFromResourceWithContentType("/catalogItem1.0-vcd15.xml", VCloudMediaType.CATALOGITEM_XML + ";version=1.0"))
|
||||
.build();
|
||||
|
||||
// note vAppTemplate has a prefix in its id
|
||||
|
@ -106,7 +106,7 @@ public abstract class BaseVCloudComputeServiceExpectTest extends BaseRestClientE
|
|||
.addHeader(HttpHeaders.COOKIE, "vcloud-token=" + sessionToken).build();
|
||||
|
||||
protected HttpResponse successfulVersion1_0GetVDCResponseFromVCD1_5WithSingleTemplateAndNetwork = HttpResponse.builder().statusCode(200)
|
||||
.message("HTTP/1.1 200 OK").payload(payloadFromResourceWithContentType("/vdc1.0-vcd15.xml", VCloudMediaType.VDC_XML +";version=1.0"))
|
||||
.message("HTTP/1.1 200 OK").payload(payloadFromResourceWithContentType("/vdc1.0-vcd15.xml", VCloudMediaType.VDC_XML + ";version=1.0"))
|
||||
.build();
|
||||
|
||||
protected String networkId = "b466c0c5-8a5c-4335-b703-a2e2e6b5f3e1";
|
||||
|
@ -117,11 +117,11 @@ public abstract class BaseVCloudComputeServiceExpectTest extends BaseRestClientE
|
|||
.addHeader(HttpHeaders.COOKIE, "vcloud-token=" + sessionToken).build();
|
||||
|
||||
protected HttpResponse successfulVersion1_0GetVAppTemplateResponseFromVCD1_5WithSingleVMAndVDCParent = HttpResponse.builder().statusCode(200)
|
||||
.message("HTTP/1.1 200 OK").payload(payloadFromResourceWithContentType("/template1.0-vcd15.xml", VCloudMediaType.VAPPTEMPLATE_XML +";version=1.0"))
|
||||
.message("HTTP/1.1 200 OK").payload(payloadFromResourceWithContentType("/template1.0-vcd15.xml", VCloudMediaType.VAPPTEMPLATE_XML + ";version=1.0"))
|
||||
.build();
|
||||
|
||||
protected HttpResponse successfulVersion1_0GetVAppTemplateResponseFromVCD1_5WithMultipleVMsAndVDCParent = HttpResponse.builder().statusCode(200)
|
||||
.message("HTTP/1.1 200 OK").payload(payloadFromResourceWithContentType("/template1.0-vcd15-multi-vm.xml", VCloudMediaType.VAPPTEMPLATE_XML +";version=1.0"))
|
||||
.message("HTTP/1.1 200 OK").payload(payloadFromResourceWithContentType("/template1.0-vcd15-multi-vm.xml", VCloudMediaType.VAPPTEMPLATE_XML + ";version=1.0"))
|
||||
.build();
|
||||
|
||||
protected HttpRequest version1_0GetOVFForVAppTemplateRequest = HttpRequest.builder().method("GET").endpoint(ENDPOINT + "/v1.0/vAppTemplate/" + templateId + "/ovf")
|
||||
|
@ -130,11 +130,11 @@ public abstract class BaseVCloudComputeServiceExpectTest extends BaseRestClientE
|
|||
.addHeader(HttpHeaders.COOKIE, "vcloud-token=" + sessionToken).build();
|
||||
|
||||
protected HttpResponse successfulVersion1_0GetOVFForVAppTemplateResponseFromVCD1_5WithSingleVM = HttpResponse.builder().statusCode(200)
|
||||
.message("HTTP/1.1 200 OK").payload(payloadFromResourceWithContentType("/ovf-ubuntu64.xml", MediaType.TEXT_XML +";version=1.0"))
|
||||
.message("HTTP/1.1 200 OK").payload(payloadFromResourceWithContentType("/ovf-ubuntu64.xml", MediaType.TEXT_XML + ";version=1.0"))
|
||||
.build();
|
||||
|
||||
protected HttpResponse successfulVersion1_0GetOVFForVAppTemplateResponseFromVCD1_5WithMultipleVMs = HttpResponse.builder().statusCode(200)
|
||||
.message("HTTP/1.1 200 OK").payload(payloadFromResourceWithContentType("/ovf-multi-vm.xml", MediaType.TEXT_XML +";version=1.0"))
|
||||
.message("HTTP/1.1 200 OK").payload(payloadFromResourceWithContentType("/ovf-multi-vm.xml", MediaType.TEXT_XML + ";version=1.0"))
|
||||
.build();
|
||||
|
||||
public BaseVCloudComputeServiceExpectTest() {
|
||||
|
|
|
@ -59,7 +59,7 @@ import com.google.inject.Module;
|
|||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "live", testName="StubComputeServiceIntegrationTest")
|
||||
@Test(groups = "live", testName = "StubComputeServiceIntegrationTest")
|
||||
public class StubComputeServiceIntegrationTest extends BaseComputeServiceLiveTest {
|
||||
|
||||
private static final ExecResponse EXEC_GOOD = new ExecResponse("", "", 0);
|
||||
|
|
|
@ -28,7 +28,7 @@ import org.testng.annotations.Test;
|
|||
* @author Andrew Bayer
|
||||
*
|
||||
*/
|
||||
@Test(groups = { "integration", "live" }, singleThreaded = true, testName="StubSecurityGroupExtensionIntegrationTest")
|
||||
@Test(groups = { "integration", "live" }, singleThreaded = true, testName = "StubSecurityGroupExtensionIntegrationTest")
|
||||
public class StubSecurityGroupExtensionIntegrationTest extends BaseSecurityGroupExtensionLiveTest {
|
||||
|
||||
public StubSecurityGroupExtensionIntegrationTest() {
|
||||
|
|
|
@ -57,7 +57,7 @@ import com.google.inject.TypeLiteral;
|
|||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "unit", testName="ContextBuilderTest")
|
||||
@Test(groups = "unit", testName = "ContextBuilderTest")
|
||||
public class ContextBuilderTest {
|
||||
|
||||
@ConfiguresHttpCommandExecutorService
|
||||
|
|
|
@ -35,7 +35,7 @@ import org.testng.annotations.Test;
|
|||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups="performance")
|
||||
@Test(groups = "performance")
|
||||
public abstract class PerformanceTest {
|
||||
protected static int LOOP_COUNT = 1000;
|
||||
protected static int THREAD_COUNT = 100;
|
||||
|
|
|
@ -84,7 +84,7 @@ public abstract class BaseApiLiveTest<A extends Closeable> {
|
|||
*/
|
||||
protected Set<String> filterZones(Set<String> zones) {
|
||||
String zonesToList = System.getProperty("test.live.zones");
|
||||
if(zonesToList == null) {
|
||||
if (zonesToList == null) {
|
||||
return zones; // no filter applied
|
||||
}
|
||||
Set<String> zoneFilter = Sets.newHashSet(Splitter.on(',').split(zonesToList));
|
||||
|
|
|
@ -65,16 +65,16 @@ public class BufferLogger extends BaseLogger {
|
|||
* otherwise returns a record which does satisfy the constraint
|
||||
*/
|
||||
public Record assertLogContains(String fragment) {
|
||||
for (Record r: messages) {
|
||||
for (Record r : messages) {
|
||||
if (r.getMessage() != null && r.getMessage().contains(fragment)) return r;
|
||||
}
|
||||
throw new AssertionError("log did not contain expected '"+fragment+"'");
|
||||
throw new AssertionError("log did not contain expected '" + fragment + "'");
|
||||
}
|
||||
/** fails if log _does_ contain the indicated fragment */
|
||||
public void assertLogDoesntContain(String fragment) {
|
||||
for (Record r: messages) {
|
||||
for (Record r : messages) {
|
||||
if (r.getMessage() != null && r.getMessage().contains(fragment))
|
||||
throw new AssertionError("log contained unexpected '"+fragment+"'");
|
||||
throw new AssertionError("log contained unexpected '" + fragment + "'");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ public class BufferLogger extends BaseLogger {
|
|||
* otherwise returns a record which does satisfy the constraint
|
||||
*/
|
||||
public Record assertLogContains(Predicate<Record> test) {
|
||||
for (Record r: messages) {
|
||||
for (Record r : messages) {
|
||||
if (r.getMessage() != null && test.apply(r)) return r;
|
||||
}
|
||||
throw new AssertionError("log did not contain any records satisfying expected predicate");
|
||||
|
|
|
@ -180,7 +180,7 @@ public abstract class BaseRestApiTest {
|
|||
|
||||
protected void assertSaxResponseParserClassEquals(Invokable<?, ?> method, @Nullable Class<?> parserClass) {
|
||||
XMLResponseParser annotation = method.getAnnotation(XMLResponseParser.class);
|
||||
Class<?> expected = (annotation != null) ? annotation.value() :null;
|
||||
Class<?> expected = (annotation != null) ? annotation.value() : null;
|
||||
assertEquals(expected, parserClass);
|
||||
}
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ public class Predicates2Test {
|
|||
stopwatch.start();
|
||||
predicate.apply("");
|
||||
long duration = stopwatch.elapsed(MILLISECONDS);
|
||||
assertOrdered(3000-EARLY_RETURN_GRACE, duration, 3000+SLOW_BUILD_SERVER_GRACE);
|
||||
assertOrdered(3000 - EARLY_RETURN_GRACE, duration, 3000 + SLOW_BUILD_SERVER_GRACE);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -134,8 +134,8 @@ public class Predicates2Test {
|
|||
predicate.apply("");
|
||||
long duration = stopwatch.elapsed(MILLISECONDS);
|
||||
|
||||
assertOrdered(2500-EARLY_RETURN_GRACE, duration, 2500+SLOW_BUILD_SERVER_GRACE);
|
||||
assertCallTimes(rawPredicate.callTimes, 0, 1000, 1000+1500);
|
||||
assertOrdered(2500 - EARLY_RETURN_GRACE, duration, 2500 + SLOW_BUILD_SERVER_GRACE);
|
||||
assertCallTimes(rawPredicate.callTimes, 0, 1000, 1000 + 1500);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -149,7 +149,7 @@ public class Predicates2Test {
|
|||
predicate.apply("");
|
||||
long duration = stopwatch.elapsed(MILLISECONDS);
|
||||
|
||||
assertOrdered(2000-EARLY_RETURN_GRACE, duration, 2000+SLOW_BUILD_SERVER_GRACE);
|
||||
assertOrdered(2000 - EARLY_RETURN_GRACE, duration, 2000 + SLOW_BUILD_SERVER_GRACE);
|
||||
assertCallTimes(rawPredicate.callTimes, 0, 1000, 2000);
|
||||
}
|
||||
|
||||
|
@ -171,12 +171,12 @@ public class Predicates2Test {
|
|||
}
|
||||
}
|
||||
|
||||
@Test(enabled=false) // not a test, but picked up as such because public
|
||||
@Test(enabled = false) // not a test, but picked up as such because public
|
||||
public static void assertCallTimes(List<Long> actual, Integer... expected) {
|
||||
Assert.assertEquals(actual.size(), expected.length);
|
||||
for (int i = 0; i < expected.length; i++) {
|
||||
long callTime = actual.get(i);
|
||||
assertOrdered(expected[i]-EARLY_RETURN_GRACE, callTime, expected[i]+SLOW_BUILD_SERVER_GRACE);
|
||||
assertOrdered(expected[i] - EARLY_RETURN_GRACE, callTime, expected[i] + SLOW_BUILD_SERVER_GRACE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ import com.google.common.net.HostAndPort;
|
|||
|
||||
public class GaeSocketOpenTest {
|
||||
|
||||
@Test(expectedExceptions=UnsupportedOperationException.class)
|
||||
@Test(expectedExceptions = UnsupportedOperationException.class)
|
||||
public void testSocketOpenThrowsUnsupported() {
|
||||
Context context = ContextBuilder.newBuilder(
|
||||
AnonymousProviderMetadata.forClientMappedToAsyncClientOnEndpoint(IntegrationTestClient.class, IntegrationTestAsyncClient.class,
|
||||
|
|
|
@ -196,14 +196,14 @@ public class JschSshClientLiveTest {
|
|||
ExecResponse response = client.exec("thisCommandDoesNotExist");
|
||||
assertNotEquals(response.getExitStatus(), 0);
|
||||
assertTrue(response.getOutput().contains("not found") || response.getError().contains("not found"),
|
||||
"stdout="+response.getOutput()+"; stderr="+response.getError());
|
||||
"stdout=" + response.getOutput() + "; stderr=" + response.getError());
|
||||
} finally {
|
||||
client.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
// Added for issue #1016.
|
||||
@Test(invocationCount=100)
|
||||
@Test(invocationCount = 100)
|
||||
public void testExecHostnameRepeatedlyWithDifferentSessions() throws Exception {
|
||||
testExecHostname();
|
||||
}
|
||||
|
@ -219,7 +219,7 @@ public class JschSshClientLiveTest {
|
|||
assertEquals(response.getError(), "");
|
||||
assertEquals(response.getOutput().trim(), "localhost".equals(sshHost) ? InetAddress.getLocalHost().getHostName()
|
||||
: sshHost);
|
||||
//System.out.println("completed (sequentially) "+i);
|
||||
//System.out.println("completed (sequentially) " + i);
|
||||
}
|
||||
} finally {
|
||||
client.disconnect();
|
||||
|
@ -241,7 +241,7 @@ public class JschSshClientLiveTest {
|
|||
@Override
|
||||
public ExecResponse call() {
|
||||
ExecResponse response = client.exec("hostname");
|
||||
//System.out.println("completed (concurrently) "+count.incrementAndGet());
|
||||
//System.out.println("completed (concurrently) " + count.incrementAndGet());
|
||||
return response;
|
||||
|
||||
}
|
||||
|
|
|
@ -236,7 +236,7 @@ public class ServerApiLiveTest extends BaseGleSYSApiWithAServerLiveTest {
|
|||
}
|
||||
|
||||
// takes a few minutes and requires an extra server (used 1 already)
|
||||
@Test(enabled=false)
|
||||
@Test(enabled = false)
|
||||
public void testCloneServer() throws Exception {
|
||||
ServerDetails testServer2 = serverApi.clone(serverId, testHostName2, CloneServerOptions.Builder.cpucores(1));
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ public class SoftLayerTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTes
|
|||
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
|
||||
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
|
||||
assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
|
||||
assertEquals(defaultTemplate.getHardware().getRam(), 1*1024);
|
||||
assertEquals(defaultTemplate.getHardware().getRam(), 1 * 1024);
|
||||
assertEquals(getSpace(defaultTemplate.getHardware()), 25.0d);
|
||||
assertEquals(defaultTemplate.getHardware().getVolumes().get(0).getType(), Volume.Type.LOCAL);
|
||||
// test that we bound the correct templateoptions in guice
|
||||
|
@ -141,7 +141,7 @@ public class SoftLayerTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTes
|
|||
|
||||
Template template = context.getComputeService().templateBuilder().biggest().build();
|
||||
assertEquals(getCores(template.getHardware()), 16.0d);
|
||||
assertEquals(template.getHardware().getRam(), 16*1024);
|
||||
assertEquals(template.getHardware().getRam(), 16 * 1024);
|
||||
assertEquals(getSpace(template.getHardware()), 100.0d);
|
||||
assertEquals(template.getHardware().getVolumes().get(0).getType(), Volume.Type.SAN);
|
||||
} finally {
|
||||
|
@ -161,7 +161,7 @@ public class SoftLayerTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTes
|
|||
|
||||
Template template = context.getComputeService().templateBuilder().build();
|
||||
assertEquals(getCores(template.getHardware()), 1.0d);
|
||||
assertEquals(template.getHardware().getRam(), 1*1024);
|
||||
assertEquals(template.getHardware().getRam(), 1 * 1024);
|
||||
assertEquals(getSpace(template.getHardware()), 25.0d);
|
||||
assertEquals(template.getHardware().getVolumes().get(0).getType(), Volume.Type.LOCAL);
|
||||
} finally {
|
||||
|
@ -181,7 +181,7 @@ public class SoftLayerTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTes
|
|||
|
||||
Template template = context.getComputeService().templateBuilder().biggest().build();
|
||||
assertEquals(getCores(template.getHardware()), 8.0d);
|
||||
assertEquals(template.getHardware().getRam(), 16*1024);
|
||||
assertEquals(template.getHardware().getRam(), 16 * 1024);
|
||||
assertEquals(getSpace(template.getHardware()), 100.0d);
|
||||
assertEquals(template.getHardware().getVolumes().get(0).getType(), Volume.Type.LOCAL);
|
||||
} finally {
|
||||
|
@ -194,7 +194,7 @@ public class SoftLayerTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTes
|
|||
public void testFastestTemplateBuilder() throws IOException {
|
||||
Template template = view.getComputeService().templateBuilder().fastest().build();
|
||||
assertEquals(getCores(template.getHardware()), 16.0d);
|
||||
assertEquals(template.getHardware().getRam(), 1*1024);
|
||||
assertEquals(template.getHardware().getRam(), 1 * 1024);
|
||||
assertEquals(getSpace(template.getHardware()), 25.0d);
|
||||
assertEquals(template.getHardware().getVolumes().get(0).getType(), Volume.Type.LOCAL);
|
||||
}
|
||||
|
@ -203,7 +203,7 @@ public class SoftLayerTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTes
|
|||
public void testBiggestTemplateBuilder() throws IOException {
|
||||
Template template = view.getComputeService().templateBuilder().biggest().build();
|
||||
assertEquals(getCores(template.getHardware()), 16.0d);
|
||||
assertEquals(template.getHardware().getRam(), 16*1024);
|
||||
assertEquals(template.getHardware().getRam(), 16 * 1024);
|
||||
assertEquals(getSpace(template.getHardware()), 100.0d);
|
||||
assertEquals(template.getHardware().getVolumes().get(0).getType(), Volume.Type.LOCAL);
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ public class AccountApiLiveTest extends BaseSoftLayerApiLiveTest {
|
|||
assert null != response;
|
||||
|
||||
assertTrue(response.size() >= 0);
|
||||
for (ProductPackage productPackage: response) {
|
||||
for (ProductPackage productPackage : response) {
|
||||
assert productPackage.getId() > 0 : response;
|
||||
assert productPackage.getName() != null : response;
|
||||
assert productPackage.getDescription() != null : response;
|
||||
|
|
|
@ -73,7 +73,7 @@ public class DatacenterApiLiveTest extends BaseSoftLayerApiLiveTest {
|
|||
assertEquals(response.size(), expected.size());
|
||||
assertTrue(response.containsAll(expected));
|
||||
|
||||
for (Datacenter datacenter: response) {
|
||||
for (Datacenter datacenter : response) {
|
||||
Address address = datacenter.getLocationAddress();
|
||||
if (address != null) checkAddress(address);
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ public class DatacenterApiLiveTest extends BaseSoftLayerApiLiveTest {
|
|||
assert dc.getId() > 0 : dc;
|
||||
assert dc.getName() != null : dc;
|
||||
assert dc.getLongName() != null : dc;
|
||||
for ( Region region: dc.getRegions()) checkRegion(region);
|
||||
for (Region region : dc.getRegions()) checkRegion(region);
|
||||
}
|
||||
|
||||
private void checkRegion(Region region) {
|
||||
|
@ -96,7 +96,7 @@ public class DatacenterApiLiveTest extends BaseSoftLayerApiLiveTest {
|
|||
}
|
||||
|
||||
private void checkAddress(Address address) {
|
||||
assert address.getId() >0 : address;
|
||||
assert address.getId() > 0 : address;
|
||||
assert address.getCountry() != null : address;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,6 +46,11 @@
|
|||
<module name="WhitespaceAfter">
|
||||
<property name="tokens" value="COMMA"/>
|
||||
</module>
|
||||
<module name="WhitespaceAround">
|
||||
<property name="ignoreEnhancedForColon" value="false" />
|
||||
<!-- TODO: enable LCURLY, RCURLY, SLIST -->
|
||||
<property name="tokens" value="ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, EQUAL, GE, GT, LAND, LE, LITERAL_ASSERT, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, SL, SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN, TYPE_EXTENSION_AND" />
|
||||
</module>
|
||||
</module>
|
||||
<module name="RegexpMultiline">
|
||||
<property name="format" value="=\s*new ArrayList<[^>]"/>
|
||||
|
|
|
@ -36,16 +36,16 @@ public class SwitchArgTest {
|
|||
assertEquals(new SwitchArg(1, ImmutableMap.of("0", newStatementList(appendFile(
|
||||
"{tmp}{fs}{uid}{fs}scripttest{fs}temp.txt", ImmutableList.of("hello world")),
|
||||
interpret("echo hello zero{lf}")), "1", interpret("echo hello one{lf}"))).render(OsFamily.UNIX),
|
||||
"case $1 in\n"+
|
||||
"0)\n"+
|
||||
" cat >> /tmp/$USER/scripttest/temp.txt <<-'END_OF_JCLOUDS_FILE'\n"+
|
||||
"\thello world\n"+
|
||||
"END_OF_JCLOUDS_FILE\n"+
|
||||
" echo hello zero\n"+
|
||||
" ;;\n"+
|
||||
"1)\n"+
|
||||
" echo hello one\n"+
|
||||
" ;;\n"+
|
||||
"case $1 in\n" +
|
||||
"0)\n" +
|
||||
" cat >> /tmp/$USER/scripttest/temp.txt <<-'END_OF_JCLOUDS_FILE'\n" +
|
||||
"\thello world\n" +
|
||||
"END_OF_JCLOUDS_FILE\n" +
|
||||
" echo hello zero\n" +
|
||||
" ;;\n" +
|
||||
"1)\n" +
|
||||
" echo hello one\n" +
|
||||
" ;;\n" +
|
||||
"esac\n");
|
||||
}
|
||||
|
||||
|
|
|
@ -30,10 +30,10 @@ public class SudoStatementsTest {
|
|||
public void testCreateWheelUNIX() {
|
||||
assertEquals(
|
||||
SudoStatements.createWheel().render(OsFamily.UNIX),
|
||||
"cat > /etc/sudoers <<-'END_OF_JCLOUDS_FILE'\n"+
|
||||
"\troot ALL = (ALL) ALL\n"+
|
||||
"\t%wheel ALL = (ALL) NOPASSWD:ALL\n"+
|
||||
"END_OF_JCLOUDS_FILE\n"+
|
||||
"cat > /etc/sudoers <<-'END_OF_JCLOUDS_FILE'\n" +
|
||||
"\troot ALL = (ALL) ALL\n" +
|
||||
"\t%wheel ALL = (ALL) NOPASSWD:ALL\n" +
|
||||
"END_OF_JCLOUDS_FILE\n" +
|
||||
"chmod 0440 /etc/sudoers\n");
|
||||
}
|
||||
|
||||
|
|
|
@ -32,32 +32,32 @@ public class AuthorizeRSAPublicKeyTest {
|
|||
public void testAuthorizeRSAPublicKeyUNIXCurrentUser() {
|
||||
assertEquals(
|
||||
new AuthorizeRSAPublicKeys(ImmutableSet.of("ssh-dss AAAAB")).render(OsFamily.UNIX),
|
||||
"mkdir -p ~/.ssh\n"+
|
||||
"cat >> ~/.ssh/authorized_keys <<-'END_OF_JCLOUDS_FILE'\n"+
|
||||
"\tssh-dss AAAAB\n"+
|
||||
"END_OF_JCLOUDS_FILE\n"+
|
||||
"mkdir -p ~/.ssh\n" +
|
||||
"cat >> ~/.ssh/authorized_keys <<-'END_OF_JCLOUDS_FILE'\n" +
|
||||
"\tssh-dss AAAAB\n" +
|
||||
"END_OF_JCLOUDS_FILE\n" +
|
||||
"chmod 600 ~/.ssh/authorized_keys\n");
|
||||
}
|
||||
|
||||
public void testAuthorizeRSAPublicKeyUNIXCurrentUserWith2Keys() {
|
||||
assertEquals(
|
||||
new AuthorizeRSAPublicKeys(ImmutableSet.of("ssh-dss AAAAB", "ssh-dss CCCCD")).render(OsFamily.UNIX),
|
||||
"mkdir -p ~/.ssh\n"+
|
||||
"cat >> ~/.ssh/authorized_keys <<-'END_OF_JCLOUDS_FILE'\n"+
|
||||
"\tssh-dss AAAAB\n"+
|
||||
"\t\n"+
|
||||
"\tssh-dss CCCCD\n"+
|
||||
"END_OF_JCLOUDS_FILE\n"+
|
||||
"mkdir -p ~/.ssh\n" +
|
||||
"cat >> ~/.ssh/authorized_keys <<-'END_OF_JCLOUDS_FILE'\n" +
|
||||
"\tssh-dss AAAAB\n" +
|
||||
"\t\n" +
|
||||
"\tssh-dss CCCCD\n" +
|
||||
"END_OF_JCLOUDS_FILE\n" +
|
||||
"chmod 600 ~/.ssh/authorized_keys\n");
|
||||
}
|
||||
|
||||
public void testAuthorizeRSAPublicKeyUNIXSpecifiedDir() {
|
||||
assertEquals(
|
||||
new AuthorizeRSAPublicKeys("/home/me/.ssh", ImmutableSet.of("ssh-dss AAAAB")).render(OsFamily.UNIX),
|
||||
"mkdir -p /home/me/.ssh\n"+
|
||||
"cat >> /home/me/.ssh/authorized_keys <<-'END_OF_JCLOUDS_FILE'\n"+
|
||||
"\tssh-dss AAAAB\n"+
|
||||
"END_OF_JCLOUDS_FILE\n"+
|
||||
"mkdir -p /home/me/.ssh\n" +
|
||||
"cat >> /home/me/.ssh/authorized_keys <<-'END_OF_JCLOUDS_FILE'\n" +
|
||||
"\tssh-dss AAAAB\n" +
|
||||
"END_OF_JCLOUDS_FILE\n" +
|
||||
"chmod 600 /home/me/.ssh/authorized_keys\n");
|
||||
}
|
||||
|
||||
|
@ -65,12 +65,12 @@ public class AuthorizeRSAPublicKeyTest {
|
|||
assertEquals(
|
||||
new AuthorizeRSAPublicKeys("/home/me/.ssh", ImmutableSet.of("ssh-dss AAAAB", "ssh-dss CCCCD"))
|
||||
.render(OsFamily.UNIX),
|
||||
"mkdir -p /home/me/.ssh\n"+
|
||||
"cat >> /home/me/.ssh/authorized_keys <<-'END_OF_JCLOUDS_FILE'\n"+
|
||||
"\tssh-dss AAAAB\n"+
|
||||
"\t\n"+
|
||||
"\tssh-dss CCCCD\n"+
|
||||
"END_OF_JCLOUDS_FILE\n"+
|
||||
"mkdir -p /home/me/.ssh\n" +
|
||||
"cat >> /home/me/.ssh/authorized_keys <<-'END_OF_JCLOUDS_FILE'\n" +
|
||||
"\tssh-dss AAAAB\n" +
|
||||
"\t\n" +
|
||||
"\tssh-dss CCCCD\n" +
|
||||
"END_OF_JCLOUDS_FILE\n" +
|
||||
"chmod 600 /home/me/.ssh/authorized_keys\n");
|
||||
}
|
||||
|
||||
|
|
|
@ -31,13 +31,13 @@ public class InstallRSAPrivateKeyTest {
|
|||
assertEquals(
|
||||
new InstallRSAPrivateKey("-----BEGIN RSA PRIVATE KEY-----\n-----END RSA PRIVATE KEY-----\n")
|
||||
.render(OsFamily.UNIX),
|
||||
"mkdir -p ~/.ssh\n"+
|
||||
"rm ~/.ssh/id_rsa\n"+
|
||||
"cat >> ~/.ssh/id_rsa <<-'END_OF_JCLOUDS_FILE'\n"+
|
||||
"\t-----BEGIN RSA PRIVATE KEY-----\n"+
|
||||
"\t-----END RSA PRIVATE KEY-----\n"+
|
||||
"\t\n"+
|
||||
"END_OF_JCLOUDS_FILE\n"+
|
||||
"mkdir -p ~/.ssh\n" +
|
||||
"rm ~/.ssh/id_rsa\n" +
|
||||
"cat >> ~/.ssh/id_rsa <<-'END_OF_JCLOUDS_FILE'\n" +
|
||||
"\t-----BEGIN RSA PRIVATE KEY-----\n" +
|
||||
"\t-----END RSA PRIVATE KEY-----\n" +
|
||||
"\t\n" +
|
||||
"END_OF_JCLOUDS_FILE\n" +
|
||||
"chmod 600 ~/.ssh/id_rsa\n");
|
||||
}
|
||||
|
||||
|
@ -45,13 +45,13 @@ public class InstallRSAPrivateKeyTest {
|
|||
assertEquals(
|
||||
new InstallRSAPrivateKey("/home/me/.ssh", "-----BEGIN RSA PRIVATE KEY-----\n-----END RSA PRIVATE KEY-----\n")
|
||||
.render(OsFamily.UNIX),
|
||||
"mkdir -p /home/me/.ssh\n"+
|
||||
"rm /home/me/.ssh/id_rsa\n"+
|
||||
"cat >> /home/me/.ssh/id_rsa <<-'END_OF_JCLOUDS_FILE'\n"+
|
||||
"\t-----BEGIN RSA PRIVATE KEY-----\n"+
|
||||
"\t-----END RSA PRIVATE KEY-----\n"+
|
||||
"\t\n"+
|
||||
"END_OF_JCLOUDS_FILE\n"+
|
||||
"mkdir -p /home/me/.ssh\n" +
|
||||
"rm /home/me/.ssh/id_rsa\n" +
|
||||
"cat >> /home/me/.ssh/id_rsa <<-'END_OF_JCLOUDS_FILE'\n" +
|
||||
"\t-----BEGIN RSA PRIVATE KEY-----\n" +
|
||||
"\t-----END RSA PRIVATE KEY-----\n" +
|
||||
"\t\n" +
|
||||
"END_OF_JCLOUDS_FILE\n" +
|
||||
"chmod 600 /home/me/.ssh/id_rsa\n"); }
|
||||
|
||||
@Test(expectedExceptions = UnsupportedOperationException.class)
|
||||
|
|
Loading…
Reference in New Issue