Permalink
Browse files

Merge pull request #17 from asomov/master

Use UTF-8 encoding instead of ASCII
  • Loading branch information...
2 parents dd81b1c + e7ef88a commit a0568839d3374e04acbcbc0c2d56074e63106813 @jcodagnone jcodagnone committed Dec 17, 2012
View
@@ -11,3 +11,4 @@ velocity.log
*.iml
*.ipr
*.iws
+.idea
@@ -21,9 +21,9 @@
/**
* <p>
- * A Stream for the Gnip. Once created with {@link GnipFacade} you más register
+ * A Stream for the Gnip. Once created with {@link GnipFacade} you must register
* some observer that will process the data. User MUST call {@link #close()}
- * to release all the releated resources (or when you want to handle gracefull shutdowns)
+ * to release all the related resources (or when you want to handle graceful shutdowns)
* </p>
* <p>
* Implementations SHOULD handle reconnections and timeouts.
@@ -39,7 +39,7 @@
/**
* await for the stream to be {@link #close()} or
- * to be shutdown because of some catastrofic issue.
+ * to be shutdown because of some catastrophic issue.
*/
void await() throws InterruptedException;
@@ -21,19 +21,15 @@
/**
* Main entry point to start the {@link GnipServer}
- *
- * @author Guido Marucci Blas
- * @since 11/11/2011
*/
public final class Main {
-
private static final int DEFAUL_SERVER_PORT = 8080;
+
private static final InputStream ACTIVITIES = Main.class.getClassLoader().getResourceAsStream(
- //"com/zaubersoftware/gnip4j/server/activity/activities.json");
"com/zaubersoftware/gnip4j/server/activity/unlimitedActivity.json");
public static void main(final String[] args) throws InterruptedException {
- final MockServer mockServer = new MockServer();
+ final MockServer mockServer = new MockServer(DEFAUL_SERVER_PORT);
mockServer.start(ACTIVITIES);
}
@@ -33,7 +33,7 @@
*
* Creates the NettyHandlerAggregator.
* @param limitedActivities
- * @param timesToStart the times that the mock server will start and shutdown client's connections.
+ * @param numberOfChunks
*/
public LimitedNettyChunkedInputFactory(final InputStream limitedActivities,
final int numberOfChunks) {
@@ -24,28 +24,28 @@
*
* Implementation of Mock Server
*
- *
* @author Ignacio De Maio
* @since Jan 4, 2012
*/
public class MockServer {
private static GnipServer gnipServer;
- private final int DEFAUL_SERVER_PORT = 8080;
+
+
private NettyChunkedInputFactory chunkedInputFactory;
+
+ private int portNumber;
- /**
- *
- */
- public MockServer(){
+ public MockServer(int portNumber){
+ this.portNumber = portNumber;
}
void start() {
final GnipServerFactory gnipServerFactory = new NettyGnipServerFactory();
- gnipServer = gnipServerFactory.createServer(DEFAUL_SERVER_PORT, chunkedInputFactory);
+ gnipServer = gnipServerFactory.createServer(portNumber, chunkedInputFactory);
gnipServer.start();
- System.out.println("Gnip server started at port " + DEFAUL_SERVER_PORT);
+ System.out.println("Gnip mock server started at port " + portNumber);
}
public void start(final InputStream activities) {
@@ -62,7 +62,7 @@ public GnipChunkedInput getChunkedInput() {
protected static final Collection<String> parseActivities(final InputStream activities) {
try {
- final BufferedReader reader = new BufferedReader(new InputStreamReader(activities));
+ final BufferedReader reader = new BufferedReader(new InputStreamReader(activities, "UTF-8"));
final Collection<String> result = new ArrayList<String>();
String line;
while ((line = reader.readLine()) != null) {
@@ -35,7 +35,6 @@
*
* Creates the NettyHandlerAggregator.
* @param limitedActivities
- * @param timesToStart the times that the mock server will start and shutdown client's connections.
*/
public SlowNettyChunkedInputFactory(final InputStream limitedActivities,
final int timeBetweenChunks) {
View
@@ -101,7 +101,7 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
- <encoding>ISO-8859-1</encoding>
+ <encoding>UTF-8</encoding>
<source>1.6</source>
<target>1.6</target>
</configuration>
@@ -135,7 +135,7 @@
<exclude>.gitignore</exclude>
<exclude>**/*.txt</exclude>
</excludes>
- <encoding>iso-8859-1</encoding>
+ <encoding>UTF-8</encoding>
<strictCheck>true</strictCheck>
</configuration>
<executions>

0 comments on commit a056883

Please sign in to comment.