Permalink
Browse files

Renamed package structure

From: /src/main/org/membase/jmembase
To: /src/main/org/couchbase/mock

From: src/test/java/org/membase/jmembase
To: src/test/java/org/couchbase/mock

Change-Id: Iff51743f46675de946864da56c0865c5f864ce4c
From: src/main/java/org/membase/jmembase/JMembase.java
To: src/main/java/org/couchbase/mock/CouchbaseMock.java
Reviewed-on: http://review.couchbase.org/8795
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>
  • Loading branch information...
1 parent 6daa775 commit bf620a1894278b333d62ce4cdde4d252c7c62818 Mike Wiederhold committed with trondn Jun 30, 2011
Showing with 76 additions and 62 deletions.
  1. +2 −3 README
  2. +3 −3 nbactions.xml
  3. +3 −3 pom.xml
  4. +30 −26 src/main/java/org/{membase/jmembase/JMembase.java → couchbase/mock/CouchbaseMock.java}
  5. +1 −1 src/main/java/org/{membase/jmembase → couchbase/mock}/http/HttpClient.java
  6. +1 −1 src/main/java/org/{membase/jmembase → couchbase/mock}/http/HttpReasonCode.java
  7. +1 −1 src/main/java/org/{membase/jmembase → couchbase/mock}/http/HttpRequest.java
  8. +1 −1 src/main/java/org/{membase/jmembase → couchbase/mock}/http/HttpRequestHandler.java
  9. +1 −1 src/main/java/org/{membase/jmembase → couchbase/mock}/http/HttpRequestImpl.java
  10. +1 −1 src/main/java/org/{membase/jmembase → couchbase/mock}/http/HttpServer.java
  11. +1 −1 src/main/java/org/{membase/jmembase → couchbase/mock}/memcached/BinaryCommand.java
  12. +1 −1 src/main/java/org/{membase/jmembase → couchbase/mock}/memcached/BinaryProtocolHandler.java
  13. +1 −1 src/main/java/org/{membase/jmembase → couchbase/mock}/memcached/BinaryResponse.java
  14. +1 −1 src/main/java/org/{membase/jmembase → couchbase/mock}/memcached/ComCode.java
  15. +1 −1 src/main/java/org/{membase/jmembase → couchbase/mock}/memcached/DataStore.java
  16. +1 −1 src/main/java/org/{membase/jmembase → couchbase/mock}/memcached/ErrorCode.java
  17. +1 −1 src/main/java/org/{membase/jmembase → couchbase/mock}/memcached/Item.java
  18. +1 −1 src/main/java/org/{membase/jmembase → couchbase/mock}/memcached/MemcachedConnection.java
  19. +7 −2 src/main/java/org/{membase/jmembase → couchbase/mock}/memcached/MemcachedServer.java
  20. +1 −1 src/main/java/org/{membase/jmembase → couchbase/mock}/memcached/VBucket.java
  21. +1 −1 src/main/java/org/{membase/jmembase → couchbase/mock}/util/Base64.java
  22. +1 −1 src/main/java/org/{membase/jmembase → couchbase/mock}/util/JSON.java
  23. +10 −6 src/test/java/org/{membase/jmembase → couchbase/mock}/JMembaseTest.java
  24. +3 −1 src/test/java/org/{membase/jmembase → couchbase/mock}/util/Base64Test.java
  25. +1 −1 src/test/java/org/{membase/jmembase → couchbase/mock}/util/JSONTest.java
