updated archaetypes to include Alex's fixes

git-svn-id: http://jclouds.googlecode.com/svn/trunk@2739 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
adrian.f.cole 2010-01-31 22:23:48 +00:00
parent 2b3d2b0c48
commit 333b576610
9 changed files with 38 additions and 28 deletions

View File

@ -45,7 +45,7 @@
package ${package};
import java.util.SortedSet;
import java.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListenableFuture;
import javax.ws.rs.GET;
import javax.ws.rs.Path;

View File

@ -53,14 +53,12 @@ import static ${package}.reference.${clientName}Constants.PROPERTY_${ucaseClient
import java.net.URI;
import java.util.Properties;
import org.jclouds.http.HttpPropertiesBuilder;
/**
* Builds properties used in ${clientName} Clients
*
* @author ${author}
*/
public class ${clientName}PropertiesBuilder extends HttpPropertiesBuilder {
public class ${clientName}PropertiesBuilder extends PropertiesBuilder {
@Override
protected Properties defaultProperties() {
Properties properties = super.defaultProperties();

View File

@ -47,8 +47,9 @@ import java.net.URI;
import javax.inject.Named;
import javax.inject.Singleton;
import org.jclouds.http.functions.config.ParserModule.CDateTimeAdapter;
import org.jclouds.http.functions.config.ParserModule.DateTimeAdapter;
import org.jclouds.http.functions.config.ParserModule.CDateAdapter;
import org.jclouds.http.functions.config.ParserModule.DateAdapter;
import org.jclouds.http.functions.config.ParserModule;
import org.jclouds.lifecycle.Closer;
import org.jclouds.rest.RestContext;
import org.jclouds.rest.internal.RestContextImpl;
@ -68,7 +69,7 @@ import com.google.inject.Provides;
public class ${clientName}ContextModule extends AbstractModule {
@Override
protected void configure() {
bind(DateTimeAdapter.class).to(CDateTimeAdapter.class);
bind(DateAdapter.class).to(CDateAdapter.class);
}
@Provides

View File

@ -53,7 +53,7 @@ import org.jclouds.http.RequiresHttp;
import org.jclouds.http.filters.BasicAuthentication;
import org.jclouds.rest.ConfiguresRestClient;
import org.jclouds.rest.RestClientFactory;
import org.jclouds.util.EncryptionService;
import org.jclouds.encryption.EncryptionService;
import ${package}.${clientName};
import ${package}.${clientName}Client;

View File

@ -20,7 +20,7 @@
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
/**
*
*Date
* Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
*
* ====================================================================
@ -44,7 +44,7 @@
*/
package ${package}.domain;
import org.joda.time.DateTime;
import java.util.Date;
import com.google.gson.annotations.SerializedName;
@ -55,7 +55,7 @@ import com.google.gson.annotations.SerializedName;
*/
public class Status implements Comparable<Status> {
@SerializedName("created_at")
private DateTime createdAt;
private Date createdAt;
private boolean favorited;
private String geo;
private long id;
@ -73,7 +73,7 @@ public class Status implements Comparable<Status> {
public Status() {
}
public Status(DateTime createdAt, boolean favorited, String geo, long id,
public Status(Date createdAt, boolean favorited, String geo, long id,
String inReplyToScreenName, Integer inReplyToStatusId, Integer inReplyToUserId,
String source, String text, boolean truncated, User user) {
this.createdAt = createdAt;
@ -129,11 +129,11 @@ public class Status implements Comparable<Status> {
return true;
}
public DateTime getCreatedAt() {
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(DateTime createdAt) {
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}

View File

@ -46,7 +46,7 @@ package ${package}.domain;
import java.net.URI;
import org.joda.time.DateTime;
import java.util.Date;
import com.google.gson.annotations.SerializedName;
@ -56,7 +56,7 @@ import com.google.gson.annotations.SerializedName;
*/
public class User implements Comparable<User> {
@SerializedName("created_at")
private DateTime createdAt;
private Date createdAt;
private String description;
@SerializedName("favourites_count")
private int favouritesCount;
@ -104,7 +104,7 @@ public class User implements Comparable<User> {
}
public User(DateTime createdAt, String description, int favouritesCount, int followersCount,
public User(Date createdAt, String description, int favouritesCount, int followersCount,
boolean following, int friendsCount, boolean geoEnabled, long id, String location,
String name, boolean notifications, String profileBackgroundColor,
URI profileBackgroundImageUrl, boolean profileBackgroundTile, URI profileImageUrl,
@ -294,11 +294,11 @@ public class User implements Comparable<User> {
this.friendsCount = friendsCount;
}
public DateTime getCreatedAt() {
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(DateTime createdAt) {
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}

View File

@ -61,6 +61,7 @@ import org.jclouds.rest.RestClientTest;
import org.jclouds.rest.internal.GeneratedHttpRequest;
import org.jclouds.rest.internal.RestAnnotationProcessor;
import ${package}.functions.ParseStatusesFromJsonResponse;
import org.jclouds.encryption.EncryptionService;
import org.testng.annotations.Test;
import com.google.inject.AbstractModule;

View File

@ -47,14 +47,14 @@
package ${package}.config;
import static org.testng.Assert.assertEquals;
import static com.google.common.util.concurrent.Executors.sameThreadExecutor;
import org.jclouds.concurrent.WithinThreadExecutorService;
import org.jclouds.concurrent.config.ExecutorServiceModule;
import org.jclouds.http.HttpRetryHandler;
import org.jclouds.http.config.JavaUrlHttpCommandExecutorServiceModule;
import org.jclouds.http.functions.config.ParserModule;
import org.jclouds.http.functions.config.ParserModule.CDateTimeAdapter;
import org.jclouds.http.functions.config.ParserModule.DateTimeAdapter;
import org.jclouds.http.functions.config.ParserModule.CDateAdapter;
import org.jclouds.http.functions.config.ParserModule.DateAdapter;
import org.jclouds.http.handlers.CloseContentAndSetExceptionErrorHandler;
import org.jclouds.http.handlers.DelegatingErrorHandler;
import org.jclouds.http.handlers.DelegatingRetryHandler;
@ -63,6 +63,7 @@ import org.jclouds.logging.Logger;
import org.jclouds.logging.Logger.LoggerFactory;
import ${package}.reference.${clientName}Constants;
import org.jclouds.util.Jsr330;
import org.jclouds.Constants;
import org.testng.annotations.Test;
import com.google.inject.Guice;
@ -84,6 +85,14 @@ public class ${clientName}ContextModuleTest {
.to("password");
bindConstant().annotatedWith(Jsr330.named(${clientName}Constants.PROPERTY_${ucaseClientName}_ENDPOINT))
.to("http://localhost");
bindConstant().annotatedWith(Jsr330.named(Constants.PROPERTY_MAX_CONNECTIONS_PER_HOST))
.to("1");
bindConstant().annotatedWith(Jsr330.named(Constants.PROPERTY_MAX_CONNECTIONS_PER_CONTEXT))
.to("0");
bindConstant().annotatedWith(Jsr330.named(Constants.PROPERTY_IO_WORKER_THREADS))
.to("1");
bindConstant().annotatedWith(Jsr330.named(Constants.PROPERTY_USER_THREADS))
.to("1");
bind(Logger.LoggerFactory.class).toInstance(new LoggerFactory() {
public Logger getLogger(String category) {
return Logger.NULL;
@ -92,7 +101,7 @@ public class ${clientName}ContextModuleTest {
super.configure();
}
}, new ParserModule(), new JavaUrlHttpCommandExecutorServiceModule(),
new ExecutorServiceModule(Executors.sameThreadExecutor()));
new ExecutorServiceModule(sameThreadExecutor(), sameThreadExecutor()));
}
@Test
@ -104,8 +113,8 @@ public class ${clientName}ContextModuleTest {
@Test
void testDateTimeAdapter() {
assertEquals(this.createInjector().getInstance(DateTimeAdapter.class).getClass(),
CDateTimeAdapter.class);
assertEquals(this.createInjector().getInstance(DateAdapter.class).getClass(),
CDateAdapter.class);
}
@Test

View File

@ -54,7 +54,8 @@ import java.util.SortedSet;
import org.jclouds.http.functions.config.ParserModule;
import ${package}.domain.Status;
import ${package}.domain.User;
import org.jclouds.util.DateService;
import org.jclouds.date.DateService;
import org.jclouds.date.internal.SimpleDateFormatDateService;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableSortedSet;
@ -73,11 +74,11 @@ public class ParseStatusesFromJsonResponseTest {
Injector i = Guice.createInjector(new ParserModule() {
@Override
protected void configure() {
bind(DateTimeAdapter.class).to(CDateTimeAdapter.class);
bind(DateAdapter.class).to(CDateAdapter.class);
super.configure();
}
});
DateService dateService = new DateService();
DateService dateService = new SimpleDateFormatDateService();
public void testApplyInputStreamDetails() throws UnknownHostException {
InputStream is = getClass().getResourceAsStream("/test_mentions.json");