From 3574dededbf50b36695c3fac5ca0d8066e8aae18 Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Fri, 6 Jan 2012 15:36:03 -0800 Subject: [PATCH] clarified initial Expect test --- .../features/AccountClientExpectTest.java | 13 +++++------ .../BaseCloudStackRestClientExpectTest.java | 22 ++----------------- 2 files changed, 8 insertions(+), 27 deletions(-) diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/AccountClientExpectTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/AccountClientExpectTest.java index dd27d7f742..07e7a4ddfb 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/AccountClientExpectTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/AccountClientExpectTest.java @@ -18,11 +18,11 @@ */ package org.jclouds.cloudstack.features; +import static org.testng.Assert.assertEquals; + import java.net.URI; import java.util.Set; -import com.google.common.collect.ImmutableSet; -import org.jclouds.cloudstack.CloudStackClient; import org.jclouds.cloudstack.domain.Account; import org.jclouds.cloudstack.domain.User; import org.jclouds.date.internal.SimpleDateFormatDateService; @@ -31,8 +31,7 @@ import org.jclouds.http.HttpResponse; import org.testng.annotations.Test; import com.google.common.collect.ImmutableMultimap; - -import static org.testng.Assert.assertEquals; +import com.google.common.collect.ImmutableSet; /** * Test the CloudStack AccountClient @@ -40,7 +39,8 @@ import static org.testng.Assert.assertEquals; * @author Andrei Savu */ @Test(groups = "unit", testName = "AccountClientExpectTest") -public class AccountClientExpectTest extends BaseCloudStackRestClientExpectTest { +public class AccountClientExpectTest extends BaseCloudStackRestClientExpectTest { + public void testListAccountsWhenResponseIs2xx() { @@ -48,11 +48,10 @@ public class AccountClientExpectTest extends BaseCloudStackRestClientExpectTest< HttpRequest.builder() .method("GET") .endpoint( - URI.create("http://localhost:8080/client/api?response=json&command=listAccounts")) + URI.create("http://localhost:8080/client/api?response=json&command=listAccounts&apiKey=identity&signature=maSZcp9ivkL7osVh87qxlrYbZC8%3D")) .headers( ImmutableMultimap.builder() .put("Accept", "application/json") - .put("Authorization", "Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==") .build()) .build(), HttpResponse.builder() diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/BaseCloudStackRestClientExpectTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/BaseCloudStackRestClientExpectTest.java index 87803a1cb0..4a27dcd61a 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/BaseCloudStackRestClientExpectTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/BaseCloudStackRestClientExpectTest.java @@ -18,36 +18,18 @@ */ package org.jclouds.cloudstack.features; -import org.jclouds.cloudstack.CloudStackContextBuilder; -import org.jclouds.cloudstack.CloudStackPropertiesBuilder; +import org.jclouds.cloudstack.CloudStackClient; import org.jclouds.rest.BaseRestClientExpectTest; -import java.util.Properties; - /** * Base class for writing CloudStack Rest Client Expect tests * * @author Andrei Savu */ -public class BaseCloudStackRestClientExpectTest extends BaseRestClientExpectTest { +public class BaseCloudStackRestClientExpectTest extends BaseRestClientExpectTest { public BaseCloudStackRestClientExpectTest() { provider = "cloudstack"; } - @Override - public Properties setupRestProperties() { - Properties overrides = new Properties(); - overrides.put("cloudstack.contextbuilder", CloudStackContextBuilder.class.getName()); - overrides.put("cloudstack.propertiesbuilder", CloudStackPropertiesBuilder.class.getName()); - return overrides; - } - - @Override - public Properties setupProperties() { - Properties overrides = new Properties(); - overrides.put("jclouds.endpoint", "http://localhost:8080/client/api"); - return overrides; - } - }