mirror of https://github.com/apache/jclouds.git
clarified initial Expect test
This commit is contained in:
parent
7e8baf4f02
commit
3574dededb
|
@ -18,11 +18,11 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.cloudstack.features;
|
package org.jclouds.cloudstack.features;
|
||||||
|
|
||||||
|
import static org.testng.Assert.assertEquals;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.Set;
|
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.Account;
|
||||||
import org.jclouds.cloudstack.domain.User;
|
import org.jclouds.cloudstack.domain.User;
|
||||||
import org.jclouds.date.internal.SimpleDateFormatDateService;
|
import org.jclouds.date.internal.SimpleDateFormatDateService;
|
||||||
|
@ -31,8 +31,7 @@ import org.jclouds.http.HttpResponse;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMultimap;
|
import com.google.common.collect.ImmutableMultimap;
|
||||||
|
import com.google.common.collect.ImmutableSet;
|
||||||
import static org.testng.Assert.assertEquals;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test the CloudStack AccountClient
|
* Test the CloudStack AccountClient
|
||||||
|
@ -40,7 +39,8 @@ import static org.testng.Assert.assertEquals;
|
||||||
* @author Andrei Savu
|
* @author Andrei Savu
|
||||||
*/
|
*/
|
||||||
@Test(groups = "unit", testName = "AccountClientExpectTest")
|
@Test(groups = "unit", testName = "AccountClientExpectTest")
|
||||||
public class AccountClientExpectTest extends BaseCloudStackRestClientExpectTest<CloudStackClient> {
|
public class AccountClientExpectTest extends BaseCloudStackRestClientExpectTest {
|
||||||
|
|
||||||
|
|
||||||
public void testListAccountsWhenResponseIs2xx() {
|
public void testListAccountsWhenResponseIs2xx() {
|
||||||
|
|
||||||
|
@ -48,11 +48,10 @@ public class AccountClientExpectTest extends BaseCloudStackRestClientExpectTest<
|
||||||
HttpRequest.builder()
|
HttpRequest.builder()
|
||||||
.method("GET")
|
.method("GET")
|
||||||
.endpoint(
|
.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(
|
.headers(
|
||||||
ImmutableMultimap.<String, String>builder()
|
ImmutableMultimap.<String, String>builder()
|
||||||
.put("Accept", "application/json")
|
.put("Accept", "application/json")
|
||||||
.put("Authorization", "Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==")
|
|
||||||
.build())
|
.build())
|
||||||
.build(),
|
.build(),
|
||||||
HttpResponse.builder()
|
HttpResponse.builder()
|
||||||
|
|
|
@ -18,36 +18,18 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.cloudstack.features;
|
package org.jclouds.cloudstack.features;
|
||||||
|
|
||||||
import org.jclouds.cloudstack.CloudStackContextBuilder;
|
import org.jclouds.cloudstack.CloudStackClient;
|
||||||
import org.jclouds.cloudstack.CloudStackPropertiesBuilder;
|
|
||||||
import org.jclouds.rest.BaseRestClientExpectTest;
|
import org.jclouds.rest.BaseRestClientExpectTest;
|
||||||
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for writing CloudStack Rest Client Expect tests
|
* Base class for writing CloudStack Rest Client Expect tests
|
||||||
*
|
*
|
||||||
* @author Andrei Savu
|
* @author Andrei Savu
|
||||||
*/
|
*/
|
||||||
public class BaseCloudStackRestClientExpectTest<S> extends BaseRestClientExpectTest<S> {
|
public class BaseCloudStackRestClientExpectTest extends BaseRestClientExpectTest<CloudStackClient> {
|
||||||
|
|
||||||
public BaseCloudStackRestClientExpectTest() {
|
public BaseCloudStackRestClientExpectTest() {
|
||||||
provider = "cloudstack";
|
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue