mirror of https://github.com/apache/jclouds.git
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:
parent
2b3d2b0c48
commit
333b576610
|
@ -45,7 +45,7 @@
|
||||||
package ${package};
|
package ${package};
|
||||||
|
|
||||||
import java.util.SortedSet;
|
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.GET;
|
||||||
import javax.ws.rs.Path;
|
import javax.ws.rs.Path;
|
||||||
|
|
|
@ -53,14 +53,12 @@ import static ${package}.reference.${clientName}Constants.PROPERTY_${ucaseClient
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.jclouds.http.HttpPropertiesBuilder;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds properties used in ${clientName} Clients
|
* Builds properties used in ${clientName} Clients
|
||||||
*
|
*
|
||||||
* @author ${author}
|
* @author ${author}
|
||||||
*/
|
*/
|
||||||
public class ${clientName}PropertiesBuilder extends HttpPropertiesBuilder {
|
public class ${clientName}PropertiesBuilder extends PropertiesBuilder {
|
||||||
@Override
|
@Override
|
||||||
protected Properties defaultProperties() {
|
protected Properties defaultProperties() {
|
||||||
Properties properties = super.defaultProperties();
|
Properties properties = super.defaultProperties();
|
||||||
|
|
|
@ -47,8 +47,9 @@ import java.net.URI;
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.http.functions.config.ParserModule.CDateTimeAdapter;
|
import org.jclouds.http.functions.config.ParserModule.CDateAdapter;
|
||||||
import org.jclouds.http.functions.config.ParserModule.DateTimeAdapter;
|
import org.jclouds.http.functions.config.ParserModule.DateAdapter;
|
||||||
|
import org.jclouds.http.functions.config.ParserModule;
|
||||||
import org.jclouds.lifecycle.Closer;
|
import org.jclouds.lifecycle.Closer;
|
||||||
import org.jclouds.rest.RestContext;
|
import org.jclouds.rest.RestContext;
|
||||||
import org.jclouds.rest.internal.RestContextImpl;
|
import org.jclouds.rest.internal.RestContextImpl;
|
||||||
|
@ -68,7 +69,7 @@ import com.google.inject.Provides;
|
||||||
public class ${clientName}ContextModule extends AbstractModule {
|
public class ${clientName}ContextModule extends AbstractModule {
|
||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
bind(DateTimeAdapter.class).to(CDateTimeAdapter.class);
|
bind(DateAdapter.class).to(CDateAdapter.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
|
|
|
@ -53,7 +53,7 @@ import org.jclouds.http.RequiresHttp;
|
||||||
import org.jclouds.http.filters.BasicAuthentication;
|
import org.jclouds.http.filters.BasicAuthentication;
|
||||||
import org.jclouds.rest.ConfiguresRestClient;
|
import org.jclouds.rest.ConfiguresRestClient;
|
||||||
import org.jclouds.rest.RestClientFactory;
|
import org.jclouds.rest.RestClientFactory;
|
||||||
import org.jclouds.util.EncryptionService;
|
import org.jclouds.encryption.EncryptionService;
|
||||||
|
|
||||||
import ${package}.${clientName};
|
import ${package}.${clientName};
|
||||||
import ${package}.${clientName}Client;
|
import ${package}.${clientName}Client;
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#set( $symbol_dollar = '$' )
|
#set( $symbol_dollar = '$' )
|
||||||
#set( $symbol_escape = '\' )
|
#set( $symbol_escape = '\' )
|
||||||
/**
|
/**
|
||||||
*
|
*Date
|
||||||
* Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
|
* Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
*
|
*
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
|
@ -44,7 +44,7 @@
|
||||||
*/
|
*/
|
||||||
package ${package}.domain;
|
package ${package}.domain;
|
||||||
|
|
||||||
import org.joda.time.DateTime;
|
import java.util.Date;
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ import com.google.gson.annotations.SerializedName;
|
||||||
*/
|
*/
|
||||||
public class Status implements Comparable<Status> {
|
public class Status implements Comparable<Status> {
|
||||||
@SerializedName("created_at")
|
@SerializedName("created_at")
|
||||||
private DateTime createdAt;
|
private Date createdAt;
|
||||||
private boolean favorited;
|
private boolean favorited;
|
||||||
private String geo;
|
private String geo;
|
||||||
private long id;
|
private long id;
|
||||||
|
@ -73,7 +73,7 @@ public class Status implements Comparable<Status> {
|
||||||
public 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 inReplyToScreenName, Integer inReplyToStatusId, Integer inReplyToUserId,
|
||||||
String source, String text, boolean truncated, User user) {
|
String source, String text, boolean truncated, User user) {
|
||||||
this.createdAt = createdAt;
|
this.createdAt = createdAt;
|
||||||
|
@ -129,11 +129,11 @@ public class Status implements Comparable<Status> {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DateTime getCreatedAt() {
|
public Date getCreatedAt() {
|
||||||
return createdAt;
|
return createdAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCreatedAt(DateTime createdAt) {
|
public void setCreatedAt(Date createdAt) {
|
||||||
this.createdAt = createdAt;
|
this.createdAt = createdAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ package ${package}.domain;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
|
||||||
import org.joda.time.DateTime;
|
import java.util.Date;
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ import com.google.gson.annotations.SerializedName;
|
||||||
*/
|
*/
|
||||||
public class User implements Comparable<User> {
|
public class User implements Comparable<User> {
|
||||||
@SerializedName("created_at")
|
@SerializedName("created_at")
|
||||||
private DateTime createdAt;
|
private Date createdAt;
|
||||||
private String description;
|
private String description;
|
||||||
@SerializedName("favourites_count")
|
@SerializedName("favourites_count")
|
||||||
private int favouritesCount;
|
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,
|
boolean following, int friendsCount, boolean geoEnabled, long id, String location,
|
||||||
String name, boolean notifications, String profileBackgroundColor,
|
String name, boolean notifications, String profileBackgroundColor,
|
||||||
URI profileBackgroundImageUrl, boolean profileBackgroundTile, URI profileImageUrl,
|
URI profileBackgroundImageUrl, boolean profileBackgroundTile, URI profileImageUrl,
|
||||||
|
@ -294,11 +294,11 @@ public class User implements Comparable<User> {
|
||||||
this.friendsCount = friendsCount;
|
this.friendsCount = friendsCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DateTime getCreatedAt() {
|
public Date getCreatedAt() {
|
||||||
return createdAt;
|
return createdAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCreatedAt(DateTime createdAt) {
|
public void setCreatedAt(Date createdAt) {
|
||||||
this.createdAt = createdAt;
|
this.createdAt = createdAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,7 @@ import org.jclouds.rest.RestClientTest;
|
||||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||||
import org.jclouds.rest.internal.RestAnnotationProcessor;
|
import org.jclouds.rest.internal.RestAnnotationProcessor;
|
||||||
import ${package}.functions.ParseStatusesFromJsonResponse;
|
import ${package}.functions.ParseStatusesFromJsonResponse;
|
||||||
|
import org.jclouds.encryption.EncryptionService;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.inject.AbstractModule;
|
import com.google.inject.AbstractModule;
|
||||||
|
|
|
@ -47,14 +47,14 @@
|
||||||
package ${package}.config;
|
package ${package}.config;
|
||||||
|
|
||||||
import static org.testng.Assert.assertEquals;
|
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.concurrent.config.ExecutorServiceModule;
|
||||||
import org.jclouds.http.HttpRetryHandler;
|
import org.jclouds.http.HttpRetryHandler;
|
||||||
import org.jclouds.http.config.JavaUrlHttpCommandExecutorServiceModule;
|
import org.jclouds.http.config.JavaUrlHttpCommandExecutorServiceModule;
|
||||||
import org.jclouds.http.functions.config.ParserModule;
|
import org.jclouds.http.functions.config.ParserModule;
|
||||||
import org.jclouds.http.functions.config.ParserModule.CDateTimeAdapter;
|
import org.jclouds.http.functions.config.ParserModule.CDateAdapter;
|
||||||
import org.jclouds.http.functions.config.ParserModule.DateTimeAdapter;
|
import org.jclouds.http.functions.config.ParserModule.DateAdapter;
|
||||||
import org.jclouds.http.handlers.CloseContentAndSetExceptionErrorHandler;
|
import org.jclouds.http.handlers.CloseContentAndSetExceptionErrorHandler;
|
||||||
import org.jclouds.http.handlers.DelegatingErrorHandler;
|
import org.jclouds.http.handlers.DelegatingErrorHandler;
|
||||||
import org.jclouds.http.handlers.DelegatingRetryHandler;
|
import org.jclouds.http.handlers.DelegatingRetryHandler;
|
||||||
|
@ -63,6 +63,7 @@ import org.jclouds.logging.Logger;
|
||||||
import org.jclouds.logging.Logger.LoggerFactory;
|
import org.jclouds.logging.Logger.LoggerFactory;
|
||||||
import ${package}.reference.${clientName}Constants;
|
import ${package}.reference.${clientName}Constants;
|
||||||
import org.jclouds.util.Jsr330;
|
import org.jclouds.util.Jsr330;
|
||||||
|
import org.jclouds.Constants;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.inject.Guice;
|
import com.google.inject.Guice;
|
||||||
|
@ -84,6 +85,14 @@ public class ${clientName}ContextModuleTest {
|
||||||
.to("password");
|
.to("password");
|
||||||
bindConstant().annotatedWith(Jsr330.named(${clientName}Constants.PROPERTY_${ucaseClientName}_ENDPOINT))
|
bindConstant().annotatedWith(Jsr330.named(${clientName}Constants.PROPERTY_${ucaseClientName}_ENDPOINT))
|
||||||
.to("http://localhost");
|
.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() {
|
bind(Logger.LoggerFactory.class).toInstance(new LoggerFactory() {
|
||||||
public Logger getLogger(String category) {
|
public Logger getLogger(String category) {
|
||||||
return Logger.NULL;
|
return Logger.NULL;
|
||||||
|
@ -92,7 +101,7 @@ public class ${clientName}ContextModuleTest {
|
||||||
super.configure();
|
super.configure();
|
||||||
}
|
}
|
||||||
}, new ParserModule(), new JavaUrlHttpCommandExecutorServiceModule(),
|
}, new ParserModule(), new JavaUrlHttpCommandExecutorServiceModule(),
|
||||||
new ExecutorServiceModule(Executors.sameThreadExecutor()));
|
new ExecutorServiceModule(sameThreadExecutor(), sameThreadExecutor()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -104,8 +113,8 @@ public class ${clientName}ContextModuleTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testDateTimeAdapter() {
|
void testDateTimeAdapter() {
|
||||||
assertEquals(this.createInjector().getInstance(DateTimeAdapter.class).getClass(),
|
assertEquals(this.createInjector().getInstance(DateAdapter.class).getClass(),
|
||||||
CDateTimeAdapter.class);
|
CDateAdapter.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -54,7 +54,8 @@ import java.util.SortedSet;
|
||||||
import org.jclouds.http.functions.config.ParserModule;
|
import org.jclouds.http.functions.config.ParserModule;
|
||||||
import ${package}.domain.Status;
|
import ${package}.domain.Status;
|
||||||
import ${package}.domain.User;
|
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 org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSortedSet;
|
import com.google.common.collect.ImmutableSortedSet;
|
||||||
|
@ -73,11 +74,11 @@ public class ParseStatusesFromJsonResponseTest {
|
||||||
Injector i = Guice.createInjector(new ParserModule() {
|
Injector i = Guice.createInjector(new ParserModule() {
|
||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
bind(DateTimeAdapter.class).to(CDateTimeAdapter.class);
|
bind(DateAdapter.class).to(CDateAdapter.class);
|
||||||
super.configure();
|
super.configure();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
DateService dateService = new DateService();
|
DateService dateService = new SimpleDateFormatDateService();
|
||||||
|
|
||||||
public void testApplyInputStreamDetails() throws UnknownHostException {
|
public void testApplyInputStreamDetails() throws UnknownHostException {
|
||||||
InputStream is = getClass().getResourceAsStream("/test_mentions.json");
|
InputStream is = getClass().getResourceAsStream("/test_mentions.json");
|
||||||
|
|
Loading…
Reference in New Issue