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