mirror of https://github.com/apache/jclouds.git
fixed tests to work with new testng version
This commit is contained in:
parent
931c7ca881
commit
528edcd7dd
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
|
* Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
*
|
*
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@ -16,7 +16,6 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jclouds.s3.filters;
|
package org.jclouds.s3.filters;
|
||||||
|
|
||||||
import static org.jclouds.Constants.PROPERTY_SESSION_INTERVAL;
|
import static org.jclouds.Constants.PROPERTY_SESSION_INTERVAL;
|
||||||
|
@ -61,13 +60,13 @@ public class RequestAuthorizeSignatureTest extends BaseS3AsyncClientTest {
|
||||||
*/
|
*/
|
||||||
@Test(threadPoolSize = 3, dataProvider = "dataProvider", timeOut = 10000)
|
@Test(threadPoolSize = 3, dataProvider = "dataProvider", timeOut = 10000)
|
||||||
void testIdempotent(HttpRequest request) {
|
void testIdempotent(HttpRequest request) {
|
||||||
filter.filter(request);
|
request = filter.filter(request);
|
||||||
String signature = request.getFirstHeaderOrNull(HttpHeaders.AUTHORIZATION);
|
String signature = request.getFirstHeaderOrNull(HttpHeaders.AUTHORIZATION);
|
||||||
String date = request.getFirstHeaderOrNull(HttpHeaders.DATE);
|
String date = request.getFirstHeaderOrNull(HttpHeaders.DATE);
|
||||||
int iterations = 1;
|
int iterations = 1;
|
||||||
while (request.getFirstHeaderOrNull(HttpHeaders.DATE).equals(date)) {
|
while (request.getFirstHeaderOrNull(HttpHeaders.DATE).equals(date)) {
|
||||||
date = request.getFirstHeaderOrNull(HttpHeaders.DATE);
|
date = request.getFirstHeaderOrNull(HttpHeaders.DATE);
|
||||||
filter.filter(request);
|
request = filter.filter(request);
|
||||||
if (request.getFirstHeaderOrNull(HttpHeaders.DATE).equals(date))
|
if (request.getFirstHeaderOrNull(HttpHeaders.DATE).equals(date))
|
||||||
assert signature.equals(request.getFirstHeaderOrNull(HttpHeaders.AUTHORIZATION)) : String.format(
|
assert signature.equals(request.getFirstHeaderOrNull(HttpHeaders.AUTHORIZATION)) : String.format(
|
||||||
"sig: %s != %s on attempt %s", signature, request.getFirstHeaderOrNull(HttpHeaders.AUTHORIZATION),
|
"sig: %s != %s on attempt %s", signature, request.getFirstHeaderOrNull(HttpHeaders.AUTHORIZATION),
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
|
* Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
*
|
*
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@ -16,7 +16,6 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jclouds.s3.xml;
|
package org.jclouds.s3.xml;
|
||||||
|
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
|
@ -24,22 +23,23 @@ import static org.testng.Assert.assertEquals;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
|
||||||
|
import org.jclouds.crypto.CryptoStreams;
|
||||||
|
import org.jclouds.date.DateService;
|
||||||
|
import org.jclouds.http.HttpException;
|
||||||
|
import org.jclouds.http.functions.BaseHandlerTest;
|
||||||
|
import org.jclouds.http.functions.ParseSax;
|
||||||
import org.jclouds.s3.domain.CanonicalUser;
|
import org.jclouds.s3.domain.CanonicalUser;
|
||||||
import org.jclouds.s3.domain.ListBucketResponse;
|
import org.jclouds.s3.domain.ListBucketResponse;
|
||||||
import org.jclouds.s3.domain.ObjectMetadata;
|
import org.jclouds.s3.domain.ObjectMetadata;
|
||||||
import org.jclouds.s3.domain.ObjectMetadata.StorageClass;
|
import org.jclouds.s3.domain.ObjectMetadata.StorageClass;
|
||||||
import org.jclouds.s3.domain.internal.BucketListObjectMetadata;
|
import org.jclouds.s3.domain.internal.BucketListObjectMetadata;
|
||||||
import org.jclouds.s3.domain.internal.ListBucketResponseImpl;
|
import org.jclouds.s3.domain.internal.ListBucketResponseImpl;
|
||||||
import org.jclouds.crypto.CryptoStreams;
|
|
||||||
import org.jclouds.date.DateService;
|
|
||||||
import org.jclouds.http.HttpException;
|
|
||||||
import org.jclouds.http.functions.BaseHandlerTest;
|
|
||||||
import org.jclouds.http.functions.ParseSax;
|
|
||||||
import org.jclouds.util.Strings2;
|
import org.jclouds.util.Strings2;
|
||||||
import org.testng.annotations.BeforeTest;
|
import org.testng.annotations.BeforeTest;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests behavior of {@code ListBucketHandler}
|
* Tests behavior of {@code ListBucketHandler}
|
||||||
|
@ -102,7 +102,7 @@ public class ListBucketHandlerTest extends BaseHandlerTest {
|
||||||
ListBucketResponse result = (ListBucketResponse) factory.create(injector.getInstance(ListBucketHandler.class))
|
ListBucketResponse result = (ListBucketResponse) factory.create(injector.getInstance(ListBucketHandler.class))
|
||||||
.parse(is);
|
.parse(is);
|
||||||
|
|
||||||
assertEquals(result, expected);
|
assertEquals(ImmutableSet.copyOf(result).toString(), ImmutableSet.copyOf(expected).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
ParseSax<ListBucketResponse> createParser() {
|
ParseSax<ListBucketResponse> createParser() {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
|
* Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
*
|
*
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@ -16,7 +16,6 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jclouds.openstack.swift.domain.internal;
|
package org.jclouds.openstack.swift.domain.internal;
|
||||||
|
|
||||||
import static org.easymock.EasyMock.expect;
|
import static org.easymock.EasyMock.expect;
|
||||||
|
@ -25,7 +24,6 @@ import static org.easymock.classextension.EasyMock.replay;
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.jclouds.crypto.CryptoStreams;
|
import org.jclouds.crypto.CryptoStreams;
|
||||||
import org.jclouds.date.internal.SimpleDateFormatDateService;
|
import org.jclouds.date.internal.SimpleDateFormatDateService;
|
||||||
|
@ -39,7 +37,8 @@ import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
import com.google.common.collect.ImmutableSet.Builder;
|
||||||
import com.google.inject.AbstractModule;
|
import com.google.inject.AbstractModule;
|
||||||
import com.google.inject.Guice;
|
import com.google.inject.Guice;
|
||||||
import com.google.inject.Injector;
|
import com.google.inject.Injector;
|
||||||
|
@ -63,7 +62,7 @@ public class ParseObjectInfoListFromJsonResponseTest {
|
||||||
|
|
||||||
public void testApplyInputStream() {
|
public void testApplyInputStream() {
|
||||||
InputStream is = getClass().getResourceAsStream("/test_list_container.json");
|
InputStream is = getClass().getResourceAsStream("/test_list_container.json");
|
||||||
Set<ObjectInfo> expects = Sets.newLinkedHashSet();
|
Builder<ObjectInfo> expects = ImmutableSet.<ObjectInfo>builder();
|
||||||
ObjectInfoImpl one = i.getInstance(ObjectInfoImpl.class);
|
ObjectInfoImpl one = i.getInstance(ObjectInfoImpl.class);
|
||||||
one.name = "test_obj_1";
|
one.name = "test_obj_1";
|
||||||
one.hash = CryptoStreams.hex("4281c348eaf83e70ddce0e07221c3d28");
|
one.hash = CryptoStreams.hex("4281c348eaf83e70ddce0e07221c3d28");
|
||||||
|
@ -85,6 +84,6 @@ public class ParseObjectInfoListFromJsonResponseTest {
|
||||||
replay(request);
|
replay(request);
|
||||||
ParseObjectInfoListFromJsonResponse parser = i.getInstance(ParseObjectInfoListFromJsonResponse.class);
|
ParseObjectInfoListFromJsonResponse parser = i.getInstance(ParseObjectInfoListFromJsonResponse.class);
|
||||||
parser.setContext(request);
|
parser.setContext(request);
|
||||||
assertEquals(parser.apply(is), expects);
|
assertEquals(ImmutableSet.copyOf(parser.apply(is)), expects.build());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
|
* Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
*
|
*
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@ -16,7 +16,6 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jclouds;
|
package org.jclouds;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -40,7 +39,7 @@ import org.testng.annotations.Test;
|
||||||
@Test(groups="performance")
|
@Test(groups="performance")
|
||||||
public abstract class PerformanceTest {
|
public abstract class PerformanceTest {
|
||||||
protected static int LOOP_COUNT = 1000;
|
protected static int LOOP_COUNT = 1000;
|
||||||
protected static int THREAD_COUNT = 1000;
|
protected static int THREAD_COUNT = 100;
|
||||||
protected ExecutorService exec;
|
protected ExecutorService exec;
|
||||||
|
|
||||||
@BeforeTest
|
@BeforeTest
|
||||||
|
|
|
@ -25,11 +25,11 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.jclouds</groupId>
|
<groupId>org.jclouds</groupId>
|
||||||
<artifactId>jclouds-project</artifactId>
|
<artifactId>jclouds-project</artifactId>
|
||||||
<version>1.0-beta-9b-SNAPSHOT</version>
|
<version>1.0-beta-9c-SNAPSHOT</version>
|
||||||
<relativePath>../../project/pom.xml</relativePath>
|
<relativePath>../../project/pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<groupId>org.jclouds.examples</groupId>
|
<groupId>org.jclouds.examples</groupId>
|
||||||
<version>1.0-beta-9b-SNAPSHOT</version>
|
<version>1.0-beta-9c-SNAPSHOT</version>
|
||||||
<artifactId>jclouds-googleappengine-example</artifactId>
|
<artifactId>jclouds-googleappengine-example</artifactId>
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
<name>JClouds Sample for Google App Engine</name>
|
<name>JClouds Sample for Google App Engine</name>
|
||||||
|
|
Loading…
Reference in New Issue