http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/cb70f325/packet/src/test/java/org/jclouds/packet/compute/internal/BasePacketApiLiveTest.java ---------------------------------------------------------------------- diff --git a/packet/src/test/java/org/jclouds/packet/compute/internal/BasePacketApiLiveTest.java b/packet/src/test/java/org/jclouds/packet/compute/internal/BasePacketApiLiveTest.java deleted file mode 100644 index aacf945..0000000 --- a/packet/src/test/java/org/jclouds/packet/compute/internal/BasePacketApiLiveTest.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.packet.compute.internal; - -import java.util.Properties; -import java.util.concurrent.TimeUnit; - -import org.jclouds.apis.BaseApiLiveTest; -import org.jclouds.compute.config.ComputeServiceProperties; -import org.jclouds.packet.PacketApi; - -import com.google.common.base.Predicate; -import com.google.inject.Injector; -import com.google.inject.Key; -import com.google.inject.Module; -import com.google.inject.TypeLiteral; -import com.google.inject.name.Names; - -import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_NODE_RUNNING; -import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_NODE_SUSPENDED; -import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_NODE_TERMINATED; -import static org.testng.Assert.assertTrue; - -public class BasePacketApiLiveTest extends BaseApiLiveTest<PacketApi> { - - private Predicate<String> deviceRunning; - private Predicate<String> deviceSuspended; - private Predicate<String> deviceTerminated; - - public BasePacketApiLiveTest() { - provider = "packet"; - } - - @Override - protected Properties setupProperties() { - Properties props = super.setupProperties(); - props.put(ComputeServiceProperties.POLL_INITIAL_PERIOD, 1000); - props.put(ComputeServiceProperties.POLL_MAX_PERIOD, 10000); - props.put(ComputeServiceProperties.TIMEOUT_IMAGE_AVAILABLE, TimeUnit.MINUTES.toMillis(45)); - return props; - } - - @Override - protected PacketApi create(Properties props, Iterable<Module> modules) { - Injector injector = newBuilder().modules(modules).overrides(props).buildInjector(); - deviceRunning = injector.getInstance(Key.get(new TypeLiteral<Predicate<String>>(){}, - Names.named(TIMEOUT_NODE_RUNNING))); - deviceSuspended = injector.getInstance(Key.get(new TypeLiteral<Predicate<String>>(){}, - Names.named(TIMEOUT_NODE_SUSPENDED))); - deviceTerminated = injector.getInstance(Key.get(new TypeLiteral<Predicate<String>>(){}, - Names.named(TIMEOUT_NODE_TERMINATED))); - return injector.getInstance(PacketApi.class); - } - - protected void assertNodeRunning(String deviceId) { - assertTrue(deviceRunning.apply(deviceId), String.format("Device %s did not start in the configured timeout", deviceId)); - } - - protected void assertNodeSuspended(String deviceId) { - assertTrue(deviceSuspended.apply(deviceId), String.format("Device %s was not suspended in the configured timeout", deviceId)); - } - - protected void assertNodeTerminated(String deviceId) { - assertTrue(deviceTerminated.apply(deviceId), String.format("Device %s was not terminated in the configured timeout", deviceId)); - } - -}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/cb70f325/packet/src/test/java/org/jclouds/packet/compute/internal/BasePacketApiMockTest.java ---------------------------------------------------------------------- diff --git a/packet/src/test/java/org/jclouds/packet/compute/internal/BasePacketApiMockTest.java b/packet/src/test/java/org/jclouds/packet/compute/internal/BasePacketApiMockTest.java deleted file mode 100644 index 9fe3d6f..0000000 --- a/packet/src/test/java/org/jclouds/packet/compute/internal/BasePacketApiMockTest.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.packet.compute.internal; - -import java.io.IOException; -import java.util.Map; -import java.util.Properties; -import java.util.Set; - -import org.jclouds.ContextBuilder; -import org.jclouds.concurrent.config.ExecutorServiceModule; -import org.jclouds.json.Json; -import org.jclouds.packet.PacketApi; -import org.jclouds.packet.PacketProviderMetadata; -import org.jclouds.rest.ApiContext; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeMethod; - -import com.google.common.base.Charsets; -import com.google.common.base.Throwables; -import com.google.common.collect.ImmutableSet; -import com.google.common.io.Resources; -import com.google.common.reflect.TypeToken; -import com.google.gson.JsonParser; -import com.google.inject.Module; -import com.squareup.okhttp.mockwebserver.MockResponse; -import com.squareup.okhttp.mockwebserver.MockWebServer; -import com.squareup.okhttp.mockwebserver.RecordedRequest; - -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.collect.Iterables.getOnlyElement; -import static com.google.common.util.concurrent.MoreExecutors.sameThreadExecutor; -import static org.jclouds.Constants.PROPERTY_MAX_RETRIES; -import static org.testng.Assert.assertEquals; - -public class BasePacketApiMockTest { - - private static final String X_AUTHORIZATION_TOKEN = "c5401990f0c24135e8d6b5d260603fc71696d4738da9aa04a720229a01a2521d"; - private static final String DEFAULT_ENDPOINT = new PacketProviderMetadata().getEndpoint(); - - private final Set<Module> modules = ImmutableSet.<Module> of(new ExecutorServiceModule(sameThreadExecutor())); - - protected MockWebServer server; - protected PacketApi api; - private Json json; - private ApiContext<PacketApi> ctx; - - // So that we can ignore formatting. - private final JsonParser parser = new JsonParser(); - - @BeforeMethod - public void start() throws IOException { - server = new MockWebServer(); - server.play(); - ctx = ContextBuilder.newBuilder("packet") - .credentials("", X_AUTHORIZATION_TOKEN) - .endpoint(url("")) - .modules(modules) - .overrides(overrides()) - .build(); - json = ctx.utils().injector().getInstance(Json.class); - api = ctx.getApi(); - } - - @AfterMethod(alwaysRun = true) - public void stop() throws IOException { - server.shutdown(); - api.close(); - } - - protected Properties overrides() { - Properties properties = new Properties(); - properties.put(PROPERTY_MAX_RETRIES, "0"); // Do not retry - return properties; - } - - protected String url(String path) { - return server.getUrl(path).toString(); - } - - protected MockResponse jsonResponse(String resource) { - return new MockResponse().addHeader("Content-Type", "application/json").setBody(stringFromResource(resource)); - } - - protected MockResponse response404() { - return new MockResponse().setStatus("HTTP/1.1 404 Not Found"); - } - - protected MockResponse response204() { - return new MockResponse().setStatus("HTTP/1.1 204 No Content"); - } - - protected String stringFromResource(String resourceName) { - try { - return Resources.toString(getClass().getResource(resourceName), Charsets.UTF_8) - .replace(DEFAULT_ENDPOINT, url("")); - } catch (IOException e) { - throw Throwables.propagate(e); - } - } - - protected <T> T onlyObjectFromResource(String resourceName, TypeToken<Map<String, T>> type) { - // Assume JSON objects passed here will be in the form: { "entity": { ... } } - String text = stringFromResource(resourceName); - Map<String, T> object = json.fromJson(text, type.getType()); - checkArgument(!object.isEmpty(), "The given json does not contain any object: %s", text); - checkArgument(object.keySet().size() == 1, "The given json does not contain more than one object: %s", text); - return object.get(getOnlyElement(object.keySet())); - } - - protected <T> T objectFromResource(String resourceName, Class<T> type) { - String text = stringFromResource(resourceName); - return json.fromJson(text, type); - } - - protected RecordedRequest assertSent(MockWebServer server, String method, String path) throws InterruptedException { - RecordedRequest request = server.takeRequest(); - assertEquals(request.getMethod(), method); - assertEquals(request.getPath(), path); - assertEquals(request.getHeader("Accept"), "application/json; version=" + ctx.getMetadata().get("apiVersion")); - assertEquals(request.getHeader("X-Auth-Token"), X_AUTHORIZATION_TOKEN); - return request; - } - - protected RecordedRequest assertSent(MockWebServer server, String method, String path, String json) - throws InterruptedException { - RecordedRequest request = assertSent(server, method, path); - assertEquals(request.getHeader("Content-Type"), "application/json"); - assertEquals(parser.parse(new String(request.getBody(), Charsets.UTF_8)), parser.parse(json)); - return request; - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/cb70f325/packet/src/test/java/org/jclouds/packet/features/DeviceApiLiveTest.java ---------------------------------------------------------------------- diff --git a/packet/src/test/java/org/jclouds/packet/features/DeviceApiLiveTest.java b/packet/src/test/java/org/jclouds/packet/features/DeviceApiLiveTest.java deleted file mode 100644 index cc96ebd..0000000 --- a/packet/src/test/java/org/jclouds/packet/features/DeviceApiLiveTest.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.packet.features; - -import java.util.Map; -import java.util.concurrent.atomic.AtomicInteger; - -import org.jclouds.packet.compute.internal.BasePacketApiLiveTest; -import org.jclouds.packet.domain.BillingCycle; -import org.jclouds.packet.domain.Device; -import org.jclouds.packet.domain.SshKey; -import org.jclouds.ssh.SshKeys; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import com.google.common.base.Predicate; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Iterables; - -import static org.jclouds.packet.domain.options.ListOptions.Builder.page; -import static org.testng.Assert.assertNotNull; -import static org.testng.Assert.assertNull; -import static org.testng.Assert.assertTrue; -import static org.testng.util.Strings.isNullOrEmpty; - -@Test(groups = "live", singleThreaded = true, testName = "DeviceApiLiveTest") -public class DeviceApiLiveTest extends BasePacketApiLiveTest { - - private SshKey sshKey; - private String deviceId; - - @BeforeClass - public void setupDevice() { - Map<String, String> keyPair = SshKeys.generate(); - sshKey = api.sshKeyApi().create(prefix + "-device-livetest", keyPair.get("public")); - } - - @AfterClass(alwaysRun = true) - public void tearDown() { - if (sshKey != null) { - api.sshKeyApi().delete(sshKey.id()); - } - } - - public void testCreate() { - Device deviceCreated = api().create( - Device.CreateDevice.builder() - .hostname(prefix + "-device-livetest") - .plan("baremetal_0") - .billingCycle(BillingCycle.HOURLY.value()) - .facility("ewr1") - .features(ImmutableMap.<String, String>of()) - .operatingSystem("ubuntu_16_04") - .locked(false) - .userdata("") - .tags(ImmutableSet.<String> of()) - .build() - ); - deviceId = deviceCreated.id(); - assertNodeRunning(deviceId); - Device device = api().get(deviceId); - assertNotNull(device, "Device must not be null"); - } - - @Test(groups = "live", dependsOnMethods = "testCreate") - public void testReboot() { - api().reboot(deviceId); - assertNodeRunning(deviceId); - } - - @Test(groups = "live", dependsOnMethods = "testReboot") - public void testPowerOff() { - api().powerOff(deviceId); - assertNodeSuspended(deviceId); - } - - @Test(groups = "live", dependsOnMethods = "testPowerOff") - public void testPowerOn() { - api().powerOn(deviceId); - assertNodeRunning(deviceId); - } - - @Test(dependsOnMethods = "testCreate") - public void testList() { - final AtomicInteger found = new AtomicInteger(0); - assertTrue(Iterables.all(api().list().concat(), new Predicate<Device>() { - @Override - public boolean apply(Device input) { - found.incrementAndGet(); - return !isNullOrEmpty(input.id()); - } - }), "All devices must have the 'id' field populated"); - assertTrue(found.get() > 0, "Expected some devices to be returned"); - } - - @Test(dependsOnMethods = "testCreate") - public void testListOnePage() { - final AtomicInteger found = new AtomicInteger(0); - assertTrue(api().list(page(1).perPage(5)).allMatch(new Predicate<Device>() { - @Override - public boolean apply(Device input) { - found.incrementAndGet(); - return !isNullOrEmpty(input.id()); - } - }), "All devices must have the 'id' field populated"); - assertTrue(found.get() > 0, "Expected some devices to be returned"); - } - - @Test(dependsOnMethods = "testPowerOn", alwaysRun = true) - public void testDelete() throws InterruptedException { - if (deviceId != null) { - api().delete(deviceId); - assertNodeTerminated(deviceId); - assertNull(api().get(deviceId)); - } - } - - private DeviceApi api() { - return api.deviceApi(identity); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/cb70f325/packet/src/test/java/org/jclouds/packet/features/DeviceApiMockTest.java ---------------------------------------------------------------------- diff --git a/packet/src/test/java/org/jclouds/packet/features/DeviceApiMockTest.java b/packet/src/test/java/org/jclouds/packet/features/DeviceApiMockTest.java deleted file mode 100644 index f53c206..0000000 --- a/packet/src/test/java/org/jclouds/packet/features/DeviceApiMockTest.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.packet.features; - -import org.jclouds.packet.compute.internal.BasePacketApiMockTest; -import org.jclouds.packet.domain.BillingCycle; -import org.jclouds.packet.domain.Device; -import org.jclouds.packet.domain.Device.CreateDevice; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; - -import static com.google.common.collect.Iterables.isEmpty; -import static com.google.common.collect.Iterables.size; -import static org.jclouds.packet.domain.options.ListOptions.Builder.page; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertNull; -import static org.testng.Assert.assertTrue; - -@Test(groups = "unit", testName = "DeviceApiMockTest", singleThreaded = true) -public class DeviceApiMockTest extends BasePacketApiMockTest { - - public void testListDevices() throws InterruptedException { - server.enqueue(jsonResponse("/devices-first.json")); - server.enqueue(jsonResponse("/devices-last.json")); - - Iterable<Device> devices = api.deviceApi("93907f48-adfe-43ed-ad89-0e6e83721a54").list().concat(); - - assertEquals(size(devices), 7); // Force the PagedIterable to advance - assertEquals(server.getRequestCount(), 2); - - assertSent(server, "GET", "/projects/93907f48-adfe-43ed-ad89-0e6e83721a54/devices"); - assertSent(server, "GET", "/projects/93907f48-adfe-43ed-ad89-0e6e83721a54/devices?page=2"); - } - - public void testListDevicesReturns404() throws InterruptedException { - server.enqueue(response404()); - - Iterable<Device> devices = api.deviceApi("93907f48-adfe-43ed-ad89-0e6e83721a54").list().concat(); - - assertTrue(isEmpty(devices)); - - assertEquals(server.getRequestCount(), 1); - assertSent(server, "GET", "/projects/93907f48-adfe-43ed-ad89-0e6e83721a54/devices"); - } - - public void testListDevicesWithOptions() throws InterruptedException { - server.enqueue(jsonResponse("/devices-first.json")); - - Iterable<Device> devices = api.deviceApi("93907f48-adfe-43ed-ad89-0e6e83721a54").list(page(1).perPage(5)); - - assertEquals(size(devices), 5); - assertEquals(server.getRequestCount(), 1); - - assertSent(server, "GET", "/projects/93907f48-adfe-43ed-ad89-0e6e83721a54/devices?page=1&per_page=5"); - } - - public void testListDevicesWithOptionsReturns404() throws InterruptedException { - server.enqueue(response404()); - - Iterable<Device> actions = api.deviceApi("93907f48-adfe-43ed-ad89-0e6e83721a54").list(page(1).perPage(5)); - - assertTrue(isEmpty(actions)); - - assertEquals(server.getRequestCount(), 1); - assertSent(server, "GET", "/projects/93907f48-adfe-43ed-ad89-0e6e83721a54/devices?page=1&per_page=5"); - } - - public void testGetDevice() throws InterruptedException { - server.enqueue(jsonResponse("/device.json")); - - Device device = api.deviceApi("93907f48-adfe-43ed-ad89-0e6e83721a54").get("1"); - - assertEquals(device, objectFromResource("/device.json", Device.class)); - - assertEquals(server.getRequestCount(), 1); - assertSent(server, "GET", "/devices/1"); - } - - public void testGetDeviceReturns404() throws InterruptedException { - server.enqueue(response404()); - - Device device = api.deviceApi("93907f48-adfe-43ed-ad89-0e6e83721a54").get("1"); - - assertNull(device); - - assertEquals(server.getRequestCount(), 1); - assertSent(server, "GET", "/devices/1"); - } - - public void testCreateDevice() throws InterruptedException { - server.enqueue(jsonResponse("/device-create-res.json")); - - Device device = api.deviceApi("93907f48-adfe-43ed-ad89-0e6e83721a54").create( - CreateDevice.builder() - .hostname("jclouds-device-livetest") - .plan("baremetal_0") - .billingCycle(BillingCycle.HOURLY.value()) - .facility("ewr1") - .features(ImmutableMap.<String, String>of()) - .operatingSystem("ubuntu_16_04") - .locked(false) - .userdata("") - .tags(ImmutableSet.<String> of()) - .build() - ); - - assertEquals(device, objectFromResource("/device-create-res.json", Device.class)); - - assertEquals(server.getRequestCount(), 1); - assertSent(server, "POST", "/projects/93907f48-adfe-43ed-ad89-0e6e83721a54/devices", stringFromResource("/device-create-req.json")); - } - - public void testDeleteDevice() throws InterruptedException { - server.enqueue(response204()); - - api.deviceApi("93907f48-adfe-43ed-ad89-0e6e83721a54").delete("1"); - - assertEquals(server.getRequestCount(), 1); - assertSent(server, "DELETE", "/devices/1"); - } - - public void testDeleteDeviceReturns404() throws InterruptedException { - server.enqueue(response404()); - - api.deviceApi("93907f48-adfe-43ed-ad89-0e6e83721a54").delete("1"); - - assertEquals(server.getRequestCount(), 1); - assertSent(server, "DELETE", "/devices/1"); - } - - public void testActionPowerOn() throws InterruptedException { - server.enqueue(jsonResponse("/power-on.json")); - - api.deviceApi("93907f48-adfe-43ed-ad89-0e6e83721a54").powerOn("deviceId"); - - assertEquals(server.getRequestCount(), 1); - assertSent(server, "POST", "/devices/deviceId/actions"); - } - - public void testActionPowerOff() throws InterruptedException { - server.enqueue(jsonResponse("/power-off.json")); - - api.deviceApi("93907f48-adfe-43ed-ad89-0e6e83721a54").powerOff("deviceId"); - - assertEquals(server.getRequestCount(), 1); - assertSent(server, "POST", "/devices/deviceId/actions"); - } - - public void testActionReboot() throws InterruptedException { - server.enqueue(jsonResponse("/reboot.json")); - - api.deviceApi("93907f48-adfe-43ed-ad89-0e6e83721a54").reboot("deviceId"); - - assertEquals(server.getRequestCount(), 1); - assertSent(server, "POST", "/devices/deviceId/actions"); - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/cb70f325/packet/src/test/java/org/jclouds/packet/features/FacilityApiLiveTest.java ---------------------------------------------------------------------- diff --git a/packet/src/test/java/org/jclouds/packet/features/FacilityApiLiveTest.java b/packet/src/test/java/org/jclouds/packet/features/FacilityApiLiveTest.java deleted file mode 100644 index 0ee90da..0000000 --- a/packet/src/test/java/org/jclouds/packet/features/FacilityApiLiveTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.packet.features; - -import java.util.concurrent.atomic.AtomicInteger; - -import org.jclouds.packet.compute.internal.BasePacketApiLiveTest; -import org.jclouds.packet.domain.Facility; -import org.testng.annotations.Test; - -import com.google.common.base.Predicate; -import com.google.common.collect.Iterables; - -import static org.jclouds.packet.domain.options.ListOptions.Builder.page; -import static org.testng.Assert.assertTrue; -import static org.testng.util.Strings.isNullOrEmpty; - -@Test(groups = "live", testName = "FacilityApiLiveTest") -public class FacilityApiLiveTest extends BasePacketApiLiveTest { - - public void testList() { - final AtomicInteger found = new AtomicInteger(0); - assertTrue(Iterables.all(api().list().concat(), new Predicate<Facility>() { - @Override - public boolean apply(Facility input) { - found.incrementAndGet(); - return !isNullOrEmpty(input.id()); - } - }), "All facilities must have the 'id' field populated"); - assertTrue(found.get() > 0, "Expected some facilities to be returned"); - } - - public void testListOnePage() { - final AtomicInteger found = new AtomicInteger(0); - assertTrue(api().list(page(1).perPage(5)).allMatch(new Predicate<Facility>() { - @Override - public boolean apply(Facility input) { - found.incrementAndGet(); - return !isNullOrEmpty(input.id()); - } - }), "All facilities must have the 'id' field populated"); - assertTrue(found.get() > 0, "Expected some facilities to be returned"); - } - - private FacilityApi api() { - return api.facilityApi(); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/cb70f325/packet/src/test/java/org/jclouds/packet/features/FacilityApiMockTest.java ---------------------------------------------------------------------- diff --git a/packet/src/test/java/org/jclouds/packet/features/FacilityApiMockTest.java b/packet/src/test/java/org/jclouds/packet/features/FacilityApiMockTest.java deleted file mode 100644 index 764fa7b..0000000 --- a/packet/src/test/java/org/jclouds/packet/features/FacilityApiMockTest.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.packet.features; - -import org.jclouds.packet.compute.internal.BasePacketApiMockTest; -import org.jclouds.packet.domain.Facility; -import org.testng.annotations.Test; - -import static com.google.common.collect.Iterables.isEmpty; -import static com.google.common.collect.Iterables.size; -import static org.jclouds.packet.domain.options.ListOptions.Builder.page; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; - -@Test(groups = "unit", testName = "FacilityApiMockTest", singleThreaded = true) -public class FacilityApiMockTest extends BasePacketApiMockTest { - - public void testListFacilities() throws InterruptedException { - server.enqueue(jsonResponse("/facilities-first.json")); - server.enqueue(jsonResponse("/facilities-last.json")); - - Iterable<Facility> facilities = api.facilityApi().list().concat(); - - assertEquals(size(facilities), 3); // Force the PagedIterable to advance - assertEquals(server.getRequestCount(), 2); - - assertSent(server, "GET", "/facilities"); - assertSent(server, "GET", "/facilities?page=2"); - } - - public void testListFacilitiesReturns404() throws InterruptedException { - server.enqueue(response404()); - - Iterable<Facility> facilities = api.facilityApi().list().concat(); - - assertTrue(isEmpty(facilities)); - - assertEquals(server.getRequestCount(), 1); - assertSent(server, "GET", "/facilities"); - } - - public void testListFacilitiesWithOptions() throws InterruptedException { - server.enqueue(jsonResponse("/facilities-first.json")); - - Iterable<Facility> actions = api.facilityApi().list(page(1).perPage(2)); - - assertEquals(size(actions), 2); - assertEquals(server.getRequestCount(), 1); - - assertSent(server, "GET", "/facilities?page=1&per_page=2"); - } - - public void testListFacilitiesWithOptionsReturns404() throws InterruptedException { - server.enqueue(response404()); - - Iterable<Facility> actions = api.facilityApi().list(page(1).perPage(2)); - - assertTrue(isEmpty(actions)); - - assertEquals(server.getRequestCount(), 1); - assertSent(server, "GET", "/facilities?page=1&per_page=2"); - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/cb70f325/packet/src/test/java/org/jclouds/packet/features/OperatingSystemApiLiveTest.java ---------------------------------------------------------------------- diff --git a/packet/src/test/java/org/jclouds/packet/features/OperatingSystemApiLiveTest.java b/packet/src/test/java/org/jclouds/packet/features/OperatingSystemApiLiveTest.java deleted file mode 100644 index fd96a7e..0000000 --- a/packet/src/test/java/org/jclouds/packet/features/OperatingSystemApiLiveTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.packet.features; - -import java.util.concurrent.atomic.AtomicInteger; - -import org.jclouds.packet.compute.internal.BasePacketApiLiveTest; -import org.jclouds.packet.domain.OperatingSystem; -import org.testng.annotations.Test; - -import com.google.common.base.Predicate; -import com.google.common.collect.Iterables; - -import static org.jclouds.packet.domain.options.ListOptions.Builder.page; -import static org.testng.Assert.assertTrue; -import static org.testng.util.Strings.isNullOrEmpty; - -@Test(groups = "live", testName = "OperatingSystemApiLiveTest") -public class OperatingSystemApiLiveTest extends BasePacketApiLiveTest { - - public void testList() { - final AtomicInteger found = new AtomicInteger(0); - assertTrue(Iterables.all(api().list().concat(), new Predicate<OperatingSystem>() { - @Override - public boolean apply(OperatingSystem input) { - found.incrementAndGet(); - return !isNullOrEmpty(input.id()); - } - }), "All operating systems must have the 'id' field populated"); - assertTrue(found.get() > 0, "Expected some operating systems to be returned"); - } - - public void testListOnePage() { - final AtomicInteger found = new AtomicInteger(0); - assertTrue(api().list(page(1).perPage(5)).allMatch(new Predicate<OperatingSystem>() { - @Override - public boolean apply(OperatingSystem input) { - found.incrementAndGet(); - return !isNullOrEmpty(input.id()); - } - }), "All operating systems must have the 'id' field populated"); - assertTrue(found.get() > 0, "Expected some operating systems to be returned"); - } - - private OperatingSystemApi api() { - return api.operatingSystemApi(); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/cb70f325/packet/src/test/java/org/jclouds/packet/features/OperatingSystemApiMockTest.java ---------------------------------------------------------------------- diff --git a/packet/src/test/java/org/jclouds/packet/features/OperatingSystemApiMockTest.java b/packet/src/test/java/org/jclouds/packet/features/OperatingSystemApiMockTest.java deleted file mode 100644 index c0c332b..0000000 --- a/packet/src/test/java/org/jclouds/packet/features/OperatingSystemApiMockTest.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.packet.features; - -import org.jclouds.packet.compute.internal.BasePacketApiMockTest; -import org.jclouds.packet.domain.OperatingSystem; -import org.testng.annotations.Test; - -import static com.google.common.collect.Iterables.isEmpty; -import static com.google.common.collect.Iterables.size; -import static org.jclouds.packet.domain.options.ListOptions.Builder.page; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; - -@Test(groups = "unit", testName = "OperatingSystemApiMockTest", singleThreaded = true) -public class OperatingSystemApiMockTest extends BasePacketApiMockTest { - - public void testListOperatingSystems() throws InterruptedException { - - server.enqueue(jsonResponse("/operatingSystems-first.json")); - server.enqueue(jsonResponse("/operatingSystems-last.json")); - - Iterable<OperatingSystem> operatingSystems = api.operatingSystemApi().list().concat(); - assertEquals(size(operatingSystems), 14); // Force the PagedIterable to advance - assertEquals(server.getRequestCount(), 2); - - assertSent(server, "GET", "/operating-systems"); - assertSent(server, "GET", "/operating-systems?page=2"); - } - - public void testListOperatingSystemsReturns404() throws InterruptedException { - server.enqueue(response404()); - - Iterable<OperatingSystem> operatingSystems = api.operatingSystemApi().list().concat(); - - assertTrue(isEmpty(operatingSystems)); - - assertEquals(server.getRequestCount(), 1); - assertSent(server, "GET", "/operating-systems"); - } - - public void testListOperatingSystemsWithOptions() throws InterruptedException { - server.enqueue(jsonResponse("/operatingSystems-first.json")); - - Iterable<OperatingSystem> operatingSystems = api.operatingSystemApi().list(page(1).perPage(5)); - - assertEquals(size(operatingSystems), 7); - assertEquals(server.getRequestCount(), 1); - - assertSent(server, "GET", "/operating-systems?page=1&per_page=5"); - } - - public void testListOperatingSystemsWithOptionsReturns404() throws InterruptedException { - server.enqueue(response404()); - - Iterable<OperatingSystem> operatingSystems = api.operatingSystemApi().list(page(1).perPage(5)); - - assertTrue(isEmpty(operatingSystems)); - - assertEquals(server.getRequestCount(), 1); - assertSent(server, "GET", "/operating-systems?page=1&per_page=5"); - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/cb70f325/packet/src/test/java/org/jclouds/packet/features/PlanApiLiveTest.java ---------------------------------------------------------------------- diff --git a/packet/src/test/java/org/jclouds/packet/features/PlanApiLiveTest.java b/packet/src/test/java/org/jclouds/packet/features/PlanApiLiveTest.java deleted file mode 100644 index 1b66e04..0000000 --- a/packet/src/test/java/org/jclouds/packet/features/PlanApiLiveTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.packet.features; - -import java.util.concurrent.atomic.AtomicInteger; - -import org.jclouds.packet.compute.internal.BasePacketApiLiveTest; -import org.jclouds.packet.domain.Plan; -import org.testng.annotations.Test; - -import com.google.common.base.Predicate; -import com.google.common.collect.Iterables; - -import static org.jclouds.packet.domain.options.ListOptions.Builder.page; -import static org.testng.Assert.assertTrue; -import static org.testng.util.Strings.isNullOrEmpty; - -@Test(groups = "live", testName = "PlanApiLiveTest") -public class PlanApiLiveTest extends BasePacketApiLiveTest { - - public void testList() { - final AtomicInteger found = new AtomicInteger(0); - assertTrue(Iterables.all(api().list().concat(), new Predicate<Plan>() { - @Override - public boolean apply(Plan input) { - found.incrementAndGet(); - return !isNullOrEmpty(input.id()); - } - }), "All plans must have the 'id' field populated"); - assertTrue(found.get() > 0, "Expected some plans to be returned"); - } - - public void testListOnePage() { - final AtomicInteger found = new AtomicInteger(0); - assertTrue(api().list(page(1).perPage(5)).allMatch(new Predicate<Plan>() { - @Override - public boolean apply(Plan input) { - found.incrementAndGet(); - return !isNullOrEmpty(input.id()); - } - }), "All plans must have the 'id' field populated"); - assertTrue(found.get() > 0, "Expected some plans to be returned"); - } - - private PlanApi api() { - return api.planApi(); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/cb70f325/packet/src/test/java/org/jclouds/packet/features/PlanApiMockTest.java ---------------------------------------------------------------------- diff --git a/packet/src/test/java/org/jclouds/packet/features/PlanApiMockTest.java b/packet/src/test/java/org/jclouds/packet/features/PlanApiMockTest.java deleted file mode 100644 index 82683c8..0000000 --- a/packet/src/test/java/org/jclouds/packet/features/PlanApiMockTest.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.packet.features; - -import org.jclouds.packet.compute.internal.BasePacketApiMockTest; -import org.jclouds.packet.domain.Plan; -import org.testng.annotations.Test; - -import static com.google.common.collect.Iterables.isEmpty; -import static com.google.common.collect.Iterables.size; -import static org.jclouds.packet.domain.options.ListOptions.Builder.page; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; - -@Test(groups = "unit", testName = "PlanApiMockTest", singleThreaded = true) -public class PlanApiMockTest extends BasePacketApiMockTest { - - public void testListPlans() throws InterruptedException { - server.enqueue(jsonResponse("/plans-first.json")); - server.enqueue(jsonResponse("/plans-last.json")); - - Iterable<Plan> plans = api.planApi().list().concat(); - - assertEquals(size(plans), 7); // Force the PagedIterable to advance - assertEquals(server.getRequestCount(), 2); - - assertSent(server, "GET", "/plans"); - assertSent(server, "GET", "/plans?page=2"); - } - - public void testListPlansReturns404() throws InterruptedException { - server.enqueue(response404()); - - Iterable<Plan> plans = api.planApi().list().concat(); - - assertTrue(isEmpty(plans)); - - assertEquals(server.getRequestCount(), 1); - assertSent(server, "GET", "/plans"); - } - - public void testListPlansWithOptions() throws InterruptedException { - server.enqueue(jsonResponse("/plans-first.json")); - - Iterable<Plan> plans = api.planApi().list(page(1).perPage(5)); - - assertEquals(size(plans), 4); - assertEquals(server.getRequestCount(), 1); - - assertSent(server, "GET", "/plans?page=1&per_page=5"); - } - - public void testListPlansWithOptionsReturns404() throws InterruptedException { - server.enqueue(response404()); - - Iterable<Plan> plans = api.planApi().list(page(1).perPage(5)); - - assertTrue(isEmpty(plans)); - - assertEquals(server.getRequestCount(), 1); - assertSent(server, "GET", "/plans?page=1&per_page=5"); - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/cb70f325/packet/src/test/java/org/jclouds/packet/features/ProjectApiLiveTest.java ---------------------------------------------------------------------- diff --git a/packet/src/test/java/org/jclouds/packet/features/ProjectApiLiveTest.java b/packet/src/test/java/org/jclouds/packet/features/ProjectApiLiveTest.java deleted file mode 100644 index 65fba8f..0000000 --- a/packet/src/test/java/org/jclouds/packet/features/ProjectApiLiveTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.packet.features; - -import java.util.concurrent.atomic.AtomicInteger; - -import org.jclouds.packet.compute.internal.BasePacketApiLiveTest; -import org.jclouds.packet.domain.Project; -import org.testng.annotations.Test; - -import com.google.common.base.Predicate; -import com.google.common.collect.Iterables; - -import static org.jclouds.packet.domain.options.ListOptions.Builder.page; -import static org.testng.Assert.assertTrue; -import static org.testng.util.Strings.isNullOrEmpty; - -@Test(groups = "live", testName = "ProjectApiLiveTest") -public class ProjectApiLiveTest extends BasePacketApiLiveTest { - - public void testList() { - final AtomicInteger found = new AtomicInteger(0); - assertTrue(Iterables.all(api().list().concat(), new Predicate<Project>() { - @Override - public boolean apply(Project input) { - found.incrementAndGet(); - return !isNullOrEmpty(input.id()); - } - }), "All projects must have the 'id' field populated"); - assertTrue(found.get() > 0, "Expected some projects to be returned"); - } - - public void testListOnePage() { - final AtomicInteger found = new AtomicInteger(0); - assertTrue(api().list(page(1).perPage(5)).allMatch(new Predicate<Project>() { - @Override - public boolean apply(Project input) { - found.incrementAndGet(); - return !isNullOrEmpty(input.id()); - } - }), "All projects must have the 'id' field populated"); - assertTrue(found.get() > 0, "Expected some projects to be returned"); - } - - private ProjectApi api() { - return api.projectApi(); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/cb70f325/packet/src/test/java/org/jclouds/packet/features/ProjectApiMockTest.java ---------------------------------------------------------------------- diff --git a/packet/src/test/java/org/jclouds/packet/features/ProjectApiMockTest.java b/packet/src/test/java/org/jclouds/packet/features/ProjectApiMockTest.java deleted file mode 100644 index d972395..0000000 --- a/packet/src/test/java/org/jclouds/packet/features/ProjectApiMockTest.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.packet.features; - -import org.jclouds.packet.compute.internal.BasePacketApiMockTest; -import org.jclouds.packet.domain.Project; -import org.testng.annotations.Test; - -import static com.google.common.collect.Iterables.isEmpty; -import static com.google.common.collect.Iterables.size; -import static org.jclouds.packet.domain.options.ListOptions.Builder.page; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; - -@Test(groups = "unit", testName = "ProjectApiMockTest", singleThreaded = true) -public class ProjectApiMockTest extends BasePacketApiMockTest { - - public void testListProjects() throws InterruptedException { - server.enqueue(jsonResponse("/projects-first.json")); - server.enqueue(jsonResponse("/projects-last.json")); - - Iterable<Project> projects = api.projectApi().list().concat(); - - assertEquals(size(projects), 8); // Force the PagedIterable to advance - assertEquals(server.getRequestCount(), 2); - - assertSent(server, "GET", "/projects"); - assertSent(server, "GET", "/projects?page=2"); - } - - public void testListProjectsReturns404() throws InterruptedException { - server.enqueue(response404()); - - Iterable<Project> projects = api.projectApi().list().concat(); - - assertTrue(isEmpty(projects)); - - assertEquals(server.getRequestCount(), 1); - assertSent(server, "GET", "/projects"); - } - - public void testListProjectsWithOptions() throws InterruptedException { - server.enqueue(jsonResponse("/projects-first.json")); - - Iterable<Project> actions = api.projectApi().list(page(1).perPage(5)); - - assertEquals(size(actions), 5); - assertEquals(server.getRequestCount(), 1); - - assertSent(server, "GET", "/projects?page=1&per_page=5"); - } - - public void testListProjectsWithOptionsReturns404() throws InterruptedException { - server.enqueue(response404()); - - Iterable<Project> actions = api.projectApi().list(page(1).perPage(5)); - - assertTrue(isEmpty(actions)); - - assertEquals(server.getRequestCount(), 1); - assertSent(server, "GET", "/projects?page=1&per_page=5"); - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/cb70f325/packet/src/test/java/org/jclouds/packet/features/SshKeyApiLiveTest.java ---------------------------------------------------------------------- diff --git a/packet/src/test/java/org/jclouds/packet/features/SshKeyApiLiveTest.java b/packet/src/test/java/org/jclouds/packet/features/SshKeyApiLiveTest.java deleted file mode 100644 index 3ef4387..0000000 --- a/packet/src/test/java/org/jclouds/packet/features/SshKeyApiLiveTest.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.packet.features; - -import java.util.Map; -import java.util.concurrent.atomic.AtomicInteger; - -import org.jclouds.packet.compute.internal.BasePacketApiLiveTest; -import org.jclouds.packet.domain.SshKey; -import org.jclouds.ssh.SshKeys; -import org.testng.annotations.Test; - -import com.google.common.base.Predicate; -import com.google.common.collect.Iterables; - -import static org.jclouds.packet.domain.options.ListOptions.Builder.page; -import static org.testng.Assert.assertTrue; -import static org.testng.util.Strings.isNullOrEmpty; - -@Test(groups = "live", testName = "SshKeyApiLiveTest") -public class SshKeyApiLiveTest extends BasePacketApiLiveTest { - - private SshKey sshKey; - - public void testCreate() { - Map<String, String> keyPair = SshKeys.generate(); - sshKey = api.sshKeyApi().create(prefix + "-sshkey-livetest", keyPair.get("public")); - } - - @Test(dependsOnMethods = "testCreate") - public void testGet() { - api.sshKeyApi().get(sshKey.id()); - } - - @Test(dependsOnMethods = "testCreate") - public void testList() { - final AtomicInteger found = new AtomicInteger(0); - assertTrue(Iterables.all(api().list().concat(), new Predicate<SshKey>() { - @Override - public boolean apply(SshKey input) { - found.incrementAndGet(); - return !isNullOrEmpty(input.id()); - } - }), "All ssh keys must have the 'id' field populated"); - assertTrue(found.get() > 0, "Expected some ssh keys to be returned"); - } - - @Test(dependsOnMethods = "testCreate") - public void testListOnePage() { - final AtomicInteger found = new AtomicInteger(0); - assertTrue(api().list(page(1).perPage(5)).allMatch(new Predicate<SshKey>() { - @Override - public boolean apply(SshKey input) { - found.incrementAndGet(); - return !isNullOrEmpty(input.id()); - } - }), "All ssh keys must have the 'id' field populated"); - assertTrue(found.get() > 0, "Expected some ssh keys to be returned"); - } - - @Test(dependsOnMethods = "testList", alwaysRun = true) - public void testDelete() throws InterruptedException { - api.sshKeyApi().delete(sshKey.id()); - } - - private SshKeyApi api() { - return api.sshKeyApi(); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/cb70f325/packet/src/test/java/org/jclouds/packet/features/SshKeyApiMockTest.java ---------------------------------------------------------------------- diff --git a/packet/src/test/java/org/jclouds/packet/features/SshKeyApiMockTest.java b/packet/src/test/java/org/jclouds/packet/features/SshKeyApiMockTest.java deleted file mode 100644 index 3bb1969..0000000 --- a/packet/src/test/java/org/jclouds/packet/features/SshKeyApiMockTest.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.packet.features; - -import org.jclouds.packet.compute.internal.BasePacketApiMockTest; -import org.jclouds.packet.domain.SshKey; -import org.testng.annotations.Test; - -import static com.google.common.collect.Iterables.isEmpty; -import static com.google.common.collect.Iterables.size; -import static org.jclouds.packet.domain.options.ListOptions.Builder.page; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertNull; -import static org.testng.Assert.assertTrue; - -@Test(groups = "unit", testName = "SshKeyApiMockTest", singleThreaded = true) -public class SshKeyApiMockTest extends BasePacketApiMockTest { - - public void testListSshKeys() throws InterruptedException { - server.enqueue(jsonResponse("/sshKeys-first.json")); - server.enqueue(jsonResponse("/sshKeys-last.json")); - - Iterable<SshKey> sshkeys = api.sshKeyApi().list().concat(); - - assertEquals(size(sshkeys), 8); // Force the PagedIterable to advance - assertEquals(server.getRequestCount(), 2); - - assertSent(server, "GET", "/ssh-keys"); - assertSent(server, "GET", "/ssh-keys?page=2"); - } - - public void testListSshKeysReturns404() throws InterruptedException { - server.enqueue(response404()); - - Iterable<SshKey> sshkeys = api.sshKeyApi().list().concat(); - - assertTrue(isEmpty(sshkeys)); - - assertEquals(server.getRequestCount(), 1); - assertSent(server, "GET", "/ssh-keys"); - } - - public void testListSshKeysWithOptions() throws InterruptedException { - server.enqueue(jsonResponse("/sshKeys-first.json")); - - Iterable<SshKey> actions = api.sshKeyApi().list(page(1).perPage(5)); - - assertEquals(size(actions), 5); - assertEquals(server.getRequestCount(), 1); - - assertSent(server, "GET", "/ssh-keys?page=1&per_page=5"); - } - - public void testListSshKeysWithOptionsReturns404() throws InterruptedException { - server.enqueue(response404()); - - Iterable<SshKey> actions = api.sshKeyApi().list(page(1).perPage(5)); - - assertTrue(isEmpty(actions)); - - assertEquals(server.getRequestCount(), 1); - assertSent(server, "GET", "/ssh-keys?page=1&per_page=5"); - } - - public void testGetSshKey() throws InterruptedException { - server.enqueue(jsonResponse("/ssh-key.json")); - - SshKey sshKey = api.sshKeyApi().get("1"); - - assertEquals(sshKey, objectFromResource("/ssh-key.json", SshKey.class)); - - assertEquals(server.getRequestCount(), 1); - assertSent(server, "GET", "/ssh-keys/1"); - } - - public void testGetSshKeyReturns404() throws InterruptedException { - server.enqueue(response404()); - - SshKey sshKey = api.sshKeyApi().get("1"); - - assertNull(sshKey); - - assertEquals(server.getRequestCount(), 1); - assertSent(server, "GET", "/ssh-keys/1"); - } - - public void testCreateSshKey() throws InterruptedException { - server.enqueue(jsonResponse("/ssh-key-create-res.json")); - - SshKey sshKey = api.sshKeyApi().create( - "jclouds-ssh-key-livetest", - "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCdgcoNzH4hCc0j3b4MuG503L/J54uyFvwCAOu8vSsYuLpJ4AEyEOv+T0SfdF605fK6GYXA16Rxk3lrPt7mfKGNtXR0Ripbv7Zc6PvCRorwgj/cjh/45miozjrkXAiHD1GFZycfbi4YsoWAqZj7W4mwtctmhrYM0FPdya2XoRpVy89N+A5Xo4Xtd6EZn6JGEKQM5+kF2aL3ggy0od/DqjuEVYwZoyTe1RgUTXZSU/Woh7WMhsRHbqd3eYz4s6ac8n8IJPGKtUaQeqUtH7OK6NRYXVypUrkqNlwdNYZAwrjXg/x5T3D+bo11LENASRt9OJ2OkmRSTqRxBeDkhnVauWK/" - ); - - assertEquals(sshKey, objectFromResource("/ssh-key-create-res.json", SshKey.class)); - - assertEquals(server.getRequestCount(), 1); - assertSent(server, "POST", "/ssh-keys", stringFromResource("/ssh-key-create-req.json")); - } - - public void testDeleteSshKey() throws InterruptedException { - server.enqueue(response204()); - - api.sshKeyApi().delete("1"); - - assertEquals(server.getRequestCount(), 1); - assertSent(server, "DELETE", "/ssh-keys/1"); - } - - public void testDeleteSshKeyReturns404() throws InterruptedException { - server.enqueue(response404()); - - api.sshKeyApi().delete("1"); - - assertEquals(server.getRequestCount(), 1); - assertSent(server, "DELETE", "/ssh-keys/1"); - } - - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/cb70f325/packet/src/test/java/org/jclouds/packet/functions/HrefToListOptionsTest.java ---------------------------------------------------------------------- diff --git a/packet/src/test/java/org/jclouds/packet/functions/HrefToListOptionsTest.java b/packet/src/test/java/org/jclouds/packet/functions/HrefToListOptionsTest.java deleted file mode 100644 index 1fecb29..0000000 --- a/packet/src/test/java/org/jclouds/packet/functions/HrefToListOptionsTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.packet.functions; - -import org.jclouds.packet.domain.Href; -import org.jclouds.packet.domain.options.ListOptions; -import org.testng.annotations.Test; - -import com.google.common.collect.Multimap; - -import static com.google.common.collect.Iterables.getOnlyElement; -import static org.jclouds.packet.domain.options.ListOptions.PAGE_PARAM; -import static org.jclouds.packet.domain.options.ListOptions.PER_PAGE_PARAM; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertFalse; -import static org.testng.Assert.assertNotNull; - -@Test(groups = "unit", testName = "HrefToListOptionsTest") -public class HrefToListOptionsTest { - - public void testNoOptions() { - HrefToListOptions function = new HrefToListOptions(); - - ListOptions options = function.apply(Href.create("https://api.packet.net/projects")); - assertNotNull(options); - - Multimap<String, String> params = options.buildQueryParameters(); - assertFalse(params.containsKey(PAGE_PARAM)); - assertFalse(params.containsKey(PER_PAGE_PARAM)); - } - - public void testWithOptions() { - HrefToListOptions function = new HrefToListOptions(); - - ListOptions options = function.apply(Href.create("https://api.packet.net/projects?page=2&per_page=5")); - assertNotNull(options); - - Multimap<String, String> params = options.buildQueryParameters(); - assertEquals(getOnlyElement(params.get(PAGE_PARAM)), "2"); - assertEquals(getOnlyElement(params.get(PER_PAGE_PARAM)), "5"); - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/cb70f325/packet/src/test/resources/device-create-req.json ---------------------------------------------------------------------- diff --git a/packet/src/test/resources/device-create-req.json b/packet/src/test/resources/device-create-req.json deleted file mode 100644 index 78e5ea5..0000000 --- a/packet/src/test/resources/device-create-req.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "hostname": "jclouds-device-livetest", - "plan": "baremetal_0", - "billing_cycle": "hourly", - "facility": "ewr1", - "features": {}, - "operating_system": "ubuntu_16_04", - "locked": false, - "userdata": "", - "tags": [] -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/cb70f325/packet/src/test/resources/device-create-res.json ---------------------------------------------------------------------- diff --git a/packet/src/test/resources/device-create-res.json b/packet/src/test/resources/device-create-res.json deleted file mode 100644 index 7a5986f..0000000 --- a/packet/src/test/resources/device-create-res.json +++ /dev/null @@ -1,211 +0,0 @@ -{ - "id": "3238ce59-fe02-4b9b-92c1-915ef4f3fb9e", - "short_id": "3238ce59", - "hostname": "andrea-device-livetest", - "description": null, - "state": "queued", - "tags": [], - "billing_cycle": "hourly", - "user": "root", - "iqn": "iqn.2017-01.net.packet:device.3238ce59", - "locked": false, - "bonding_mode": 5, - "created_at": "2017-01-20T14:15:28Z", - "updated_at": "2017-01-20T14:15:29Z", - "provisioning_percentage": 10.0, - "operating_system": { - "id": "1b9b78e3-de68-466e-ba00-f2123e89c112", - "slug": "ubuntu_16_04", - "name": "Ubuntu 16.04 LTS", - "distro": "ubuntu", - "version": "16.04", - "provisionable_on": [ - "baremetal_0", - "baremetal_1", - "baremetal_2", - "baremetal_2a", - "baremetal_3", - "baremetal_hua" - ] - }, - "facility": { - "id": "e1e9c52e-a0bc-4117-b996-0fc94843ea09", - "name": "Parsippany, NJ", - "code": "ewr1", - "features": [ - "baremetal", - "storage" - ], - "address": null - }, - "project": { - "href": "/projects/93907f48-adfe-43ed-ad89-0e6e83721a54" - }, - "ssh_keys": [ - { - "href": "/ssh-keys/a3d8bebe-574f-427d-80ee-bc2ba17f7074" - }, - { - "href": "/ssh-keys/a8d6cc17-7d9d-4fb9-8190-afdb301b67df" - }, - { - "href": "/ssh-keys/084a5dec-30be-415a-8937-9c615932e459" - }, - { - "href": "/ssh-keys/eacfb002-45e1-4047-a0d5-cd9d8bab19ed" - }, - { - "href": "/ssh-keys/f82b69d7-8c7e-4a38-9283-ecdbcaba56aa" - }, - { - "href": "/ssh-keys/da5d6c21-2e8c-43ac-820f-ff41bd4e6ebc" - } - ], - "project_lite": { - "href": "/projects/93907f48-adfe-43ed-ad89-0e6e83721a54" - }, - "volumes": [], - "ip_addresses": [], - "provisioning_events": [ - { - "id": "32a4da09-37dd-446b-99ef-9f64c1eb0097", - "type": "provisioning.101", - "body": "Provisioning started", - "created_at": "2017-01-20T14:15:29Z", - "relationships": [ - { - "href": "#5062a5fe-19ea-4b41-864c-e5f4dcb02fa0" - } - ], - "interpolated": "Provisioning started", - "href": "/events/32a4da09-37dd-446b-99ef-9f64c1eb0097" - }, - { - "id": null, - "type": "provisioning.102", - "body": "Network configured", - "created_at": null, - "relationships": [], - "interpolated": "Network configured" - }, - { - "id": null, - "type": "provisioning.103", - "body": "Configuration written, restarting device", - "created_at": null, - "relationships": [], - "interpolated": "Configuration written, restarting device" - }, - { - "id": null, - "type": "provisioning.104", - "body": "Connected to magic install system", - "created_at": null, - "relationships": [], - "interpolated": "Connected to magic install system" - }, - { - "id": null, - "type": "provisioning.105", - "body": "Server partitions created", - "created_at": null, - "relationships": [], - "interpolated": "Server partitions created" - }, - { - "id": null, - "type": "provisioning.106", - "body": "Operating system packages installed", - "created_at": null, - "relationships": [], - "interpolated": "Operating system packages installed" - }, - { - "id": null, - "type": "provisioning.107", - "body": "Server networking interfaces configured", - "created_at": null, - "relationships": [], - "interpolated": "Server networking interfaces configured" - }, - { - "id": null, - "type": "provisioning.108", - "body": "Cloud-init packages installed and configured", - "created_at": null, - "relationships": [], - "interpolated": "Cloud-init packages installed and configured" - }, - { - "id": null, - "type": "provisioning.109", - "body": "Installation finished, rebooting server", - "created_at": null, - "relationships": [], - "interpolated": "Installation finished, rebooting server" - }, - { - "id": null, - "type": "provisioning.109", - "body": "Installation finished, rebooting server", - "created_at": null, - "relationships": [], - "interpolated": "Installation finished, rebooting server" - } - ], - "plan": { - "id": "e69c0169-4726-46ea-98f1-939c9e8a3607", - "slug": "baremetal_0", - "name": "Type 0", - "description": "Our Type 0 configuration is a general use \"cloud killer\" server, with a Intel Atom 2.4Ghz processor and 8GB of RAM.", - "line": "baremetal", - "specs": { - "cpus": [ - { - "count": 1, - "type": "Intel Atom C2550 @ 2.4Ghz" - } - ], - "memory": { - "total": "8GB" - }, - "drives": [ - { - "count": 1, - "size": "80GB", - "type": "SSD" - } - ], - "nics": [ - { - "count": 2, - "type": "1Gbps" - } - ], - "features": { - "raid": false, - "txt": true - } - }, - "available_in": [ - { - "href": "/facilities/2b70eb8f-fa18-47c0-aba7-222a842362fd" - }, - { - "href": "/facilities/8e6470b3-b75e-47d1-bb93-45b225750975" - }, - { - "href": "/facilities/8ea03255-89f9-4e62-9d3f-8817db82ceed" - }, - { - "href": "/facilities/e1e9c52e-a0bc-4117-b996-0fc94843ea09" - } - ], - "pricing": { - "hour": 0.05 - } - }, - "userdata": "", - "root_password": "$n4hwka3!i", - "href": "/devices/3238ce59-fe02-4b9b-92c1-915ef4f3fb9e" -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/cb70f325/packet/src/test/resources/device.json ---------------------------------------------------------------------- diff --git a/packet/src/test/resources/device.json b/packet/src/test/resources/device.json deleted file mode 100644 index b4daa39..0000000 --- a/packet/src/test/resources/device.json +++ /dev/null @@ -1,278 +0,0 @@ -{ - "id": "98e22032-579e-4c04-bb12-05cc6a3864c8", - "short_id": "98e22032", - "hostname": "test", - "description": null, - "state": "provisioning", - "tags": [], - "billing_cycle": "hourly", - "user": "root", - "iqn": "iqn.2017-01.net.packet:device.98e22032", - "locked": false, - "bonding_mode": 5, - "created_at": "2017-01-03T09:47:59Z", - "updated_at": "2017-01-03T09:50:13Z", - "provisioning_percentage": 50, - "operating_system": { - "id": "68bad60d-f5a7-45c2-ad09-573edaad3a3c", - "slug": "centos_7", - "name": "Centos 7", - "distro": "centos", - "version": "7", - "provisionable_on": [ - "baremetal_0", - "baremetal_1", - "baremetal_2", - "baremetal_3" - ] - }, - "facility": { - "id": "e1e9c52e-a0bc-4117-b996-0fc94843ea09", - "name": "Parsippany, NJ", - "code": "ewr1", - "features": [ - "baremetal", - "storage" - ], - "address": null - }, - "project": { - "href": "/projects/93907f48-adfe-43ed-ad89-0e6e83721a54" - }, - "ssh_keys": [ - { - "href": "/ssh-keys/084a5dec-30be-415a-8937-9c615932e459" - }, - { - "href": "/ssh-keys/a8d6cc17-7d9d-4fb9-8190-afdb301b67df" - }, - { - "href": "/ssh-keys/a3d8bebe-574f-427d-80ee-bc2ba17f7074" - }, - { - "href": "/ssh-keys/eacfb002-45e1-4047-a0d5-cd9d8bab19ed" - }, - { - "href": "/ssh-keys/bba63e41-b12c-493a-81d4-e52f50f247ed" - } - ], - "project_lite": { - "href": "/projects/93907f48-adfe-43ed-ad89-0e6e83721a54" - }, - "volumes": [], - "ip_addresses": [ - { - "id": "5d0262c7-1727-411c-94c4-9e6f15490dd3", - "address_family": 4, - "netmask": "255.255.255.254", - "created_at": "2017-01-03T09:47:59Z", - "public": true, - "cidr": 31, - "management": true, - "manageable": true, - "assigned_to": { - "href": "/devices/98e22032-579e-4c04-bb12-05cc6a3864c8" - }, - "network": "147.75.106.80", - "address": "147.75.106.81", - "gateway": "147.75.106.80", - "href": "/ips/5d0262c7-1727-411c-94c4-9e6f15490dd3" - }, - { - "id": "f7d0e65c-eb3b-42bd-af9b-ad3a736d8d43", - "address_family": 6, - "netmask": "ffff:ffff:ffff:ffff:ffff:ffff:ffff:fffe", - "created_at": "2017-01-03T09:47:59Z", - "public": true, - "cidr": 127, - "management": true, - "manageable": true, - "assigned_to": { - "href": "/devices/98e22032-579e-4c04-bb12-05cc6a3864c8" - }, - "network": "2604:1380:2:9800::", - "address": "2604:1380:2:9800::1", - "gateway": "2604:1380:2:9800::", - "href": "/ips/f7d0e65c-eb3b-42bd-af9b-ad3a736d8d43" - }, - { - "id": "a3d00b4e-d74f-4ac2-8bc9-91065d815b41", - "address_family": 4, - "netmask": "255.255.255.254", - "created_at": "2017-01-03T09:47:59Z", - "public": false, - "cidr": 31, - "management": true, - "manageable": true, - "assigned_to": { - "href": "/devices/98e22032-579e-4c04-bb12-05cc6a3864c8" - }, - "network": "10.99.214.0", - "address": "10.99.214.1", - "gateway": "10.99.214.0", - "href": "/ips/a3d00b4e-d74f-4ac2-8bc9-91065d815b41" - } - ], - "provisioning_events": [ - { - "id": "bd62123b-afed-4e54-b1b9-89e219ba9cf0", - "type": "provisioning.101", - "body": "Provisioning started", - "created_at": "2017-01-03T09:47:59Z", - "relationships": [ - { - "href": "#81909921-255e-413c-883a-c58d14c801ae" - } - ], - "interpolated": "Provisioning started", - "href": "/events/bd62123b-afed-4e54-b1b9-89e219ba9cf0" - }, - { - "id": "14b4a9e6-be90-40ee-be48-b272f855e39c", - "type": "provisioning.102", - "body": "Network configured with addresses 147.75.106.81, 2604:1380:2:9800::1, and 10.99.214.1", - "created_at": "2017-01-03T09:48:46Z", - "relationships": [ - { - "href": "#28588657-b8bf-44a1-98d3-27f8e04b660a" - } - ], - "interpolated": "Network configured with addresses 147.75.106.81, 2604:1380:2:9800::1, and 10.99.214.1", - "href": "/events/14b4a9e6-be90-40ee-be48-b272f855e39c" - }, - { - "id": "57e3cadb-f9aa-4c73-be54-3c83e6cf462e", - "type": "provisioning.103", - "body": "Configuration written, restarting device", - "created_at": "2017-01-03T09:48:57Z", - "relationships": [ - { - "href": "#25a7e807-f4aa-4f36-83cd-8347baeb26bc" - } - ], - "interpolated": "Configuration written, restarting device", - "href": "/events/57e3cadb-f9aa-4c73-be54-3c83e6cf462e" - }, - { - "id": "b8322996-f57e-4c87-96cc-a16f33a0c305", - "type": "provisioning.104", - "body": "Connected to magic install system", - "created_at": "2017-01-03T09:50:13Z", - "relationships": [ - { - "href": "#a4825d20-f7f2-426a-88db-38696bd3dfd6" - } - ], - "interpolated": "Connected to magic install system", - "href": "/events/b8322996-f57e-4c87-96cc-a16f33a0c305" - }, - { - "id": "f00a00a9-7c59-420d-bdcf-2c0993303cf6", - "type": "provisioning.105", - "body": "Server partitions created", - "created_at": "2017-01-03T09:50:13Z", - "relationships": [ - { - "href": "#6140659b-5e3d-4686-be8f-8879b6d3e27f" - } - ], - "interpolated": "Server partitions created", - "href": "/events/f00a00a9-7c59-420d-bdcf-2c0993303cf6" - }, - { - "id": null, - "type": "provisioning.106", - "body": "Operating system packages installed", - "created_at": null, - "relationships": [], - "interpolated": "Operating system packages installed" - }, - { - "id": null, - "type": "provisioning.107", - "body": "Server networking interfaces configured", - "created_at": null, - "relationships": [], - "interpolated": "Server networking interfaces configured" - }, - { - "id": null, - "type": "provisioning.108", - "body": "Cloud-init packages installed and configured", - "created_at": null, - "relationships": [], - "interpolated": "Cloud-init packages installed and configured" - }, - { - "id": null, - "type": "provisioning.109", - "body": "Installation finished, rebooting server", - "created_at": null, - "relationships": [], - "interpolated": "Installation finished, rebooting server" - }, - { - "id": null, - "type": "provisioning.109", - "body": "Installation finished, rebooting server", - "created_at": null, - "relationships": [], - "interpolated": "Installation finished, rebooting server" - } - ], - "plan": { - "id": "e69c0169-4726-46ea-98f1-939c9e8a3607", - "slug": "baremetal_0", - "name": "Type 0", - "description": "Our Type 0 configuration is a general use \"cloud killer\" server, with a Intel Atom 2.4Ghz processor and 8GB of RAM.", - "line": "baremetal", - "specs": { - "cpus": [ - { - "count": 1, - "type": "Intel Atom C2550 @ 2.4Ghz" - } - ], - "memory": { - "total": "8GB" - }, - "drives": [ - { - "count": 1, - "size": "80GB", - "type": "SSD" - } - ], - "nics": [ - { - "count": 2, - "type": "1Gbps" - } - ], - "features": { - "raid": false, - "txt": true - } - }, - "available_in": [ - { - "href": "/facilities/2b70eb8f-fa18-47c0-aba7-222a842362fd" - }, - { - "href": "/facilities/8e6470b3-b75e-47d1-bb93-45b225750975" - }, - { - "href": "/facilities/8ea03255-89f9-4e62-9d3f-8817db82ceed" - }, - { - "href": "/facilities/e1e9c52e-a0bc-4117-b996-0fc94843ea09" - } - ], - "pricing": { - "hour": 0.05 - } - }, - "userdata": "", - "root_password": ",q4*a8(eny", - "href": "/devices/98e22032-579e-4c04-bb12-05cc6a3864c8" -}
