jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r1329628 - in /jackrabbit/oak/trunk: oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ oak-run/ oak-run/src/main/java/org/apache/jackrabbit/oak/run/ oak-run/src/test/ oak-run/src/test/java/ oak-run/src/test/java/org/ oak-run/src/test/jav...
Date Tue, 24 Apr 2012 10:33:13 GMT
Author: reschke
Date: Tue Apr 24 10:33:12 2012
New Revision: 1329628

URL: http://svn.apache.org/viewvc?rev=1329628&view=rev
Log:
OAK-69: add a simple regression test for running oak-run; fix repository descriptor for observation

Added:
    jackrabbit/oak/trunk/oak-run/src/test/
    jackrabbit/oak/trunk/oak-run/src/test/java/
    jackrabbit/oak/trunk/oak-run/src/test/java/org/
    jackrabbit/oak/trunk/oak-run/src/test/java/org/apache/
    jackrabbit/oak/trunk/oak-run/src/test/java/org/apache/jackrabbit/
    jackrabbit/oak/trunk/oak-run/src/test/java/org/apache/jackrabbit/oak/
    jackrabbit/oak/trunk/oak-run/src/test/java/org/apache/jackrabbit/oak/run/
    jackrabbit/oak/trunk/oak-run/src/test/java/org/apache/jackrabbit/oak/run/BasicServerTest.java
Modified:
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/Descriptors.java
    jackrabbit/oak/trunk/oak-run/pom.xml
    jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/Main.java

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/Descriptors.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/Descriptors.java?rev=1329628&r1=1329627&r2=1329628&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/Descriptors.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/Descriptors.java
Tue Apr 24 10:33:12 2012
@@ -85,7 +85,7 @@ public class Descriptors {
     public Descriptors(ValueFactory valueFactory) {
         descriptors = new HashMap<String, Descriptor>();
         Value trueValue = valueFactory.createValue(true);
-        Value falseValue = valueFactory.createValue(true);
+        Value falseValue = valueFactory.createValue(false);
 
         put(new Descriptor(
                 IDENTIFIER_STABILITY,
@@ -164,7 +164,7 @@ public class Descriptors {
                 falseValue, true, true));
         put(new Descriptor(
                 OPTION_OBSERVATION_SUPPORTED,
-                trueValue, true, true));
+                falseValue, true, true));
         put(new Descriptor(
                 OPTION_NODE_AND_PROPERTY_WITH_SAME_NAME_SUPPORTED,
                 trueValue, true, true));

Modified: jackrabbit/oak/trunk/oak-run/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/pom.xml?rev=1329628&r1=1329627&r2=1329628&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-run/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-run/pom.xml Tue Apr 24 10:33:12 2012
@@ -108,6 +108,13 @@
       <artifactId>logback-classic</artifactId>
       <version>1.0.1</version>
     </dependency>
+
+    <!-- Test dependencies -->
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
 </project>

Modified: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/Main.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/Main.java?rev=1329628&r1=1329627&r2=1329628&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/Main.java (original)
+++ jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/Main.java Tue
Apr 24 10:33:12 2012
@@ -27,6 +27,9 @@ import org.eclipse.jetty.servlet.Servlet
 
 public class Main {
 
+    public static final int PORT = 8080;
+    public static final String URI = "http://localhost:" + PORT + "/";
+
     public static void main(String[] args) throws Exception {
         printProductInfo();
 
@@ -36,12 +39,12 @@ public class Main {
 
         if (args.length == 0) {
             System.out.println("Starting an in-memory repository");
-            System.out.println("http://localhost:8080/ -> [memory]");
+            System.out.println(URI + " -> [memory]");
             Servlet servlet = new RepositoryServlet(null);
             context.addServlet(new ServletHolder(servlet),"/*");
         } else if (args.length == 1) {
             System.out.println("Starting a standalone repository");
-            System.out.println("http://localhost:8080/ -> " + args[0]);
+            System.out.println(URI + " -> " + args[0]);
             Servlet servlet = new RepositoryServlet(args[0]);
             context.addServlet(new ServletHolder(servlet), "/*");
         } else {
@@ -49,14 +52,14 @@ public class Main {
             for (int i = 0; i < args.length; i++) {
                 // FIXME: Use a clustered MicroKernel implementation
                 System.out.println(
-                        "http://localhost:8080/node" + i + "/ -> " + args[i]);
+                        URI + "/node" + i + "/ -> " + args[i]);
                 Servlet servlet = new RepositoryServlet(args[i]);
                 context.addServlet(
                         new ServletHolder(servlet), "/node" + i + "/*");
             }
         }
 
-        Server server = new Server(8080);
+        Server server = new Server(PORT);
         server.setHandler(context);
         server.start();
         server.join();

Added: jackrabbit/oak/trunk/oak-run/src/test/java/org/apache/jackrabbit/oak/run/BasicServerTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/test/java/org/apache/jackrabbit/oak/run/BasicServerTest.java?rev=1329628&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-run/src/test/java/org/apache/jackrabbit/oak/run/BasicServerTest.java
(added)
+++ jackrabbit/oak/trunk/oak-run/src/test/java/org/apache/jackrabbit/oak/run/BasicServerTest.java
Tue Apr 24 10:33:12 2012
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.jackrabbit.oak.run;
+
+import java.net.HttpURLConnection;
+import java.net.URL;
+
+import org.apache.jackrabbit.util.Base64;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+
+public class BasicServerTest {
+
+    private Thread st;
+
+    @Before
+    public void startServer() {
+        st = new Thread(new ServerThread());
+        st.start();
+    }
+
+    @After
+    public void stopServer() {
+        st.stop();
+    }
+
+    @Test
+    public void testServerOk() throws Exception {
+
+        URL server = new URL(Main.URI);
+        HttpURLConnection conn = (HttpURLConnection) server.openConnection();
+        conn.setRequestProperty("Authorization",
+                "Basic " + Base64.encode("a:a"));
+        assertEquals(200, conn.getResponseCode());
+    }
+
+    public static class ServerThread implements Runnable {
+
+        @Override
+        public void run() {
+            try {
+                Main.main(new String[0]);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+    }
+}



Mime
View raw message