View
5 README
@@ -1,8 +1,7 @@
Hi!
-JMembase is a super-scaled down test server I'm going to be using to test
-libmembase. It is not designed to be used in production environments, only
-to verify that libmembase works as intended.
+CouchbaseMock is a super-scaled down test server to use for testing
+of "smart clients" for Couchbase.
I've tried to keep the dependency list as short as possible and rather
implement the basic functionality I need instead of adding dependencies to
View
@@ -8,7 +8,7 @@
</goals>
<properties>
<exec.classpathScope>runtime</exec.classpathScope>
- <exec.args>-classpath %classpath org.membase.jmembase.JMembase</exec.args>
+ <exec.args>-classpath %classpath org.couchbase.mock.CouchbaseMock</exec.args>
<exec.executable>java</exec.executable>
</properties>
</action>
@@ -20,7 +20,7 @@
</goals>
<properties>
<exec.classpathScope>runtime</exec.classpathScope>
- <exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath org.membase.jmembase.JMembase</exec.args>
+ <exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath org.couchbase.mock.CouchbaseMock</exec.args>
<jpda.listen>true</jpda.listen>
<exec.executable>java</exec.executable>
</properties>
@@ -32,7 +32,7 @@
<goal>org.codehaus.mojo:exec-maven-plugin:1.1.1:exec</goal>
</goals>
<properties>
- <exec.args>${profiler.args} -classpath %classpath org.membase.jmembase.JMembase</exec.args>
+ <exec.args>${profiler.args} -classpath %classpath org.couchbase.mock.CouchbaseMock</exec.args>
<profiler.action>profile</profiler.action>
<exec.executable>${profiler.java}</exec.executable>
</properties>
View
@@ -1,11 +1,11 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
- <groupId>org.membase.JMembase</groupId>
- <artifactId>JMembase</artifactId>
+ <groupId>org.couchbase.mock</groupId>
+ <artifactId>CouchbaseMock</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
- <name>JMembase</name>
+ <name>CouchbaseMock</name>
<url>http://maven.apache.org</url>
<build>
<plugins>
@@ -13,26 +13,29 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.membase.jmembase;
+package org.couchbase.mock;
+import java.util.ArrayList;
import java.util.logging.Level;
+import java.util.List;
import java.util.logging.Logger;
-import org.membase.jmembase.http.HttpRequest;
-import org.membase.jmembase.http.HttpRequestImpl;
-import org.membase.jmembase.util.JSON;
-import org.membase.jmembase.memcached.DataStore;
-import org.membase.jmembase.memcached.MemcachedServer;
+import java.util.Random;
+
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Random;
-import org.membase.jmembase.http.HttpReasonCode;
-import org.membase.jmembase.http.HttpRequestHandler;
-import org.membase.jmembase.http.HttpServer;
-import org.membase.jmembase.util.Base64;
+
+import org.couchbase.mock.http.HttpReasonCode;
+import org.couchbase.mock.http.HttpRequest;
+import org.couchbase.mock.http.HttpRequestHandler;
+import org.couchbase.mock.http.HttpRequestImpl;
+import org.couchbase.mock.http.HttpServer;
+import org.couchbase.mock.memcached.DataStore;
+import org.couchbase.mock.memcached.MemcachedServer;
+import org.couchbase.mock.util.Base64;
+import org.couchbase.mock.util.JSON;
+
/**
* This is a super-scaled down version of something that might look like
@@ -42,15 +45,15 @@
*
* @author Trond Norbye
*/
-public class JMembase implements HttpRequestHandler, Runnable {
+public class CouchbaseMock implements HttpRequestHandler, Runnable {
private final DataStore datastore;
private final MemcachedServer servers[];
private final int numVBuckets;
private final HttpServer httpServer;
private final BucketType defaultBucketType;
- public JMembase(int port, int numNodes, int bucketStartPort, int numVBuckets, JMembase.BucketType type) throws IOException {
+ public CouchbaseMock(int port, int numNodes, int bucketStartPort, int numVBuckets, CouchbaseMock.BucketType type) throws IOException {
this.numVBuckets = numVBuckets;
datastore = new DataStore(numVBuckets);
this.defaultBucketType = type;
@@ -69,11 +72,12 @@ public JMembase(int port, int numNodes, int bucketStartPort, int numVBuckets, JM
httpServer = new HttpServer(port);
}
- public JMembase(int port, int numNodes, int numVBuckets, JMembase.BucketType type) throws IOException {
+ public CouchbaseMock(int port, int numNodes, int numVBuckets, CouchbaseMock.BucketType type) throws IOException {
this(port, numNodes, 0, numVBuckets, type);
}
- public JMembase(int port, int numNodes, int numVBuckets) throws IOException {
- this(port, numNodes, numVBuckets, BucketType.BASE);
+
+ public CouchbaseMock(int port, int numNodes, int numVBuckets) throws IOException {
+ this(port, numNodes, numVBuckets, BucketType.BASE);
}
private byte[] getBucketJSON() {
@@ -226,8 +230,8 @@ public JMembase(int port, int numNodes, int numVBuckets) throws IOException {
*/
public static void main(String[] args) {
try {
- JMembase membase = new JMembase(8091, 100, 4096);
- membase.run();
+ CouchbaseMock mock = new CouchbaseMock(8091, 100, 4096);
+ mock.run();
} catch (Exception e) {
System.err.print("Fatal error! failed to create socket: ");
System.err.println(e.getLocalizedMessage());
@@ -283,7 +287,7 @@ public void handleHttpRequest(HttpRequest request) {
os = request.getOutputStream();
os.write("\n\n\n\n".getBytes());
} catch (IOException ex) {
- Logger.getLogger(JMembase.class.getName()).log(Level.SEVERE, null, ex);
+ Logger.getLogger(CouchbaseMock.class.getName()).log(Level.SEVERE, null, ex);
request.resetResponse();
request.setReasonCode(HttpReasonCode.Internal_Server_Error);
}
@@ -296,7 +300,7 @@ public void handleHttpRequest(HttpRequest request) {
OutputStream os = request.getOutputStream();
os.write(("[" + output + "]").getBytes()); //todo should be refactored (Vitaly R.)
} catch (IOException ex) {
- Logger.getLogger(JMembase.class.getName()).log(Level.SEVERE, null, ex);
+ Logger.getLogger(CouchbaseMock.class.getName()).log(Level.SEVERE, null, ex);
request.resetResponse();
request.setReasonCode(HttpReasonCode.Internal_Server_Error);
}
@@ -309,7 +313,7 @@ public void handleHttpRequest(HttpRequest request) {
OutputStream os = request.getOutputStream();
os.write(sw.toString().getBytes());
} catch (IOException ex) {
- Logger.getLogger(JMembase.class.getName()).log(Level.SEVERE, null, ex);
+ Logger.getLogger(CouchbaseMock.class.getName()).log(Level.SEVERE, null, ex);
request.resetResponse();
request.setReasonCode(HttpReasonCode.Internal_Server_Error);
}
@@ -322,7 +326,7 @@ public void handleHttpRequest(HttpRequest request) {
OutputStream os = request.getOutputStream();
os.write(sw.toString().getBytes());
} catch (IOException ex) {
- Logger.getLogger(JMembase.class.getName()).log(Level.SEVERE, null, ex);
+ Logger.getLogger(CouchbaseMock.class.getName()).log(Level.SEVERE, null, ex);
request.resetResponse();
request.setReasonCode(HttpReasonCode.Internal_Server_Error);
}
@@ -333,7 +337,7 @@ public void handleHttpRequest(HttpRequest request) {
OutputStream os = request.getOutputStream();
os.write(getPoolsJSON());
} catch (IOException ex) {
- Logger.getLogger(JMembase.class.getName()).log(Level.SEVERE, null, ex);
+ Logger.getLogger(CouchbaseMock.class.getName()).log(Level.SEVERE, null, ex);
request.resetResponse();
request.setReasonCode(HttpReasonCode.Internal_Server_Error);
}
@@ -386,7 +390,7 @@ public void run() {
t.join();
t = null;
} catch (InterruptedException ex) {
- Logger.getLogger(JMembase.class.getName()).log(Level.SEVERE, null, ex);
+ Logger.getLogger(CouchbaseMock.class.getName()).log(Level.SEVERE, null, ex);
t.interrupt();
}
} while (t != null);
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.membase.jmembase.http;
+package org.couchbase.mock.http;
import java.nio.ByteBuffer;
import java.nio.channels.SelectionKey;
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.membase.jmembase.http;
+package org.couchbase.mock.http;
/**
* A mapping between the reason codes and their textual representation.
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.membase.jmembase.http;
+package org.couchbase.mock.http;
import java.io.IOException;
import java.io.OutputStream;
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.membase.jmembase.http;
+package org.couchbase.mock.http;
/**
* The web server will fire this callback whenever a new request
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.membase.jmembase.http;
+package org.couchbase.mock.http;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.membase.jmembase.http;
+package org.couchbase.mock.http;
import java.io.IOException;
import java.net.InetSocketAddress;
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.membase.jmembase.memcached;
+package org.couchbase.mock.memcached;
import java.io.IOException;
import java.nio.ByteBuffer;
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.membase.jmembase.memcached;
+package org.couchbase.mock.memcached;
import java.io.IOException;
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.membase.jmembase.memcached;
+package org.couchbase.mock.memcached;
import java.nio.ByteBuffer;
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.membase.jmembase.memcached;
+package org.couchbase.mock.memcached;
/**
* @author Trond Norbye
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.membase.jmembase.memcached;
+package org.couchbase.mock.memcached;
import java.security.AccessControlException;
import java.util.Map;
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.membase.jmembase.memcached;
+package org.couchbase.mock.memcached;
/**
* @author Trond Norbye
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.membase.jmembase.memcached;
+package org.couchbase.mock.memcached;
/**
*
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.membase.jmembase.memcached;
+package org.couchbase.mock.memcached;
import java.io.IOException;
import java.nio.ByteBuffer;
@@ -13,14 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.membase.jmembase.memcached;
+package org.couchbase.mock.memcached;
import java.util.logging.Level;
import java.util.logging.Logger;
-import org.membase.jmembase.util.JSON;
+
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
+
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.UnknownHostException;
@@ -29,11 +30,15 @@
import java.nio.channels.Selector;
import java.nio.channels.ServerSocketChannel;
import java.nio.channels.SocketChannel;
+
import java.security.AccessControlException;
+
import java.util.concurrent.CountDownLatch;
import java.util.Iterator;
import java.util.Set;
+import org.couchbase.mock.util.JSON;
+
/**
* This is a small implementation of a Memcached server. It listens
* to exactly one port and implements the binary protocol.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.membase.jmembase.memcached;
+package org.couchbase.mock.memcached;
import java.security.AccessControlException;
import java.util.Map;
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.membase.jmembase.util;
+package org.couchbase.mock.util;
import java.io.ByteArrayInputStream;
import java.io.IOException;
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.membase.jmembase.util;
+package org.couchbase.mock.util;
import java.io.PrintWriter;
Oops, something went wrong.

0 comments on commit bf620a1

Please sign in to comment.