[Cherbot-commit] SF.net SVN: cherbot: [59] trunk/src
Status: Alpha
Brought to you by:
christianhujer
|
From: <chr...@us...> - 2007-06-16 11:07:58
|
Revision: 59
http://svn.sourceforge.net/cherbot/?rev=59&view=rev
Author: christianhujer
Date: 2007-06-16 04:07:54 -0700 (Sat, 16 Jun 2007)
Log Message:
-----------
Fixed some wrong documentation.
Fixed MetaServerInfo options bug (-h declared twice).
Changed default MetaServerInfo to be daimonin metaserver, not empty.
Adopted the unit test accordingly.
Modified Paths:
--------------
trunk/src/net/sf/cherbot/metaserver/MetaServerEntry.java
trunk/src/net/sf/cherbot/metaserver/MetaServerInfo.java
trunk/src/test/net/sf/cherbot/metaserver/MetaServerInfoTest.java
Modified: trunk/src/net/sf/cherbot/metaserver/MetaServerEntry.java
===================================================================
--- trunk/src/net/sf/cherbot/metaserver/MetaServerEntry.java 2007-06-10 10:12:30 UTC (rev 58)
+++ trunk/src/net/sf/cherbot/metaserver/MetaServerEntry.java 2007-06-16 11:07:54 UTC (rev 59)
@@ -11,8 +11,7 @@
import java.util.regex.Matcher;
import java.io.Serializable;
-/**
- * Created by IntelliJ IDEA.
+/** Represents a single entry in the meta server.
* @author <a href="mailto:ch...@ri...">Christian Hujer</a>
*/
public class MetaServerEntry implements Serializable {
@@ -44,7 +43,7 @@
/** Unknown3. */
@NotNull private final String unknown3;
- /** Unknown3. */
+ /** Unknown4. */
@NotNull private final String unknown4;
/** Create a MetaServerEntry.
Modified: trunk/src/net/sf/cherbot/metaserver/MetaServerInfo.java
===================================================================
--- trunk/src/net/sf/cherbot/metaserver/MetaServerInfo.java 2007-06-10 10:12:30 UTC (rev 58)
+++ trunk/src/net/sf/cherbot/metaserver/MetaServerInfo.java 2007-06-16 11:07:54 UTC (rev 59)
@@ -25,21 +25,27 @@
*/
public class MetaServerInfo extends BasicCommand implements Iterable<MetaServerEntry>, Serializable, Updatable {
+ /** The default meta server. */
+ @NotNull public static final String DEFAULT_META_SERVER_HOST = "damn.informatik.uni-bremen.de";
+
+ /** The default meta port. */
+ public static final int DEFAULT_META_SERVER_PORT = 13326;
+
/** The entries of this MetaServerInfo. */
@NotNull private List<MetaServerEntry> metaServerEntries = new ArrayList<MetaServerEntry>();
/** The address (ip address or hostname) of the meta server to query. */
- @NotNull private String host;
+ @NotNull private String host = DEFAULT_META_SERVER_HOST;
/** The port of the meta server to query. */
- private int port;
+ private int port = DEFAULT_META_SERVER_PORT;
/** Creates a MetaServerInfo.
* This constructor creates an initially empty meta server info with a non functional host and port.
* This is useful for testing and for using {@link MetaServerInfo} as a bean.
*/
public MetaServerInfo() {
- this("", 0);
+ this(DEFAULT_META_SERVER_HOST, DEFAULT_META_SERVER_PORT);
}
/** Creates a MetaServerInfo.
@@ -88,7 +94,7 @@
/** Sets the host of the meta server to query.
* @param host The host of the meta server to query.
*/
- @Option({"h", "host"})
+ @Option({"host"})
public void setHost(@NotNull final String host) {
this.host = host;
}
@@ -96,7 +102,7 @@
/** Sets the port of the meta server to query.
* @param port The port of the meta server to query.
*/
- @Option({"p", "port"})
+ @Option({"port"})
public void setPort(final int port) {
this.port = port;
}
Modified: trunk/src/test/net/sf/cherbot/metaserver/MetaServerInfoTest.java
===================================================================
--- trunk/src/test/net/sf/cherbot/metaserver/MetaServerInfoTest.java 2007-06-10 10:12:30 UTC (rev 58)
+++ trunk/src/test/net/sf/cherbot/metaserver/MetaServerInfoTest.java 2007-06-16 11:07:54 UTC (rev 59)
@@ -57,7 +57,7 @@
@Test public void testUpdate() throws IOException {
final String metaServerString = "192.168.0.1|177|riedquat|20|0.9.7|My own Daimonin server.|02|03|04\n" +
"192.168.0.2|177|lave|20|0.9.7|My other Daimonin server.|02|03|04\n";
- final MetaServerInfo testling = new MetaServerInfo();
+ final MetaServerInfo testling = new MetaServerInfo("", 0);
testling.parse(new BufferedReader(new StringReader(metaServerString)));
Assert.assertEquals("MetaServerInfo now must contain 2 entries.", 2, testling.size());
Assert.assertEquals("ip address of first entry must be 192.168.0.1.", "192.168.0.1", testling.get(0).getIpaddress());
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|