Author: chetanm
Date: Mon Nov 30 11:51:05 2015
New Revision: 1717232

URL: http://svn.apache.org/viewvc?rev=1717232&view=rev
Log:
OAK-3687 - Oak standalone application example based on Spring Boot

Adding a basic integration test to validate that setup is working as expected

Added:
    jackrabbit/oak/trunk/oak-examples/standalone/src/test/
    jackrabbit/oak/trunk/oak-examples/standalone/src/test/java/
    jackrabbit/oak/trunk/oak-examples/standalone/src/test/java/org/
    jackrabbit/oak/trunk/oak-examples/standalone/src/test/java/org/apache/
    
jackrabbit/oak/trunk/oak-examples/standalone/src/test/java/org/apache/jackrabbit/
    
jackrabbit/oak/trunk/oak-examples/standalone/src/test/java/org/apache/jackrabbit/oak/
    
jackrabbit/oak/trunk/oak-examples/standalone/src/test/java/org/apache/jackrabbit/oak/standalone/
    
jackrabbit/oak/trunk/oak-examples/standalone/src/test/java/org/apache/jackrabbit/oak/standalone/RepositoryTest.java
   (with props)
    
jackrabbit/oak/trunk/oak-examples/standalone/src/test/java/org/apache/jackrabbit/oak/standalone/TestConfig.java
   (with props)
Modified:
    jackrabbit/oak/trunk/oak-examples/standalone/pom.xml

Modified: jackrabbit/oak/trunk/oak-examples/standalone/pom.xml
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-examples/standalone/pom.xml?rev=1717232&r1=1717231&r2=1717232&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-examples/standalone/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-examples/standalone/pom.xml Mon Nov 30 11:51:05 
2015
@@ -74,6 +74,11 @@
     </dependency>
     <dependency>
       <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-starter-test</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework.boot</groupId>
       <artifactId>spring-boot-devtools</artifactId>
       <optional>true</optional>
     </dependency>
@@ -189,6 +194,41 @@
       <artifactId>junit</artifactId>
       <scope>test</scope>
     </dependency>
+
+    <!--
+    Lucene jars are embedded in oak-lucene but IDE does not recognize them
+    being in classpath. So they need to be explicitly mentioned here
+    -->
+    <dependency>
+      <groupId>org.apache.lucene</groupId>
+      <artifactId>lucene-core</artifactId>
+      <version>${lucene.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.lucene</groupId>
+      <artifactId>lucene-analyzers-common</artifactId>
+      <version>${lucene.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.lucene</groupId>
+      <artifactId>lucene-queryparser</artifactId>
+      <version>${lucene.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.lucene</groupId>
+      <artifactId>lucene-queries</artifactId>
+      <version>${lucene.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.lucene</groupId>
+      <artifactId>lucene-suggest</artifactId>
+      <version>${lucene.version}</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
   <build>
@@ -223,6 +263,7 @@
           <filesets>
             <fileset>
               <directory>oak</directory>
+              <directory>repository</directory>
             </fileset>
           </filesets>
         </configuration>

Added: 
jackrabbit/oak/trunk/oak-examples/standalone/src/test/java/org/apache/jackrabbit/oak/standalone/RepositoryTest.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-examples/standalone/src/test/java/org/apache/jackrabbit/oak/standalone/RepositoryTest.java?rev=1717232&view=auto
==============================================================================
--- 
jackrabbit/oak/trunk/oak-examples/standalone/src/test/java/org/apache/jackrabbit/oak/standalone/RepositoryTest.java
 (added)
+++ 
jackrabbit/oak/trunk/oak-examples/standalone/src/test/java/org/apache/jackrabbit/oak/standalone/RepositoryTest.java
 Mon Nov 30 11:51:05 2015
@@ -0,0 +1,47 @@
+/*
+ * 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.standalone;
+
+import javax.jcr.Repository;
+import javax.jcr.Session;
+import javax.jcr.SimpleCredentials;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.SpringApplicationConfiguration;
+import org.springframework.test.context.TestPropertySource;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@SpringApplicationConfiguration({OakServer.class, TestConfig.class})
+@TestPropertySource(properties = {"repo.home=target/testrepo"})
+public class RepositoryTest {
+
+    @Autowired
+    private Repository repository;
+
+    @Test
+    public void repositoryLogin() throws Exception{
+        //Simple sanity test to see if repository is working
+        Session session = repository.login(new SimpleCredentials("admin", 
"admin".toCharArray()));
+        session.logout();
+    }
+}

Propchange: 
jackrabbit/oak/trunk/oak-examples/standalone/src/test/java/org/apache/jackrabbit/oak/standalone/RepositoryTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
jackrabbit/oak/trunk/oak-examples/standalone/src/test/java/org/apache/jackrabbit/oak/standalone/TestConfig.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-examples/standalone/src/test/java/org/apache/jackrabbit/oak/standalone/TestConfig.java?rev=1717232&view=auto
==============================================================================
--- 
jackrabbit/oak/trunk/oak-examples/standalone/src/test/java/org/apache/jackrabbit/oak/standalone/TestConfig.java
 (added)
+++ 
jackrabbit/oak/trunk/oak-examples/standalone/src/test/java/org/apache/jackrabbit/oak/standalone/TestConfig.java
 Mon Nov 30 11:51:05 2015
@@ -0,0 +1,35 @@
+/*
+ * 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.standalone;
+
+import javax.servlet.ServletContext;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.mock.web.MockServletContext;
+
+@Configuration
+public class TestConfig {
+
+    @Bean
+    public ServletContext getServletContext() {
+        return new MockServletContext();
+    }
+}

Propchange: 
jackrabbit/oak/trunk/oak-examples/standalone/src/test/java/org/apache/jackrabbit/oak/standalone/TestConfig.java
------------------------------------------------------------------------------
    svn:eol-style = native


Reply via email to