jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tomm...@apache.org
Subject svn commit: r1463530 - in /jackrabbit/oak/trunk/oak-solr-core: ./ src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/ src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/query/
Date Tue, 02 Apr 2013 13:31:59 GMT
Author: tommaso
Date: Tue Apr  2 13:31:59 2013
New Revision: 1463530

URL: http://svn.apache.org/r1463530
Log:
OAK-735 - fixed tests

Modified:
    jackrabbit/oak/trunk/oak-solr-core/pom.xml
    jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/SolrBaseTest.java
    jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/TestUtils.java
    jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/query/SolrIndexQueryTest.java

Modified: jackrabbit/oak/trunk/oak-solr-core/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-solr-core/pom.xml?rev=1463530&r1=1463529&r2=1463530&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-solr-core/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-solr-core/pom.xml Tue Apr  2 13:31:59 2013
@@ -195,6 +195,12 @@
       <classifier>tests</classifier>
     </dependency>
     <dependency>
+      <groupId>org.apache.solr</groupId>
+      <artifactId>solr-core</artifactId>
+      <version>${solr.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
       <groupId>javax.servlet</groupId>
       <artifactId>servlet-api</artifactId>
       <version>2.5</version>

Modified: jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/SolrBaseTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/SolrBaseTest.java?rev=1463530&r1=1463529&r2=1463530&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/SolrBaseTest.java
(original)
+++ jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/SolrBaseTest.java
Tue Apr  2 13:31:59 2013
@@ -41,7 +41,7 @@ public abstract class SolrBaseTest {
         store = new KernelNodeStore(microKernel);
         state = createInitialState(microKernel);
         server = TestUtils.createSolrServer();
-        configuration = TestUtils.getTestConfiguration(store.getRoot().getChildNode("solrIdx"));
+        configuration = TestUtils.getTestConfiguration();
     }
 
     @After

Modified: jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/TestUtils.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/TestUtils.java?rev=1463530&r1=1463529&r2=1463530&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/TestUtils.java
(original)
+++ jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/TestUtils.java
Tue Apr  2 13:31:59 2013
@@ -21,12 +21,13 @@ import java.util.ArrayList;
 import java.util.List;
 import javax.annotation.Nonnull;
 
+import org.apache.jackrabbit.oak.api.Type;
 import org.apache.jackrabbit.oak.plugins.index.IndexDefinition;
 import org.apache.jackrabbit.oak.plugins.index.IndexHook;
 import org.apache.jackrabbit.oak.plugins.index.IndexHookProvider;
 import org.apache.jackrabbit.oak.plugins.index.solr.index.SolrIndexDiff;
 import org.apache.jackrabbit.oak.plugins.index.solr.query.SolrQueryIndex;
-import org.apache.jackrabbit.oak.plugins.index.solr.server.FixedNodeStateConfiguration;
+import org.apache.jackrabbit.oak.spi.query.Filter;
 import org.apache.jackrabbit.oak.spi.query.QueryIndex;
 import org.apache.jackrabbit.oak.spi.query.QueryIndexProvider;
 import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
@@ -92,7 +93,57 @@ public class TestUtils {
     }
 
 
-    public static OakSolrConfiguration getTestConfiguration(NodeState nodeState) {
-        return new FixedNodeStateConfiguration(nodeState);
+    public static OakSolrConfiguration getTestConfiguration() {
+        return new OakSolrConfiguration() {
+            @Override
+            public String getFieldNameFor(Type<?> propertyType) {
+                return null;
+            }
+
+            @Override
+            public String getPathField() {
+                return "path_exact";
+            }
+
+            @Override
+            public String getFieldForPathRestriction(Filter.PathRestriction pathRestriction)
{
+                String fieldName = null;
+                switch (pathRestriction) {
+                    case ALL_CHILDREN: {
+                        fieldName = "path_des";
+                        break;
+                    }
+                    case DIRECT_CHILDREN: {
+                        fieldName = "path_child";
+                        break;
+                    }
+                    case EXACT: {
+                        fieldName = "path_exact";
+                        break;
+                    }
+                    case PARENT: {
+                        fieldName = "path_anc";
+                        break;
+                    }
+
+                }
+                return fieldName;
+            }
+
+            @Override
+            public String getFieldForPropertyRestriction(Filter.PropertyRestriction propertyRestriction)
{
+                return null;
+            }
+
+            @Override
+            public CommitPolicy getCommitPolicy() {
+                return CommitPolicy.HARD;
+            }
+
+            @Override
+            public String getCoreName() {
+                return "oak";
+            }
+        };
     }
 }

Modified: jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/query/SolrIndexQueryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/query/SolrIndexQueryTest.java?rev=1463530&r1=1463529&r2=1463530&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/query/SolrIndexQueryTest.java
(original)
+++ jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/query/SolrIndexQueryTest.java
Tue Apr  2 13:31:59 2013
@@ -62,8 +62,7 @@ public class SolrIndexQueryTest extends 
 
     @Override
     protected ContentRepository createRepository() {
-        NodeState mockedNodeState = createMockedConfigurationNodeState();
-        OakSolrConfiguration testConfiguration = TestUtils.getTestConfiguration(mockedNodeState);
+        OakSolrConfiguration testConfiguration = TestUtils.getTestConfiguration();
         try {
             solrServer = TestUtils.createSolrServer();
             return new Oak().with(new InitialContent())
@@ -75,12 +74,6 @@ public class SolrIndexQueryTest extends 
         }
     }
 
-    private NodeState createMockedConfigurationNodeState() {
-        NodeState mockedNodeState = mock(NodeState.class);
-        when(mockedNodeState.getProperty(anyString())).thenReturn(null); // this triggers
defaults
-        return mockedNodeState;
-    }
-
     @Test
     public void sql2() throws Exception {
         test("sql2.txt");



Mime
View raw message