You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by ad...@apache.org on 2014/11/17 17:21:11 UTC
[04/32] jclouds-labs git commit: JCLOUDS-780 Remove vcloud-director.
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/775b89fd/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/BaseVCloudDirectorApiLiveTest.java
----------------------------------------------------------------------
diff --git a/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/BaseVCloudDirectorApiLiveTest.java b/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/BaseVCloudDirectorApiLiveTest.java
deleted file mode 100644
index e4f0bbe..0000000
--- a/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/BaseVCloudDirectorApiLiveTest.java
+++ /dev/null
@@ -1,741 +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.vcloud.director.v1_5.internal;
-
-import static com.google.common.base.Predicates.and;
-import static com.google.common.base.Strings.emptyToNull;
-import static com.google.common.collect.Iterables.any;
-import static com.google.common.collect.Iterables.contains;
-import static com.google.common.collect.Iterables.find;
-import static com.google.common.collect.Iterables.getFirst;
-import static com.google.common.collect.Iterables.tryFind;
-import static org.jclouds.util.Predicates2.retry;
-import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.ENTITY_NON_NULL;
-import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.TASK_COMPLETE_TIMELY;
-import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.URN_REQ_LIVE;
-import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.CATALOG;
-import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.MEDIA;
-import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.NETWORK;
-import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.ORG_NETWORK;
-import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.USER;
-import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.VAPP;
-import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.VAPP_TEMPLATE;
-import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.VDC;
-import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.VM;
-import static org.jclouds.vcloud.director.v1_5.domain.params.UndeployVAppParams.PowerAction.SHUTDOWN;
-import static org.jclouds.vcloud.director.v1_5.predicates.LinkPredicates.relEquals;
-import static org.jclouds.vcloud.director.v1_5.predicates.LinkPredicates.typeEquals;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
-
-import java.net.URI;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.Random;
-import java.util.Set;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-
-import org.jclouds.apis.BaseContextLiveTest;
-import org.jclouds.date.DateService;
-import org.jclouds.io.Payloads;
-import org.jclouds.logging.Logger;
-import org.jclouds.rest.ApiContext;
-import org.jclouds.vcloud.director.testng.FormatApiResultsListener;
-import org.jclouds.vcloud.director.v1_5.VCloudDirectorContext;
-import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
-import org.jclouds.vcloud.director.v1_5.admin.VCloudDirectorAdminApi;
-import org.jclouds.vcloud.director.v1_5.domain.Catalog;
-import org.jclouds.vcloud.director.v1_5.domain.Checks;
-import org.jclouds.vcloud.director.v1_5.domain.Link;
-import org.jclouds.vcloud.director.v1_5.domain.Link.Rel;
-import org.jclouds.vcloud.director.v1_5.domain.Media;
-import org.jclouds.vcloud.director.v1_5.domain.Reference;
-import org.jclouds.vcloud.director.v1_5.domain.ResourceEntity.Status;
-import org.jclouds.vcloud.director.v1_5.domain.Role.DefaultRoles;
-import org.jclouds.vcloud.director.v1_5.domain.RoleReferences;
-import org.jclouds.vcloud.director.v1_5.domain.Session;
-import org.jclouds.vcloud.director.v1_5.domain.Task;
-import org.jclouds.vcloud.director.v1_5.domain.User;
-import org.jclouds.vcloud.director.v1_5.domain.VApp;
-import org.jclouds.vcloud.director.v1_5.domain.VAppTemplate;
-import org.jclouds.vcloud.director.v1_5.domain.Vdc;
-import org.jclouds.vcloud.director.v1_5.domain.Vm;
-import org.jclouds.vcloud.director.v1_5.domain.network.Network;
-import org.jclouds.vcloud.director.v1_5.domain.network.NetworkConfiguration;
-import org.jclouds.vcloud.director.v1_5.domain.network.VAppNetworkConfiguration;
-import org.jclouds.vcloud.director.v1_5.domain.org.Org;
-import org.jclouds.vcloud.director.v1_5.domain.params.InstantiateVAppTemplateParams;
-import org.jclouds.vcloud.director.v1_5.domain.params.InstantiationParams;
-import org.jclouds.vcloud.director.v1_5.domain.params.UndeployVAppParams;
-import org.jclouds.vcloud.director.v1_5.domain.section.NetworkConfigSection;
-import org.jclouds.vcloud.director.v1_5.features.TaskApi;
-import org.jclouds.vcloud.director.v1_5.features.VAppApi;
-import org.jclouds.vcloud.director.v1_5.features.VAppTemplateApi;
-import org.jclouds.vcloud.director.v1_5.features.VdcApi;
-import org.jclouds.vcloud.director.v1_5.predicates.LinkPredicates;
-import org.jclouds.vcloud.director.v1_5.predicates.ReferencePredicates;
-import org.jclouds.vcloud.director.v1_5.predicates.TaskStatusEquals;
-import org.jclouds.vcloud.director.v1_5.predicates.TaskSuccess;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Listeners;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Function;
-import com.google.common.base.Objects;
-import com.google.common.base.Optional;
-import com.google.common.base.Predicate;
-import com.google.common.base.Predicates;
-import com.google.common.collect.FluentIterable;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
-import com.google.common.reflect.TypeToken;
-import com.google.inject.Guice;
-
-@Listeners(FormatApiResultsListener.class)
-@Test(groups = "live")
-public abstract class BaseVCloudDirectorApiLiveTest extends BaseContextLiveTest<VCloudDirectorContext> {
-
- @Resource
- protected Logger logger = Logger.NULL;
-
- protected static final long TASK_TIMEOUT_SECONDS = 100L;
- protected static final long LONG_TASK_TIMEOUT_SECONDS = 300L;
-
- public static final int REQUIRED_ADMIN_VM_QUOTA = 0;
- public static final int REQUIRED_USER_VM_QUOTA = 0;
-
- public Predicate<Task> retryTaskSuccess;
- public Predicate<Task> retryTaskSuccessLong;
-
- protected ApiContext<VCloudDirectorAdminApi> adminContext;
-
- protected Session adminSession;
- protected Session session;
-
- protected String orgId;
- protected Org org;
- protected String catalogId;
- private Catalog catalog;
- protected String vAppTemplateId;
- private VAppTemplate vAppTemplate;
- protected String mediaId;
- private Media media;
- protected String networkId;
- private Network network;
- protected String vdcId;
- private Vdc vdc;
- protected String userId;
- private User user;
-
- protected final Set<String> vAppNames = Sets.newLinkedHashSet();
- protected static final Random random = new Random();
-
- protected BaseVCloudDirectorApiLiveTest() {
- provider = "vcloud-director";
- }
-
- protected DateService dateService;
-
- protected static String testStamp;
-
- @BeforeClass(alwaysRun = true)
- protected void setupDateService() {
- dateService = Guice.createInjector().getInstance(DateService.class);
- assertNotNull(dateService);
- }
-
- /** Implement as required to populate xxxApi fields, or NOP */
- protected abstract void setupRequiredApis();
-
- @Inject
- protected void initTaskSuccess(TaskSuccess taskSuccess) {
- retryTaskSuccess = retry(taskSuccess, TASK_TIMEOUT_SECONDS * 1000L);
- }
-
- @Inject
- protected void initTaskSuccessLong(TaskSuccess taskSuccess) {
- retryTaskSuccessLong = retry(taskSuccess, LONG_TASK_TIMEOUT_SECONDS * 1000L);
- }
-
- @BeforeClass(groups = { "integration", "live" })
- public void setupContext() {
- super.setupContext();
- adminContext = context.getAdminContext();
-
- adminSession = adminContext.getApi().getCurrentSession();
- adminContext.utils().injector().injectMembers(this);
-
- session = context.getApi().getCurrentSession();
- context.utils().injector().injectMembers(this);
-
- initTestParametersFromPropertiesOrLazyDiscover();
- setupRequiredApis();
- }
-
- public static String getTestDateTimeStamp() {
- if (testStamp == null) {
- testStamp = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
- }
-
- return testStamp;
- }
-
- public Reference getRoleReferenceFor(String name) {
- return getRoleReferenceFor(name, adminContext);
- }
-
- public static Reference getRoleReferenceFor(String name, ApiContext<VCloudDirectorAdminApi> adminContext) {
- RoleReferences roles = adminContext.getApi().getQueryApi().roleReferencesQueryAll();
- // backend in a builder to strip out unwanted xml cruft that the api chokes on
- return Reference.builder().fromReference(find(roles.getReferences(), ReferencePredicates.nameEquals(name)))
- .build();
- }
-
- public User randomTestUser(String prefix) {
- return randomTestUser(prefix, getRoleReferenceFor(DefaultRoles.USER.value()));
- }
-
- public User randomTestUser(String prefix, Reference role) {
- return User.builder().name(name(prefix) + getTestDateTimeStamp()).fullName("testFullName")
- .emailAddress("test@test.com").telephone("555-1234").isEnabled(false).im("testIM").isAlertEnabled(false)
- .alertEmailPrefix("testPrefix").alertEmail("testAlert@test.com").isExternal(false).isGroupRole(false)
- .role(role).password("password").build();
- }
-
- protected void initTestParametersFromPropertiesOrLazyDiscover() {
- catalogId = emptyToNull(System.getProperty("test." + provider + ".catalog-id"));
-
- vAppTemplateId = emptyToNull(System.getProperty("test." + provider + ".vapptemplate-id"));
-
- vdcId = emptyToNull(System.getProperty("test." + provider + ".vdc-id"));
-
- mediaId = emptyToNull(System.getProperty("test." + provider + ".media-id"));
-
- networkId = emptyToNull(System.getProperty("test." + provider + ".network-id"));
-
- userId = emptyToNull(System.getProperty("test." + provider + ".user-id"));
-
- org = context
- .getApi()
- .getOrgApi()
- .get(find(context.getApi().getOrgApi().list(), ReferencePredicates.<Reference> nameEquals(session.get()))
- .getHref());
- orgId = org.getId();
-
- if (any(Lists.newArrayList(vAppTemplateId, networkId, vdcId), Predicates.isNull())) {
-
- if (vdcId == null) {
- vdc = context.getApi().getVdcApi()
- .get(find(org.getLinks(), ReferencePredicates.<Link> typeEquals(VDC)).getHref());
- vdcId = vdc.getId();
-
- if (vAppTemplateId == null) {
- Optional<VAppTemplate> optionalvAppTemplate = tryFindVAppTemplateInOrg();
- if (optionalvAppTemplate.isPresent()) {
- vAppTemplate = optionalvAppTemplate.get();
- vAppTemplateId = vAppTemplate.getId();
- }
- }
- }
-
- if (networkId == null) {
- Optional<Network> optionalNetwork = tryFindBridgedNetworkInOrg();
- if (optionalNetwork.isPresent()) {
- network = optionalNetwork.get();
- networkId = network.getId();
- }
- }
-
- if (catalogId == null) {
- Optional<Catalog> optionalCatalog = tryFindWritableCatalogInOrg();
- if (optionalCatalog.isPresent()) {
- catalog = optionalCatalog.get();
- catalogId = catalog.getId();
- }
- }
- }
- }
-
- Function<VAppTemplate, String> prettyVAppTemplate = new Function<VAppTemplate, String>() {
-
- @Override
- public String apply(VAppTemplate input) {
- return Objects.toStringHelper("").omitNullValues().add("name", input.getName()).add("id", input.getId())
- .add("owner", input.getOwner()).toString();
- }
-
- };
-
- public Optional<VAppTemplate> tryFindVAppTemplateInOrg() {
- FluentIterable<VAppTemplate> vAppTemplates = FluentIterable.from(vdc.getResourceEntities())
- .filter(ReferencePredicates.<Reference> typeEquals(VAPP_TEMPLATE))
- .transform(new Function<Reference, VAppTemplate>() {
-
- @Override
- public VAppTemplate apply(Reference in) {
- return context.getApi().getVAppTemplateApi().get(in.getHref());
- }})
- .filter(Predicates.notNull());
-
- Optional<VAppTemplate> optionalVAppTemplate = tryFind(vAppTemplates, new Predicate<VAppTemplate>() {
-
- @Override
- public boolean apply(VAppTemplate input) {
- return input.getOwner().getUser().getName().equals(session.getUser());
- }
-
- });
-
- if (optionalVAppTemplate.isPresent()) {
- Logger.CONSOLE.info("found vAppTemplate: %s", prettyVAppTemplate.apply(optionalVAppTemplate.get()));
- } else {
- Logger.CONSOLE.warn("%s doesn't own any vApp Template in org %s; vApp templates: %s", context.getApi()
- .getCurrentSession().getUser(), org.getName(), Iterables.transform(vAppTemplates, prettyVAppTemplate));
- }
-
- return optionalVAppTemplate;
- }
-
- Function<Vm, String> prettyVm = new Function<Vm, String>() {
-
- @Override
- public String apply(Vm input) {
- return Objects.toStringHelper("").omitNullValues().add("name", input.getName()).add("id", input.getId()).toString();
- }
-
- };
-
- public Optional<Vm> tryFindVmInOrg() {
- FluentIterable<Vm> vms = FluentIterable.from(vdc.getResourceEntities())
- .filter(ReferencePredicates.<Reference> typeEquals(VM))
- .transform(new Function<Reference, Vm>() {
-
- @Override
- public Vm apply(Reference in) {
- return context.getApi().getVmApi().get(in.getHref());
- }})
- .filter(Predicates.notNull());
-
- Optional<Vm> optionalVm = tryFind(vms, new Predicate<Vm>() {
-
- @Override
- public boolean apply(Vm input) {
- return input.getId() != null;
- }
- });
-
- if (optionalVm.isPresent()) {
- Logger.CONSOLE.info("found vm: %s", prettyVm.apply(optionalVm.get()));
- } else {
- Logger.CONSOLE.warn("%s doesn't have any vm in org %s; vms: %s", context.getApi()
- .getCurrentSession().getUser(), org.getName(), Iterables.transform(vms, prettyVm));
- }
-
- return optionalVm;
- }
-
- Function<Catalog, String> prettyCatalog = new Function<Catalog, String>() {
-
- @Override
- public String apply(Catalog input) {
- return Objects.toStringHelper("").omitNullValues().add("name", input.getName()).add("id", input.getId())
- .add("owner", input.getOwner()).add("isPublished", input.isPublished()).toString();
- }
-
- };
-
- /**
- * If I can add to a catalog, I can write to it
- */
- public Optional<Catalog> tryFindWritableCatalogInOrg() {
- FluentIterable<Catalog> catalogs = FluentIterable.from(org.getLinks())
- .filter(ReferencePredicates.<Link> typeEquals(CATALOG)).transform(new Function<Link, Catalog>() {
- @Override
- public Catalog apply(Link in) {
- return context.getApi().getCatalogApi().get(in.getHref());
- }
- });
-
- Optional<Catalog> optionalCatalog = tryFind(catalogs, new Predicate<Catalog>() {
-
- @Override
- public boolean apply(Catalog input) {
- return Iterables.any(input.getLinks(), LinkPredicates.relEquals(Rel.ADD));
- }
-
- });
- if (optionalCatalog.isPresent()) {
- Logger.CONSOLE.info("found catalog: %s", prettyCatalog.apply(optionalCatalog.get()));
- } else {
- Logger.CONSOLE.warn("%s doesn't own any catalogs in org %s; catalogs: %s", context.getApi()
- .getCurrentSession().getUser(), org.getName(), Iterables.transform(catalogs, prettyCatalog));
- }
- return optionalCatalog;
- }
-
- Function<Network, String> prettyNetwork = new Function<Network, String>() {
-
- @Override
- public String apply(Network input) {
- return Objects.toStringHelper("").omitNullValues().add("name", input.getName()).add("id", input.getId())
- .add("fenceMode", input.getConfiguration().getFenceMode())
- .add("taskCount", input.getTasks().size() > 0 ? input.getTasks().size() : null).toString();
- }
-
- };
-
- public Optional<Network> tryFindBridgedNetworkInOrg() {
- FluentIterable<Network> networks = FluentIterable.from(org.getLinks())
- .filter(ReferencePredicates.<Link> typeEquals(ORG_NETWORK)).transform(new Function<Link, Network>() {
- @Override
- public Network apply(Link in) {
- return context.getApi().getNetworkApi().get(in.getHref());
- }
- });
-
- Optional<Network> optionalNetwork = tryFind(networks, new Predicate<Network>() {
-
- @Override
- public boolean apply(Network input) {
- if (input.getConfiguration().getFenceMode().equals(Network.FenceMode.BRIDGED)) {
- if (input.getTasks().size() == 0) {
- return true;
- }
- }
- return false;
- }
-
- });
- if (optionalNetwork.isPresent()) {
- Logger.CONSOLE.info("found network: %s", prettyNetwork.apply(optionalNetwork.get()));
- } else {
- Logger.CONSOLE.warn("no ready bridged networks present in org %s; networks: %s", org.getName(),
- Iterables.transform(networks, prettyNetwork));
- }
- return optionalNetwork;
- }
-
- public FluentIterable<Media> findAllEmptyMediaInOrg() {
- vdc = context.getApi().getVdcApi().get(vdc.getHref());
- return FluentIterable
- .from(vdc.getResourceEntities())
- .filter(ReferencePredicates.<Reference> typeEquals(MEDIA))
- .transform(new Function<Reference, Media>() {
-
- @Override
- public Media apply(Reference in) {
- return context.getApi().getMediaApi()
- .get(in.getHref());
- }
- }).filter(new Predicate<Media>() {
-
- @Override
- public boolean apply(Media input) {
- return input.getSize() == 0;
- }
- });
- }
-
- public void cleanUpVAppTemplateInOrg() {
- FluentIterable<VAppTemplate> vAppTemplates = FluentIterable
- .from(vdc.getResourceEntities())
- .filter(ReferencePredicates
- .<Reference> typeEquals(VAPP_TEMPLATE))
- .transform(new Function<Reference, VAppTemplate>() {
-
- @Override
- public VAppTemplate apply(Reference in) {
- return context.getApi().getVAppTemplateApi()
- .get(in.getHref());
- }
- }).filter(Predicates.notNull());
-
- Iterables.removeIf(vAppTemplates, new Predicate<VAppTemplate>() {
-
- @Override
- public boolean apply(VAppTemplate input) {
- if (input.getName().startsWith("captured-") || input.getName().startsWith("uploaded-") || input.getName().startsWith("vappTemplateClone-"))
- context.getApi().getVAppTemplateApi().remove(input.getHref());
- return false;
- }});
- }
-
- protected Vdc lazyGetVdc() {
- if (vdc == null) {
- assertNotNull(vdcId, String.format(URN_REQ_LIVE, VDC));
- vdc = context.getApi().getVdcApi().get(context.resolveIdToHref(vdcId));
- assertNotNull(vdc, String.format(ENTITY_NON_NULL, VDC));
- }
- return vdc;
- }
-
- protected Network lazyGetNetwork() {
- if (network == null) {
- assertNotNull(networkId, String.format(URN_REQ_LIVE, NETWORK));
- network = context.getApi().getNetworkApi().get(context.resolveIdToHref(networkId));
- assertNotNull(network, String.format(ENTITY_NON_NULL, NETWORK));
- }
- return network;
- }
-
- protected Catalog lazyGetCatalog() {
- if (catalog == null) {
- assertNotNull(catalogId, String.format(URN_REQ_LIVE, CATALOG));
- catalog = context.getApi().getCatalogApi().get(context.resolveIdToHref(catalogId));
- assertNotNull(catalog, String.format(ENTITY_NON_NULL, CATALOG));
- }
- return catalog;
- }
-
- protected User lazyGetUser() {
- if (user == null) {
- assertNotNull(userId, String.format(URN_REQ_LIVE, USER));
- user = adminContext.getApi().getUserApi().get(context.resolveIdToHref(userId));
- assertNotNull(user, String.format(ENTITY_NON_NULL, USER));
- }
- return user;
- }
-
- protected Media lazyGetMedia(){
- if (media == null || mediaId == null) {
- Predicate<Link> addMediaLink = and(relEquals(Link.Rel.ADD), typeEquals(VCloudDirectorMediaType.MEDIA));
- if (contains(lazyGetVdc().getLinks(), addMediaLink)) {
- Link addMedia = find(lazyGetVdc().getLinks(), addMediaLink);
- byte[] iso = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
-
- Media sourceMedia = Media.builder().type(VCloudDirectorMediaType.MEDIA).name(name("media"))
- .size(iso.length).imageType(Media.ImageType.ISO)
- .description("Test media generated by VmApiLiveTest").build();
- media = context.getApi().getMediaApi().add(addMedia.getHref(), sourceMedia);
-
- Link uploadLink = getFirst(getFirst(media.getFiles(), null).getLinks(), null);
- context.getApi().getUploadApi().upload(uploadLink.getHref(), Payloads.newPayload(iso));
-
- media = context.getApi().getMediaApi().get(media.getHref());
-
- if (media.getTasks().size() == 1) {
- Task uploadTask = Iterables.getOnlyElement(media.getTasks());
- Checks.checkTask(uploadTask);
- assertEquals(uploadTask.getStatus(), Task.Status.RUNNING);
- assertTrue(retryTaskSuccess.apply(uploadTask), String.format(TASK_COMPLETE_TIMELY, "uploadTask"));
- media = context.getApi().getMediaApi().get(media.getHref());
- }
- mediaId = media.getId();
- } else {
- media = context.getApi().getMediaApi().get(context.resolveIdToHref(mediaId));
- }
- }
- return media;
- }
-
- protected VAppTemplate lazyGetVAppTemplate() {
- if (vAppTemplate == null) {
- assertNotNull(vAppTemplateId, String.format(URN_REQ_LIVE, VAPP_TEMPLATE));
- vAppTemplate = context.getApi().getVAppTemplateApi().get(context.resolveIdToHref(vAppTemplateId));
- assertNotNull(vAppTemplate, String.format(ENTITY_NON_NULL, VAPP_TEMPLATE));
- }
- return vAppTemplate;
- }
-
- protected void assertTaskSucceeds(Task task) {
- assertTrue(retryTaskSuccess.apply(task), String.format(TASK_COMPLETE_TIMELY, task));
- }
-
- protected void assertTaskSucceedsLong(Task task) {
- assertTrue(retryTaskSuccessLong.apply(task), String.format(TASK_COMPLETE_TIMELY, task));
- }
-
- protected boolean taskStatusEventually(Task task, Task.Status running, ImmutableSet<Task.Status> immutableSet) {
- TaskApi taskApi = context.getApi().getTaskApi();
- TaskStatusEquals predicate = new TaskStatusEquals(taskApi, running, immutableSet);
- return retry(predicate, TASK_TIMEOUT_SECONDS * 1000L).apply(task);
- }
-
- protected void assertTaskStatusEventually(Task task, Task.Status running, ImmutableSet<Task.Status> immutableSet) {
- assertTrue(taskStatusEventually(task, running, immutableSet),
- String.format("Task '%s' must reach status %s", task.getOperationName(), running));
- }
-
- protected boolean taskDoneEventually(Task task) {
- TaskApi taskApi = context.getApi().getTaskApi();
- TaskStatusEquals predicate = new TaskStatusEquals(taskApi, ImmutableSet.of(Task.Status.ABORTED,
- Task.Status.CANCELED, Task.Status.ERROR, Task.Status.SUCCESS), ImmutableSet.<Task.Status> of());
- return retry(predicate, TASK_TIMEOUT_SECONDS * 1000L).apply(task);
- }
-
- protected void assertTaskDoneEventually(Task task) {
- assertTrue(taskDoneEventually(task), String.format("Task '%s' must complete", task.getOperationName()));
- }
-
- /**
- * Instantiate a {@link VApp} in a {@link Vdc} using the {@link VAppTemplate} we have configured
- * for the tests.
- *
- * @return the VApp that is being instantiated
- */
- protected VApp instantiateVApp() {
- return instantiateVApp(name("test-vapp-"));
- }
-
- protected VApp instantiateVApp(String name) {
- InstantiateVAppTemplateParams instantiate = InstantiateVAppTemplateParams.builder().name(name).notDeploy()
- .notPowerOn().description("Test VApp").instantiationParams(instantiationParams())
- .source(Reference.builder().href(lazyGetVAppTemplate().getHref()).build()).build();
-
- VdcApi vdcApi = context.getApi().getVdcApi();
- VApp vAppInstantiated = vdcApi.instantiateVApp(context.resolveIdToHref(vdcId), instantiate);
- assertNotNull(vAppInstantiated, String.format(ENTITY_NON_NULL, VAPP));
-
- Task instantiationTask = getFirst(vAppInstantiated.getTasks(), null);
- if (instantiationTask != null)
- assertTaskSucceedsLong(instantiationTask);
-
- // Save VApp name for cleanUp
- vAppNames.add(name);
-
- return vAppInstantiated;
- }
-
- /** Build an {@link InstantiationParams} object. */
- protected InstantiationParams instantiationParams() {
- InstantiationParams instantiationParams = InstantiationParams.builder()
- .sections(ImmutableSet.of(networkConfigSection())).build();
-
- return instantiationParams;
- }
-
- /** Build a {@link NetworkConfigSection} object. */
- private NetworkConfigSection networkConfigSection() {
- NetworkConfigSection networkConfigSection = NetworkConfigSection
- .builder()
- .info("Configuration parameters for logical networks")
- .networkConfigs(
- ImmutableSet.of(VAppNetworkConfiguration.builder()
- .networkName("vAppNetwork")
- .configuration(networkConfiguration()).build())).build();
-
- return networkConfigSection;
- }
-
- /** Build a {@link NetworkConfiguration} object. */
- private NetworkConfiguration networkConfiguration() {
- Vdc vdc = context.getApi().getVdcApi().get(context.resolveIdToHref(vdcId));
- assertNotNull(vdc, String.format(ENTITY_NON_NULL, VDC));
-
- Set<Reference> networks = vdc.getAvailableNetworks();
- network = lazyGetNetwork();
- // Look up the network in the Vdc with the id configured for the tests
- Optional<Reference> parentNetwork = tryFind(networks, new Predicate<Reference>() {
- @Override
- public boolean apply(Reference reference) {
- return reference.getHref().equals(network.getHref());
- }
- });
-
- // Check we actually found a network reference
- if (!parentNetwork.isPresent()) {
- fail(String.format("Could not find network %s in vdc", network.getHref().toASCIIString()));
- }
-
- // Build the configuration object
- NetworkConfiguration networkConfiguration = NetworkConfiguration.builder().parentNetwork(parentNetwork.get())
- .fenceMode(Network.FenceMode.BRIDGED).build();
-
- return networkConfiguration;
- }
-
- protected void cleanUpVAppTemplate(VAppTemplate vAppTemplate) {
- VAppTemplateApi vappTemplateApi = context.getApi().getVAppTemplateApi();
- try {
- Task task = vappTemplateApi.remove(vAppTemplate.getHref());
- taskDoneEventually(task);
- } catch (Exception e) {
- logger.warn(e, "Error deleting template '%s'", vAppTemplate.getName());
- }
- }
-
- protected void cleanUpVApp(VApp vApp) {
- VAppApi vAppApi = context.getApi().getVAppApi();
-
- URI href = vApp.getHref();
- vApp = vAppApi.get(href); // Refresh
- if (vApp == null) {
- logger.info("Cannot find VApp at %s", href);
- return; // Presumably vApp has already been removed. Ignore.
- }
- logger.debug("Deleting VApp %s (%s)", vApp.getName(), href);
-
- // Wait for busy tasks to complete (don't care if it's failed or successful)
- // Otherwise, get error on remove "entity is busy completing an operation.
- if (vApp.getTasks() != null) {
- for (Task task : vApp.getTasks()) {
- if (!taskDoneEventually(task)) {
- logger.warn("Task '%s' did not complete", task.getOperationName());
- }
- }
- }
-
- // power off the VApp if necessary
- if (vApp.getStatus() == Status.POWERED_ON) {
- try {
- Task shutdownTask = vAppApi.powerOff(href);
- taskDoneEventually(shutdownTask);
- } catch (Exception e) {
- // keep going; cleanup as much as possible
- logger.warn(e, "Continuing cleanup after error shutting down VApp %s", vApp.getName());
- }
- }
-
- // Undeploy the VApp if necessary
- if (vApp.isDeployed()) {
- try {
- UndeployVAppParams params = UndeployVAppParams.builder().undeployPowerAction(SHUTDOWN).build();
- Task undeployTask = vAppApi.undeploy(href, params);
- taskDoneEventually(undeployTask);
- } catch (Exception e) {
- // keep going; cleanup as much as possible
- logger.warn(e, "Continuing cleanup after error undeploying VApp %s", vApp.getName());
- }
- }
-
- try {
- Task task = vAppApi.remove(href);
- taskDoneEventually(task);
- vAppNames.remove(vApp.getName());
- logger.info("Deleted VApp %s", vApp.getName());
- } catch (Exception e) {
- vApp = vAppApi.get(href); // Refresh
- logger.warn(e, "Deleting VApp %s failed (%s)", vApp.getName(), href);
- }
- }
-
- public static String name(String prefix) {
- return prefix + Integer.toString(random.nextInt(Integer.MAX_VALUE));
- }
-
- @Override
- protected TypeToken<VCloudDirectorContext> contextType() {
- return TypeToken.of(VCloudDirectorContext.class);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/775b89fd/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/BaseVCloudDirectorExpectTest.java
----------------------------------------------------------------------
diff --git a/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/BaseVCloudDirectorExpectTest.java b/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/BaseVCloudDirectorExpectTest.java
deleted file mode 100644
index be2be4e..0000000
--- a/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/BaseVCloudDirectorExpectTest.java
+++ /dev/null
@@ -1,176 +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.vcloud.director.v1_5.internal;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.testng.Assert.assertNotNull;
-
-import java.util.Properties;
-
-import org.jclouds.Constants;
-import org.jclouds.date.DateService;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.rest.internal.BaseRestApiExpectTest;
-import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
-import org.testng.annotations.BeforeGroups;
-
-import com.google.common.base.Throwables;
-import com.google.common.collect.ImmutableMultimap;
-import com.google.common.collect.LinkedListMultimap;
-import com.google.common.collect.Multimap;
-import com.google.common.net.HttpHeaders;
-import com.google.inject.Guice;
-import com.jamesmurty.utils.XMLBuilder;
-
-/**
- * Base class for writing vCloud Director REST api expect tests.
- */
-public abstract class BaseVCloudDirectorExpectTest<T> extends BaseRestApiExpectTest<T> {
-
- public BaseVCloudDirectorExpectTest() {
- provider = "vcloud-director";
- identity = String.format("%s@%s", user, org);
- credential = password;
- }
-
- public static final String user = "adrian@jclouds.org";
- public static final String org = "JClouds";
- public static final String password = "password";
- public static final String token = "mIaR3/6Lna8DWImd7/JPR5rK8FcUHabt+G/UCJV5pJQ=";
- public static final String endpoint = "https://vcloudbeta.bluelock.com/api";
-
- protected static DateService dateService;
-
- @BeforeGroups("unit")
- protected static void setupDateService() {
- dateService = Guice.createInjector().getInstance(DateService.class);
- assertNotNull(dateService);
- }
-
- @Override
- public Properties setupProperties() {
- Properties props = new Properties();
- props.put(Constants.PROPERTY_MAX_RETRIES, 1);
- props.put(Constants.PROPERTY_ENDPOINT, endpoint);
- return props;
- }
-
- @Override
- public HttpRequestComparisonType compareHttpRequestAsType(HttpRequest input) {
- if (input.getPayload() == null || input.getPayload().getContentMetadata().getContentLength() == 0) {
- return HttpRequestComparisonType.DEFAULT;
- }
- return HttpRequestComparisonType.XML;
- }
-
- protected HttpRequest loginRequest = HttpRequest.builder().method("POST")
- .endpoint(endpoint + "/sessions")
- .addHeader("Accept", "*/*")
- .addHeader("Authorization", "Basic YWRyaWFuQGpjbG91ZHMub3JnQEpDbG91ZHM6cGFzc3dvcmQ=")
- .build();
-
- protected HttpResponse sessionResponse = HttpResponse.builder()
- .statusCode(200)
- .headers(ImmutableMultimap.<String, String> builder()
- .put("x-vcloud-authorization", token)
- .put("Set-Cookie", String.format("vcloud-token=%s; Secure; Path=/", token))
- .build())
- .payload(payloadFromResourceWithContentType("/session.xml", VCloudDirectorMediaType.SESSION + ";version=1.5"))
- .build();
-
- /**
- * Implicitly adds x-vcloud-authorization header with token.
- * Provides convenience methods for priming a HttpRequest.Builder for vCloud testing
- *
- */
- @Deprecated
- public class VcloudHttpRequestPrimer {
- private Multimap<String, String> headers = LinkedListMultimap.create();
- private HttpRequest.Builder<?> builder = HttpRequest.builder();
-
- public VcloudHttpRequestPrimer() {
- }
-
- public VcloudHttpRequestPrimer apiCommand(String method, String command) {
- builder.method(method).endpoint(endpoint + command);
- return this;
- }
-
- public VcloudHttpRequestPrimer xmlFilePayload(String relativeFilePath, String mediaType) {
- builder.payload(payloadFromResourceWithContentType(relativeFilePath, mediaType));
- return this;
- }
-
- public VcloudHttpRequestPrimer headers(Multimap<String, String> headers) {
- this.headers.putAll(ImmutableMultimap.copyOf(checkNotNull(headers, "headers")));
- return this;
- }
-
- public VcloudHttpRequestPrimer acceptAnyMedia() {
- return acceptMedia(VCloudDirectorMediaType.ANY);
- }
-
- public VcloudHttpRequestPrimer acceptMedia(String media) {
- return header("Accept", media);
- }
-
- public VcloudHttpRequestPrimer header(String name, String value) {
- headers.put(checkNotNull(name, "header.name"), checkNotNull(value, "header.value"));
- return this;
- }
-
- public HttpRequest.Builder<?> httpRequestBuilder() {
- header("x-vcloud-authorization", token);
- header(HttpHeaders.COOKIE, "vcloud-token=" + token);
- builder.headers(headers);
- return builder;
- }
- }
-
- @Deprecated
- protected class VcloudHttpResponsePrimer {
- private HttpResponse.Builder<?> builder = HttpResponse.builder().statusCode(200);
-
- public VcloudHttpResponsePrimer() {
- }
-
- public VcloudHttpResponsePrimer xmlFilePayload(String relativeFilePath, String mediaType) {
- builder.payload(payloadFromResourceWithContentType(relativeFilePath, mediaType));
- return this;
- }
- public HttpResponse.Builder<?> httpResponseBuilder() {
- return builder;
- }
- }
-
- protected static XMLBuilder createXMLBuilder(String root){
- try {
- return XMLBuilder.create(root);
- } catch (Exception e) {
- throw Throwables.propagate(e);
- }
- }
-
- protected static String asString(XMLBuilder in){
- try {
- return in.asString();
- } catch (Exception e) {
- throw Throwables.propagate(e);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/775b89fd/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/VCloudDirectorAdminApiExpectTest.java
----------------------------------------------------------------------
diff --git a/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/VCloudDirectorAdminApiExpectTest.java b/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/VCloudDirectorAdminApiExpectTest.java
deleted file mode 100644
index 2ebca57..0000000
--- a/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/VCloudDirectorAdminApiExpectTest.java
+++ /dev/null
@@ -1,47 +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.vcloud.director.v1_5.internal;
-
-import java.util.Properties;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.vcloud.director.v1_5.VCloudDirectorContext;
-import org.jclouds.vcloud.director.v1_5.admin.VCloudDirectorAdminApi;
-
-import com.google.common.base.Function;
-import com.google.inject.Module;
-
-public abstract class VCloudDirectorAdminApiExpectTest extends
- BaseVCloudDirectorExpectTest<VCloudDirectorAdminApi> implements
- Function<VCloudDirectorContext, VCloudDirectorAdminApi> {
-
- @Override
- public VCloudDirectorAdminApi createClient(Function<HttpRequest, HttpResponse> fn, Module module, Properties props) {
- return apply(createVCloudDirectorContext(fn, module, props));
- }
-
- @Override
- public VCloudDirectorAdminApi apply(VCloudDirectorContext input) {
- return input.getAdminContext().getApi();
- }
-
- private VCloudDirectorContext createVCloudDirectorContext(Function<HttpRequest, HttpResponse> fn, Module module,
- Properties props) {
- return createInjector(fn, module, props).getInstance(VCloudDirectorContext.class);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/775b89fd/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/login/SessionApiExpectTest.java
----------------------------------------------------------------------
diff --git a/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/login/SessionApiExpectTest.java b/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/login/SessionApiExpectTest.java
deleted file mode 100644
index 183e8cc..0000000
--- a/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/login/SessionApiExpectTest.java
+++ /dev/null
@@ -1,125 +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.vcloud.director.v1_5.login;
-
-import static org.testng.Assert.assertEquals;
-
-import java.net.URI;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.providers.AnonymousProviderMetadata;
-import org.jclouds.providers.ProviderMetadata;
-import org.jclouds.rest.internal.BaseRestApiExpectTest;
-import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
-import org.jclouds.vcloud.director.v1_5.domain.Link;
-import org.jclouds.vcloud.director.v1_5.domain.Session;
-import org.jclouds.vcloud.director.v1_5.domain.SessionWithToken;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableMultimap;
-
-/**
- *
- * Allows us to test a api via its side effects.
- */
-@Test(groups = "unit", testName = "SessionApiExpectTest")
-public class SessionApiExpectTest extends BaseRestApiExpectTest<SessionApi> {
- public static final String user = "adrian@jclouds.org";
- public static final String org = "JClouds";
- public static final Session SESSION = Session.builder().user(user).org(org).href(
- URI.create("https://vcloudbeta.bluelock.com/api/session/")).addLink(
- Link.builder().rel("down").type("application/vnd.vmware.vcloud.orgList+xml").href(
- URI.create("https://vcloudbeta.bluelock.com/api/org/")).build()).addLink(
- Link.builder().rel("down").type("application/vnd.vmware.admin.vcloud+xml").href(
- URI.create("https://vcloudbeta.bluelock.com/api/admin/")).build()).addLink(
- Link.builder().rel("down").type("application/vnd.vmware.vcloud.query.queryList+xml").href(
- URI.create("https://vcloudbeta.bluelock.com/api/query")).build()).addLink(
- Link.builder().rel("entityResolver").type("application/vnd.vmware.vcloud.entity+xml").href(
- URI.create("https://vcloudbeta.bluelock.com/api/entity/")).build()).build();
-
- public void testWhenResponseIs2xxLoginReturnsValidSession() {
- URI loginUrl = URI.create("https://vcloudbeta.bluelock.com/api/sessions");
-
- String token = "mIaR3/6Lna8DWImd7/JPR5rK8FcUHabt+G/UCJV5pJQ=";
-
- SessionApi api = requestSendsResponse(
-
- HttpRequest.builder().method("POST").endpoint(loginUrl).headers(
- ImmutableMultimap.<String, String> builder().put("Accept", "*/*").put("Authorization",
- "Basic YWRyaWFuQGpjbG91ZHMub3JnQEpDbG91ZHM6cGFzc3dvcmQ=").build()).build(),
-
- HttpResponse.builder().statusCode(200).headers(
- ImmutableMultimap.<String, String> builder().put("x-vcloud-authorization", token).put("Set-Cookie",
- String.format("vcloud-token=%s; Secure; Path=/", token)).build())
- .payload(
- payloadFromResourceWithContentType("/session.xml", VCloudDirectorMediaType.SESSION + ";version=1.5")).build()
-
- );
-
- assertEquals(api.loginUserInOrgWithPassword(loginUrl, user, org, "password"), SessionWithToken.builder()
- .session(SESSION)
-
- .token(token).build());
-
- }
-
- public void testWhenResponseIs2xxGetSessionReturnsValidSession() {
- URI sessionUrl = URI.create("https://vcloudbeta.bluelock.com/api/session");
-
- String token = "mIaR3/6Lna8DWImd7/JPR5rK8FcUHabt+G/UCJV5pJQ=";
-
- SessionApi api = requestSendsResponse(
-
- HttpRequest.builder().method("GET").endpoint(sessionUrl).headers(
- ImmutableMultimap.<String, String> builder().put("x-vcloud-authorization", token).put("Accept", "*/*")
- .build()).build(),
-
- HttpResponse.builder().statusCode(200)
- .payload(
- payloadFromResourceWithContentType("/session.xml", VCloudDirectorMediaType.SESSION + ";version=1.5")).build()
-
- );
-
- assertEquals(api.getSessionWithToken(sessionUrl, token), SESSION);
-
- }
-
- public void testLogoutWhenResponseIs2xx() {
- URI sessionUrl = URI.create("https://vcloudbeta.bluelock.com/api/session");
-
- String token = "mIaR3/6Lna8DWImd7/JPR5rK8FcUHabt+G/UCJV5pJQ=";
-
- SessionApi api = requestSendsResponse(
-
- HttpRequest.builder().method("DELETE").endpoint(sessionUrl).headers(
- ImmutableMultimap.<String, String> builder().put("x-vcloud-authorization", token).put("Accept", "*/*")
- .build()).build(),
-
- HttpResponse.builder().statusCode(204).build()
-
- );
-
- api.logoutSessionWithToken(sessionUrl, token);
-
- }
-
- @Override
- protected ProviderMetadata createProviderMetadata() {
- return AnonymousProviderMetadata.forApiOnEndpoint(SessionApi.class, "https://vcloudbeta.bluelock.com/api");
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/775b89fd/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/login/SessionApiLiveTest.java
----------------------------------------------------------------------
diff --git a/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/login/SessionApiLiveTest.java b/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/login/SessionApiLiveTest.java
deleted file mode 100644
index e59757d..0000000
--- a/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/login/SessionApiLiveTest.java
+++ /dev/null
@@ -1,103 +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.vcloud.director.v1_5.login;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-
-import java.net.URI;
-
-import org.jclouds.ContextBuilder;
-import org.jclouds.apis.BaseContextLiveTest;
-import org.jclouds.providers.AnonymousProviderMetadata;
-import org.jclouds.providers.ProviderMetadata;
-import org.jclouds.rest.ApiContext;
-import org.jclouds.vcloud.director.testng.FormatApiResultsListener;
-import org.jclouds.vcloud.director.v1_5.domain.SessionWithToken;
-import org.testng.annotations.BeforeGroups;
-import org.testng.annotations.Listeners;
-import org.testng.annotations.Test;
-
-import com.google.common.reflect.TypeToken;
-
-/**
- * Tests behavior of {@link SessionApi}. Note this class is tested completely independently of
- * {@link VCloudDirectorApi} as it is a dependency of the {@code vcloud-director} context working.
- */
-@Listeners(FormatApiResultsListener.class)
-@Test(groups = { "live", "user" }, testName = "SessionApiLiveTest")
-public class SessionApiLiveTest extends BaseContextLiveTest<ApiContext<SessionApi>> {
-
- public SessionApiLiveTest() {
- provider = "vcloud-director";
- }
-
- @Override
- @BeforeGroups(groups = { "live" })
- public void setupContext() {
- super.setupContext();
- // session api isn't typically exposed to the user, as it is implicit
- api = context.getApi();
- }
-
- private SessionApi api;
- private SessionWithToken sessionWithToken;
-
- @Test(description = "POST /sessions")
- public void testLogin() {
- String user = identity.substring(0, identity.lastIndexOf('@'));
- String org = identity.substring(identity.lastIndexOf('@') + 1);
- String password = credential;
-
- sessionWithToken = api.loginUserInOrgWithPassword(URI.create(endpoint + "/sessions"), user, org, password);
- assertEquals(sessionWithToken.getSession().getUser(), user);
- assertEquals(sessionWithToken.getSession().get(), org);
- assertTrue(sessionWithToken.getSession().getLinks().size() > 0);
- assertNotNull(sessionWithToken.getToken());
- }
-
- @Test(description = "GET /session", dependsOnMethods = "testLogin")
- public void testGetSession() {
- assertEquals(api.getSessionWithToken(sessionWithToken.getSession().getHref(), sessionWithToken.getToken()),
- sessionWithToken.getSession());
- }
-
- @Test(description = "DELETE /session", dependsOnMethods = "testGetSession")
- public void testLogout() {
- api.logoutSessionWithToken(sessionWithToken.getSession().getHref(), sessionWithToken.getToken());
- }
-
- @Override
- protected TypeToken<ApiContext<SessionApi>> contextType() {
- return new TypeToken<ApiContext<SessionApi>>() {
- };
- }
-
- @Override
- protected ProviderMetadata createProviderMetadata() {
- return AnonymousProviderMetadata.forApiOnEndpoint(SessionApi.class, endpoint);
- }
-
- @Override
- protected ContextBuilder newBuilder() {
- ProviderMetadata pm = createProviderMetadata();
- ContextBuilder builder = ContextBuilder.newBuilder(pm);
- return builder;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/775b89fd/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/predicates/LinkPredicatesTest.java
----------------------------------------------------------------------
diff --git a/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/predicates/LinkPredicatesTest.java b/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/predicates/LinkPredicatesTest.java
deleted file mode 100644
index ba4350c..0000000
--- a/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/predicates/LinkPredicatesTest.java
+++ /dev/null
@@ -1,58 +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.vcloud.director.v1_5.predicates;
-
-import static org.jclouds.vcloud.director.v1_5.predicates.LinkPredicates.relEquals;
-import static org.jclouds.vcloud.director.v1_5.predicates.LinkPredicates.typeEquals;
-
-import java.net.URI;
-
-import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
-import org.jclouds.vcloud.director.v1_5.domain.Link;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "LinkPredicatesTest")
-public class LinkPredicatesTest {
- Link ref = Link.builder().type("application/vnd.vmware.vcloud.media+xml").rel("add").href(
- URI.create("https://mycloud.greenhousedata.com/api/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/media"))
- .build();
-
- @Test
- public void testRelEqualsWhenEqual() {
- assert relEquals(Link.Rel.ADD).apply(ref);
- }
-
- @Test
- public void testRelEqualsWhenEqualString() {
- assert relEquals("add").apply(ref);
- }
-
- @Test
- public void testRelEqualsWhenNotEqual() {
- assert !relEquals("foo").apply(ref);
- }
-
- @Test
- public void testTypeEqualsWhenEqual() {
- assert typeEquals(VCloudDirectorMediaType.MEDIA).apply(ref);
- }
-
- @Test
- public void testTypeEqualsWhenNotEqual() {
- assert !typeEquals("foo").apply(ref);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/775b89fd/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/predicates/ReferencePredicatesTest.java
----------------------------------------------------------------------
diff --git a/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/predicates/ReferencePredicatesTest.java b/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/predicates/ReferencePredicatesTest.java
deleted file mode 100644
index efe4a16..0000000
--- a/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/predicates/ReferencePredicatesTest.java
+++ /dev/null
@@ -1,74 +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.vcloud.director.v1_5.predicates;
-
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-
-import java.net.URI;
-
-import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
-import org.jclouds.vcloud.director.v1_5.domain.Reference;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableSet;
-
-@Test(groups = "unit", testName = "ReferencePredicatesTest")
-public class ReferencePredicatesTest {
- Reference ref = Reference.builder().type("application/vnd.vmware.vcloud.catalogItem+xml").name("image").href(
- URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/67a469a1-aafe-4b5b-bb31-a6202ad8961f")).build();
-
- @Test
- public void testNameEqualsWhenEqual() {
- assertTrue(ReferencePredicates.<Reference> nameEquals("image").apply(ref));
- }
-
- @Test
- public void testNameEqualsWhenNotEqual() {
- assertFalse(ReferencePredicates.<Reference> nameEquals("foo").apply(ref));
- }
-
- @Test
- public void testNameStartsWithWhenStartsWith() {
- assertTrue(ReferencePredicates.<Reference> nameStartsWith("i").apply(ref));
- }
-
- @Test
- public void testNameStartsWithWhenNotStartsWith() {
- assertFalse(ReferencePredicates.<Reference> nameStartsWith("f").apply(ref));
- }
-
- @Test
- public void testNameInWhenIn() {
- assertTrue(ReferencePredicates.<Reference> nameIn(ImmutableSet.of("one", "two", "image")).apply(ref));
- }
-
- @Test
- public void testNameInWhenNotIn() {
- assertFalse(ReferencePredicates.<Reference> nameIn(ImmutableSet.of("one", "two", "foo")).apply(ref));
- }
-
- @Test
- public void testTypeEqualsWhenEqual() {
- assertTrue(ReferencePredicates.<Reference> typeEquals(VCloudDirectorMediaType.CATALOG_ITEM).apply(ref));
- }
-
- @Test
- public void testTypeEqualsWhenNotEqual() {
- assertFalse(ReferencePredicates.<Reference> typeEquals("foo").apply(ref));
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/775b89fd/vcloud-director/src/test/resources/catalog/adddCatalogItem.xml
----------------------------------------------------------------------
diff --git a/vcloud-director/src/test/resources/catalog/adddCatalogItem.xml b/vcloud-director/src/test/resources/catalog/adddCatalogItem.xml
deleted file mode 100644
index 39021f9..0000000
--- a/vcloud-director/src/test/resources/catalog/adddCatalogItem.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<CatalogItem xmlns="http://www.vmware.com/vcloud/v1.5" name="newCatalogItem" id="urn:vcloud:catalogitem:a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df" type="application/vnd.vmware.vcloud.catalogItem+xml" href="https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://vcloudbeta.bluelock.com/api/v1.5/schema/master.xsd">
- <Link rel="up" type="application/vnd.vmware.vcloud.catalog+xml" href="https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"/>
- <Link rel="down" type="application/vnd.vmware.vcloud.metadata+xml" href="https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df/metadata"/>
- <Link rel="edit" type="application/vnd.vmware.vcloud.catalogItem+xml" href="https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"/>
- <Link rel="remove" href="https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"/>
- <Description>New Catalog Item</Description>
- <Entity type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="ubuntu10" href="https://vcloudbeta.bluelock.com/api/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9"/>
-</CatalogItem>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/775b89fd/vcloud-director/src/test/resources/catalog/admin/addCatalog.xml
----------------------------------------------------------------------
diff --git a/vcloud-director/src/test/resources/catalog/admin/addCatalog.xml b/vcloud-director/src/test/resources/catalog/admin/addCatalog.xml
deleted file mode 100644
index 8c3c6d8..0000000
--- a/vcloud-director/src/test/resources/catalog/admin/addCatalog.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<AdminCatalog xmlns="http://www.vmware.com/vcloud/v1.5" name="Test Catalog" id="urn:vcloud:catalog:c56d9159-7838-446f-bb35-9ee12dfbbef3" type="application/vnd.vmware.admin.catalog+xml" href="https://vcloudbeta.bluelock.com/api/admin/catalog/c56d9159-7838-446f-bb35-9ee12dfbbef3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://vcloudbeta.bluelock.com/api/v1.5/schema/master.xsd">
- <Link rel="up" type="application/vnd.vmware.admin.organization+xml" href="https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"/>
- <Link rel="alternate" type="application/vnd.vmware.vcloud.catalog+xml" href="https://vcloudbeta.bluelock.com/api/catalog/c56d9159-7838-446f-bb35-9ee12dfbbef3"/>
- <Link rel="down" type="application/vnd.vmware.vcloud.owner+xml" href="https://vcloudbeta.bluelock.com/api/admin/catalog/c56d9159-7838-446f-bb35-9ee12dfbbef3/owner"/>
- <Link rel="add" type="application/vnd.vmware.vcloud.catalogItem+xml" href="https://vcloudbeta.bluelock.com/api/catalog/c56d9159-7838-446f-bb35-9ee12dfbbef3/catalogItems"/>
- <Link rel="edit" type="application/vnd.vmware.admin.catalog+xml" href="https://vcloudbeta.bluelock.com/api/admin/catalog/c56d9159-7838-446f-bb35-9ee12dfbbef3"/>
- <Link rel="remove" href="https://vcloudbeta.bluelock.com/api/admin/catalog/c56d9159-7838-446f-bb35-9ee12dfbbef3"/>
- <Link rel="down" type="application/vnd.vmware.vcloud.metadata+xml" href="https://vcloudbeta.bluelock.com/api/catalog/c56d9159-7838-446f-bb35-9ee12dfbbef3/metadata"/>
- <Description>created by testCreateCatalog()</Description>
- <Tasks>
- <Task status="running" startTime="2012-03-11T18:43:02.429-04:00" operationName="catalogCreateCatalog" operation="Creating Catalog Test Catalog(c56d9159-7838-446f-bb35-9ee12dfbbef3)" expiryTime="2012-06-09T18:43:02.429-04:00" name="task" id="urn:vcloud:task:20f556f9-9125-4090-9092-0da9f72bedf4" type="application/vnd.vmware.vcloud.task+xml" href="https://vcloudbeta.bluelock.com/api/task/20f556f9-9125-4090-9092-0da9f72bedf4">
- <Link rel="task:cancel" href="https://vcloudbeta.bluelock.com/api/task/20f556f9-9125-4090-9092-0da9f72bedf4/action/cancel"/>
- <Owner type="application/vnd.vmware.vcloud.catalog+xml" name="Test Catalog" href="https://vcloudbeta.bluelock.com/api/catalog/c56d9159-7838-446f-bb35-9ee12dfbbef3"/>
- <User type="application/vnd.vmware.admin.user+xml" name="dan@cloudsoftcorp.com" href="https://vcloudbeta.bluelock.com/api/admin/user/ae75edd2-12de-414c-8e85-e6ea10442c08"/>
- <Organization type="application/vnd.vmware.vcloud.org+xml" name="JClouds" href="https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"/>
- </Task>
- </Tasks>
- <CatalogItems/>
- <IsPublished>false</IsPublished>
-</AdminCatalog>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/775b89fd/vcloud-director/src/test/resources/catalog/admin/addCatalogSource.xml
----------------------------------------------------------------------
diff --git a/vcloud-director/src/test/resources/catalog/admin/addCatalogSource.xml b/vcloud-director/src/test/resources/catalog/admin/addCatalogSource.xml
deleted file mode 100644
index cf9639a..0000000
--- a/vcloud-director/src/test/resources/catalog/admin/addCatalogSource.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<AdminCatalog name="Test Catalog" xmlns="http://www.vmware.com/vcloud/v1.5">
- <Description>created by testCreateCatalog()</Description>
-</AdminCatalog>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/775b89fd/vcloud-director/src/test/resources/catalog/admin/catalog.xml
----------------------------------------------------------------------
diff --git a/vcloud-director/src/test/resources/catalog/admin/catalog.xml b/vcloud-director/src/test/resources/catalog/admin/catalog.xml
deleted file mode 100644
index e116661..0000000
--- a/vcloud-director/src/test/resources/catalog/admin/catalog.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<AdminCatalog xmlns="http://www.vmware.com/vcloud/v1.5" name="QunyingTestCatalog" id="urn:vcloud:catalog:7212e451-76e1-4631-b2de-ba1dfd8080e4" type="application/vnd.vmware.admin.catalog+xml" href="https://vcloudbeta.bluelock.com/api/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://vcloudbeta.bluelock.com/api/v1.5/schema/master.xsd">
- <Link rel="up" type="application/vnd.vmware.admin.organization+xml" href="https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"/>
- <Link rel="alternate" type="application/vnd.vmware.vcloud.catalog+xml" href="https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"/>
- <Link rel="down" type="application/vnd.vmware.vcloud.owner+xml" href="https://vcloudbeta.bluelock.com/api/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/owner"/>
- <Link rel="add" type="application/vnd.vmware.vcloud.catalogItem+xml" href="https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/catalogItems"/>
- <Link rel="edit" type="application/vnd.vmware.admin.catalog+xml" href="https://vcloudbeta.bluelock.com/api/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"/>
- <Link rel="remove" href="https://vcloudbeta.bluelock.com/api/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"/>
- <Link rel="down" type="application/vnd.vmware.vcloud.metadata+xml" href="https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/metadata"/>
- <Description>Testing</Description>
- <Owner type="application/vnd.vmware.vcloud.owner+xml">
- <User type="application/vnd.vmware.admin.user+xml" name="qunying.huang@enstratus.com" href="https://vcloudbeta.bluelock.com/api/admin/user/967d317c-4273-4a95-b8a4-bf63b78e9c69"/>
- </Owner>
- <CatalogItems>
- <CatalogItem type="application/vnd.vmware.vcloud.catalogItem+xml" name="image" href="https://vcloudbeta.bluelock.com/api/catalogItem/67a469a1-aafe-4b5b-bb31-a6202ad8961f"/>
- <CatalogItem type="application/vnd.vmware.vcloud.catalogItem+xml" name="ubuntu10" href="https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"/>
- <CatalogItem type="application/vnd.vmware.vcloud.catalogItem+xml" name="imageTesting" href="https://vcloudbeta.bluelock.com/api/catalogItem/a9e0afdb-a42b-4688-8409-2ac68cf22939"/>
- <CatalogItem type="application/vnd.vmware.vcloud.catalogItem+xml" name="TestCase" href="https://vcloudbeta.bluelock.com/api/catalogItem/f7598606-aea4-41d7-8f67-2090e28e7876"/>
- </CatalogItems>
- <IsPublished>false</IsPublished>
-</AdminCatalog>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/775b89fd/vcloud-director/src/test/resources/catalog/admin/editCatalog.xml
----------------------------------------------------------------------
diff --git a/vcloud-director/src/test/resources/catalog/admin/editCatalog.xml b/vcloud-director/src/test/resources/catalog/admin/editCatalog.xml
deleted file mode 100644
index 76cd19e..0000000
--- a/vcloud-director/src/test/resources/catalog/admin/editCatalog.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<AdminCatalog xmlns="http://www.vmware.com/vcloud/v1.5" name="new QunyingTestCatalog" id="urn:vcloud:catalog:7212e451-76e1-4631-b2de-ba1dfd8080e4" type="application/vnd.vmware.admin.catalog+xml" href="https://vcloudbeta.bluelock.com/api/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://vcloudbeta.bluelock.com/api/v1.5/schema/master.xsd">
- <Link rel="up" type="application/vnd.vmware.admin.organization+xml" href="https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"/>
- <Link rel="alternate" type="application/vnd.vmware.vcloud.catalog+xml" href="https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"/>
- <Link rel="down" type="application/vnd.vmware.vcloud.owner+xml" href="https://vcloudbeta.bluelock.com/api/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/owner"/>
- <Link rel="add" type="application/vnd.vmware.vcloud.catalogItem+xml" href="https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/catalogItems"/>
- <Link rel="edit" type="application/vnd.vmware.admin.catalog+xml" href="https://vcloudbeta.bluelock.com/api/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"/>
- <Link rel="remove" href="https://vcloudbeta.bluelock.com/api/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"/>
- <Link rel="down" type="application/vnd.vmware.vcloud.metadata+xml" href="https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/metadata"/>
- <Description>new Testing</Description>
- <Owner type="application/vnd.vmware.vcloud.owner+xml">
- <User type="application/vnd.vmware.admin.user+xml" name="qunying.huang@enstratus.com" href="https://vcloudbeta.bluelock.com/api/admin/user/967d317c-4273-4a95-b8a4-bf63b78e9c69"/>
- </Owner>
- <CatalogItems>
- <CatalogItem type="application/vnd.vmware.vcloud.catalogItem+xml" name="image" href="https://vcloudbeta.bluelock.com/api/catalogItem/67a469a1-aafe-4b5b-bb31-a6202ad8961f"/>
- <CatalogItem type="application/vnd.vmware.vcloud.catalogItem+xml" name="ubuntu10" href="https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"/>
- <CatalogItem type="application/vnd.vmware.vcloud.catalogItem+xml" name="imageTesting" href="https://vcloudbeta.bluelock.com/api/catalogItem/a9e0afdb-a42b-4688-8409-2ac68cf22939"/>
- <CatalogItem type="application/vnd.vmware.vcloud.catalogItem+xml" name="TestCase" href="https://vcloudbeta.bluelock.com/api/catalogItem/f7598606-aea4-41d7-8f67-2090e28e7876"/>
- </CatalogItems>
- <IsPublished>false</IsPublished>
-</AdminCatalog>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/775b89fd/vcloud-director/src/test/resources/catalog/admin/editCatalogSource.xml
----------------------------------------------------------------------
diff --git a/vcloud-director/src/test/resources/catalog/admin/editCatalogSource.xml b/vcloud-director/src/test/resources/catalog/admin/editCatalogSource.xml
deleted file mode 100644
index 01fe2ff..0000000
--- a/vcloud-director/src/test/resources/catalog/admin/editCatalogSource.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<AdminCatalog name="new QunyingTestCatalog" id="urn:vcloud:catalog:7212e451-76e1-4631-b2de-ba1dfd8080e4" type="application/vnd.vmware.admin.catalog+xml" href="https://vcloudbeta.bluelock.com/api/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4" xmlns="http://www.vmware.com/vcloud/v1.5">
- <Link rel="up" type="application/vnd.vmware.admin.organization+xml" href="https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"/>
- <Link rel="alternate" type="application/vnd.vmware.vcloud.catalog+xml" href="https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"/>
- <Link rel="down" type="application/vnd.vmware.vcloud.owner+xml" href="https://vcloudbeta.bluelock.com/api/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/owner"/>
- <Link rel="add" type="application/vnd.vmware.vcloud.catalogItem+xml" href="https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/catalogItems"/>
- <Link rel="edit" type="application/vnd.vmware.admin.catalog+xml" href="https://vcloudbeta.bluelock.com/api/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"/>
- <Link rel="remove" href="https://vcloudbeta.bluelock.com/api/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"/>
- <Link rel="down" type="application/vnd.vmware.vcloud.metadata+xml" href="https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/metadata"/>
- <Description>new Testing</Description>
- <Owner type="application/vnd.vmware.vcloud.owner+xml">
- <User type="application/vnd.vmware.admin.user+xml" name="qunying.huang@enstratus.com" href="https://vcloudbeta.bluelock.com/api/admin/user/967d317c-4273-4a95-b8a4-bf63b78e9c69"/>
- </Owner>
- <CatalogItems>
- <CatalogItem type="application/vnd.vmware.vcloud.catalogItem+xml" name="image" href="https://vcloudbeta.bluelock.com/api/catalogItem/67a469a1-aafe-4b5b-bb31-a6202ad8961f"/>
- <CatalogItem type="application/vnd.vmware.vcloud.catalogItem+xml" name="ubuntu10" href="https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"/>
- <CatalogItem type="application/vnd.vmware.vcloud.catalogItem+xml" name="imageTesting" href="https://vcloudbeta.bluelock.com/api/catalogItem/a9e0afdb-a42b-4688-8409-2ac68cf22939"/>
- <CatalogItem type="application/vnd.vmware.vcloud.catalogItem+xml" name="TestCase" href="https://vcloudbeta.bluelock.com/api/catalogItem/f7598606-aea4-41d7-8f67-2090e28e7876"/>
- </CatalogItems>
- <IsPublished>false</IsPublished>
-</AdminCatalog>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/775b89fd/vcloud-director/src/test/resources/catalog/admin/editOwnerSource.xml
----------------------------------------------------------------------
diff --git a/vcloud-director/src/test/resources/catalog/admin/editOwnerSource.xml b/vcloud-director/src/test/resources/catalog/admin/editOwnerSource.xml
deleted file mode 100644
index 04c2b7d..0000000
--- a/vcloud-director/src/test/resources/catalog/admin/editOwnerSource.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<Owner type="application/vnd.vmware.vcloud.owner+xml" xmlns="http://www.vmware.com/vcloud/v1.5">
- <User type="application/vnd.vmware.admin.user+xml" name="adk@cloudsoftcorp.com" href="https://vcloudbeta.bluelock.com/api/admin/user/e9eb1b29-0404-4c5e-8ef7-e584acc51da9"/>
-</Owner>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/775b89fd/vcloud-director/src/test/resources/catalog/admin/owner.xml
----------------------------------------------------------------------
diff --git a/vcloud-director/src/test/resources/catalog/admin/owner.xml b/vcloud-director/src/test/resources/catalog/admin/owner.xml
deleted file mode 100644
index ac4a908..0000000
--- a/vcloud-director/src/test/resources/catalog/admin/owner.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Owner xmlns="http://www.vmware.com/vcloud/v1.5" type="application/vnd.vmware.vcloud.owner+xml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://vcloudbeta.bluelock.com/api/v1.5/schema/master.xsd">
- <Link rel="up" type="application/vnd.vmware.vcloud.catalog+xml" href="https://vcloudbeta.bluelock.com/api/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"/>
- <Link rel="edit" type="application/vnd.vmware.vcloud.owner+xml" href="https://vcloudbeta.bluelock.com/api/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/owner"/>
- <User type="application/vnd.vmware.admin.user+xml" name="qunying.huang@enstratus.com" href="https://vcloudbeta.bluelock.com/api/admin/user/967d317c-4273-4a95-b8a4-bf63b78e9c69"/>
-</Owner>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/775b89fd/vcloud-director/src/test/resources/catalog/admin/publishCatalogParams.xml
----------------------------------------------------------------------
diff --git a/vcloud-director/src/test/resources/catalog/admin/publishCatalogParams.xml b/vcloud-director/src/test/resources/catalog/admin/publishCatalogParams.xml
deleted file mode 100644
index 3065fac..0000000
--- a/vcloud-director/src/test/resources/catalog/admin/publishCatalogParams.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<PublishCatalogParams xmlns="http://www.vmware.com/vcloud/v1.5">
- <IsPublished>true</IsPublished>
-</PublishCatalogParams>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/775b89fd/vcloud-director/src/test/resources/catalog/catalog.xml
----------------------------------------------------------------------
diff --git a/vcloud-director/src/test/resources/catalog/catalog.xml b/vcloud-director/src/test/resources/catalog/catalog.xml
deleted file mode 100644
index f7fe4d9..0000000
--- a/vcloud-director/src/test/resources/catalog/catalog.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Catalog xmlns="http://www.vmware.com/vcloud/v1.5" name="QunyingTestCatalog" id="urn:vcloud:catalog:7212e451-76e1-4631-b2de-ba1dfd8080e4" type="application/vnd.vmware.vcloud.catalog+xml" href="https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://vcloudbeta.bluelock.com/api/v1.5/schema/master.xsd">
- <Link rel="up" type="application/vnd.vmware.vcloud.org+xml" href="https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"/>
- <Link rel="add" type="application/vnd.vmware.vcloud.catalogItem+xml" href="https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/catalogItems"/>
- <Link rel="down" type="application/vnd.vmware.vcloud.metadata+xml" href="https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/metadata"/>
- <Description>Testing</Description>
- <CatalogItems>
- <CatalogItem type="application/vnd.vmware.vcloud.catalogItem+xml" name="ubuntu10" href="https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"/>
- <CatalogItem type="application/vnd.vmware.vcloud.catalogItem+xml" name="imageTesting" href="https://vcloudbeta.bluelock.com/api/catalogItem/a9e0afdb-a42b-4688-8409-2ac68cf22939"/>
- </CatalogItems>
- <IsPublished>false</IsPublished>
-</Catalog>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/775b89fd/vcloud-director/src/test/resources/catalog/catalogItem.xml
----------------------------------------------------------------------
diff --git a/vcloud-director/src/test/resources/catalog/catalogItem.xml b/vcloud-director/src/test/resources/catalog/catalogItem.xml
deleted file mode 100644
index 6157c73..0000000
--- a/vcloud-director/src/test/resources/catalog/catalogItem.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<CatalogItem name="ubuntu10" id="urn:vcloud:catalogitem:a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df" type="application/vnd.vmware.vcloud.catalogItem+xml" href="https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df" xmlns="http://www.vmware.com/vcloud/v1.5">
- <Link rel="up" type="application/vnd.vmware.vcloud.catalog+xml" href="https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"/>
- <Link rel="down" type="application/vnd.vmware.vcloud.metadata+xml" href="https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df/metadata"/>
- <Link rel="edit" type="application/vnd.vmware.vcloud.catalogItem+xml" href="https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"/>
- <Link rel="remove" href="https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"/>
- <Description>For testing</Description>
- <Entity type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="ubuntu10" href="https://vcloudbeta.bluelock.com/api/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9"/>
-</CatalogItem>
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/775b89fd/vcloud-director/src/test/resources/catalog/catalogItemMetadata.xml
----------------------------------------------------------------------
diff --git a/vcloud-director/src/test/resources/catalog/catalogItemMetadata.xml b/vcloud-director/src/test/resources/catalog/catalogItemMetadata.xml
deleted file mode 100644
index e642235..0000000
--- a/vcloud-director/src/test/resources/catalog/catalogItemMetadata.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Metadata xmlns="http://www.vmware.com/vcloud/v1.5" type="application/vnd.vmware.vcloud.metadata+xml" href="https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df/metadata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://vcloudbeta.bluelock.com/api/v1.5/schema/master.xsd">
- <Link rel="up" type="application/vnd.vmware.vcloud.catalogItem+xml" href="https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"/>
- <MetadataEntry xmlns="http://www.vmware.com/vcloud/v1.5" href="https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df/metadata/KEY" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://vcloudbeta.bluelock.com/api/v1.5/schema/master.xsd">
- <Link rel="up" type="application/vnd.vmware.vcloud.metadata+xml" href="https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df/metadata"/>
- <Key>KEY</Key>
- <Value>VALUE</Value>
- </MetadataEntry>
-</Metadata>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/775b89fd/vcloud-director/src/test/resources/catalog/catalogItemMetadataValue.xml
----------------------------------------------------------------------
diff --git a/vcloud-director/src/test/resources/catalog/catalogItemMetadataValue.xml b/vcloud-director/src/test/resources/catalog/catalogItemMetadataValue.xml
deleted file mode 100644
index 3c623ae..0000000
--- a/vcloud-director/src/test/resources/catalog/catalogItemMetadataValue.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<MetadataValue xmlns="http://www.vmware.com/vcloud/v1.5" href="https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df/metadata/KEY" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://vcloudbeta.bluelock.com/api/v1.5/schema/master.xsd">
- <Link rel="up" type="application/vnd.vmware.vcloud.metadata+xml" href="https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df/metadata"/>
- <Value>VALUE</Value>
-</MetadataValue>
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/775b89fd/vcloud-director/src/test/resources/catalog/catalogMetadata.xml
----------------------------------------------------------------------
diff --git a/vcloud-director/src/test/resources/catalog/catalogMetadata.xml b/vcloud-director/src/test/resources/catalog/catalogMetadata.xml
deleted file mode 100644
index 3db76a6..0000000
--- a/vcloud-director/src/test/resources/catalog/catalogMetadata.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Metadata xmlns="http://www.vmware.com/vcloud/v1.5" type="application/vnd.vmware.vcloud.metadata+xml" href="https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/metadata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://vcloudbeta.bluelock.com/api/v1.5/schema/master.xsd">
- <Link rel="up" type="application/vnd.vmware.vcloud.catalog+xml" href="https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"/>
- <MetadataEntry xmlns="http://www.vmware.com/vcloud/v1.5" href="https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/metadata/KEY" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://vcloudbeta.bluelock.com/api/v1.5/schema/master.xsd">
- <Link rel="up" type="application/vnd.vmware.vcloud.metadata+xml" href="https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/metadata"/>
- <Key>KEY</Key>
- <Value>VALUE</Value>
- </MetadataEntry>
-</Metadata>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/775b89fd/vcloud-director/src/test/resources/catalog/catalogMetadataValue.xml
----------------------------------------------------------------------
diff --git a/vcloud-director/src/test/resources/catalog/catalogMetadataValue.xml b/vcloud-director/src/test/resources/catalog/catalogMetadataValue.xml
deleted file mode 100644
index 6f7e446..0000000
--- a/vcloud-director/src/test/resources/catalog/catalogMetadataValue.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<MetadataValue xmlns="http://www.vmware.com/vcloud/v1.5" href="https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/metadata/KEY" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://vcloudbeta.bluelock.com/api/v1.5/schema/master.xsd">
- <Link rel="up" type="application/vnd.vmware.vcloud.metadata+xml" href="https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/metadata"/>
- <Value>VALUE</Value>
-</MetadataValue>
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/775b89fd/vcloud-director/src/test/resources/catalog/editCatalogItem.xml
----------------------------------------------------------------------
diff --git a/vcloud-director/src/test/resources/catalog/editCatalogItem.xml b/vcloud-director/src/test/resources/catalog/editCatalogItem.xml
deleted file mode 100644
index 6157c73..0000000
--- a/vcloud-director/src/test/resources/catalog/editCatalogItem.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<CatalogItem name="ubuntu10" id="urn:vcloud:catalogitem:a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df" type="application/vnd.vmware.vcloud.catalogItem+xml" href="https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df" xmlns="http://www.vmware.com/vcloud/v1.5">
- <Link rel="up" type="application/vnd.vmware.vcloud.catalog+xml" href="https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"/>
- <Link rel="down" type="application/vnd.vmware.vcloud.metadata+xml" href="https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df/metadata"/>
- <Link rel="edit" type="application/vnd.vmware.vcloud.catalogItem+xml" href="https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"/>
- <Link rel="remove" href="https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"/>
- <Description>For testing</Description>
- <Entity type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="ubuntu10" href="https://vcloudbeta.bluelock.com/api/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9"/>
-</CatalogItem>
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/775b89fd/vcloud-director/src/test/resources/catalog/mergeCatalogItemMetadata.xml
----------------------------------------------------------------------
diff --git a/vcloud-director/src/test/resources/catalog/mergeCatalogItemMetadata.xml b/vcloud-director/src/test/resources/catalog/mergeCatalogItemMetadata.xml
deleted file mode 100644
index 5f76b5f..0000000
--- a/vcloud-director/src/test/resources/catalog/mergeCatalogItemMetadata.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<Metadata xmlns="http://www.vmware.com/vcloud/v1.5">
- <MetadataEntry>
- <Key>KEY</Key>
- <Value>VALUE</Value>
- </MetadataEntry>
-</Metadata>