Author: rwesten
Date: Mon Oct 31 13:31:14 2011
New Revision: 1195453

URL: http://svn.apache.org/viewvc?rev=1195453&view=rev
Log:
Three files where not added by the last commit ...
 ... I would really like to know, why Eclipse always does not commit some added 
files ... :(

Added:
    
incubator/stanbol/trunk/commons/solr/web/src/main/resources/OSGI-INF/metatype/metatype.properties
   (with props)
    
incubator/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/commons/solr/web/it/DefaultDataDispatchFilterTest.java
   (with props)
    
incubator/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/commons/solr/web/it/SolrDispatchFilterComponentTestBase.java
   (with props)

Added: 
incubator/stanbol/trunk/commons/solr/web/src/main/resources/OSGI-INF/metatype/metatype.properties
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/solr/web/src/main/resources/OSGI-INF/metatype/metatype.properties?rev=1195453&view=auto
==============================================================================
--- 
incubator/stanbol/trunk/commons/solr/web/src/main/resources/OSGI-INF/metatype/metatype.properties
 (added)
+++ 
incubator/stanbol/trunk/commons/solr/web/src/main/resources/OSGI-INF/metatype/metatype.properties
 Mon Oct 31 13:31:14 2011
@@ -0,0 +1,26 @@
+# 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.
+
+#===============================================================================
+#Properties and Options used to configure 
+#===============================================================================
+org.apache.stanbol.commons.solr.web.impl.SolrDispatchFilterComponent.name=Apache
 Stanbol Commons Solr Dispatch Filter Configuration
+org.apache.stanbol.commons.solr.web.impl.SolrDispatchFilterComponent.description=Allows
 to publish the RESTful interface of Solr Servers managed by Stanbol on the 
Stanbol Web interface
+
+org.apache.stanbl.commons.solr.web.dispatchfilter.name.name=Name
+org.apache.stanbl.commons.solr.web.dispatchfilter.name.description=The name 
assigned to the SolrCore (if non, than the directory of the solr.xml is used as 
name).
+
+org.apache.stanbl.commons.solr.web.dispatchfilter.prefix.name=Prefix
+org.apache.stanbl.commons.solr.web.dispatchfilter.prefix.description=The 
prefix under that the Solr RESTful interface of the CoreContainer is mapped 
into the Stanbol Web Interface (pattern: 
"http://{host}:{port}/{stanbol-prefix}/{prefix}/{solr-core}/";) 
\ No newline at end of file

Propchange: 
incubator/stanbol/trunk/commons/solr/web/src/main/resources/OSGI-INF/metatype/metatype.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: 
incubator/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/commons/solr/web/it/DefaultDataDispatchFilterTest.java
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/commons/solr/web/it/DefaultDataDispatchFilterTest.java?rev=1195453&view=auto
==============================================================================
--- 
incubator/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/commons/solr/web/it/DefaultDataDispatchFilterTest.java
 (added)
+++ 
incubator/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/commons/solr/web/it/DefaultDataDispatchFilterTest.java
 Mon Oct 31 13:31:14 2011
@@ -0,0 +1,54 @@
+/*
+* 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.stanbol.commons.solr.web.it;
+
+import java.io.IOException;
+import java.net.URLEncoder;
+
+import org.apache.http.client.ClientProtocolException;
+import org.junit.Test;
+
+public class DefaultDataDispatchFilterTest extends 
SolrDispatchFilterComponentTestBase {
+
+    /**
+     * the prefix of the managed solr server (part of the config for the 
launchers)
+     */
+    private static final String PREFIX = "/solr/default/";
+    /**
+     * the name of the default data index (part of the data.defaultdata bundle)
+     */
+    private static final String CORE_NAME = "dbpedia_43k";
+    
+    
+    public DefaultDataDispatchFilterTest() {
+        super(PREFIX, CORE_NAME);
+    }
+
+    @Test
+    public void testSimpleSolrSelect() throws ClientProtocolException, 
IOException{
+        executor.execute(
+            builder.buildPostRequest(
+                
getCorePath()+"select?q="+URLEncoder.encode("@en/rdfs\\:label/:Paris","UTF8"))
+        )
+        .assertStatus(200)
+        .assertContentRegexp(
+            "http://dbpedia.org/resource/Paris";,
+            "http://dbpedia.org/resource/Paris,_France";,
+            "http://dbpedia.org/resource/Category:People_from_Paris";,
+            "http://dbpedia.org/resource/University_of_Paris";);
+    }
+}

Propchange: 
incubator/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/commons/solr/web/it/DefaultDataDispatchFilterTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: 
incubator/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/commons/solr/web/it/SolrDispatchFilterComponentTestBase.java
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/commons/solr/web/it/SolrDispatchFilterComponentTestBase.java?rev=1195453&view=auto
==============================================================================
--- 
incubator/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/commons/solr/web/it/SolrDispatchFilterComponentTestBase.java
 (added)
+++ 
incubator/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/commons/solr/web/it/SolrDispatchFilterComponentTestBase.java
 Mon Oct 31 13:31:14 2011
@@ -0,0 +1,112 @@
+/*
+* 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.stanbol.commons.solr.web.it;
+
+import static org.junit.Assert.fail;
+
+import org.apache.stanbol.commons.testing.http.RetryLoop;
+import org.apache.stanbol.commons.testing.stanbol.StanbolTestBase;
+import org.junit.Before;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class SolrDispatchFilterComponentTestBase extends StanbolTestBase {
+    
+    private final Logger log = 
LoggerFactory.getLogger(SolrDispatchFilterComponentTestBase.class);
+    
+    public static final int TIMEOUT_SECONDS = 60;
+    public static final int WAIT_BETWEEN_TRIES_MSEC = 1000;
+    
+    private final String prefix;
+    private final String coreName;
+    private boolean coreReady;
+    private boolean timedOut;
+    
+
+    protected SolrDispatchFilterComponentTestBase(String prefix,String 
coreName){
+        if(prefix == null || prefix.isEmpty()){
+            throw new IllegalArgumentException("The parsed prefix MUST NOT be 
NULL nor empty");
+        }
+        if(coreName == null || coreName.isEmpty()){
+            throw new IllegalArgumentException("The parsed name of the 
SolrCore MUST NOT be NULL nor empty");
+        }
+        if(!prefix.endsWith("/")){
+            prefix = prefix+'/';
+        }
+        this.prefix = prefix;
+        this.coreName = coreName;
+    }
+    
+    @Before
+    public void checkEnginesReady() throws Exception {
+    
+        // Check only once per test run
+        if(coreReady) {
+            return;
+        }
+        
+        // If we timed out previously, don't waste time checking again
+        if(timedOut) {
+            fail("Timeout in previous check of enhancement engines, cannot run 
tests");
+        }
+        
+        // We'll retry to send ping requests for to the configured core 
+        final RetryLoop.Condition c = new RetryLoop.Condition() {
+            
+            @Override
+            public boolean isTrue() throws Exception {
+                /*  List of expected engines could be made configurable via 
system
+                 *  properties, but we don't expect it to change often. 
+                 */
+                executor.execute(
+                        builder.buildGetRequest(getCorePath()+"admin/ping")
+                )
+                .assertStatus(200)
+                .assertContentRegexp("<str name=\"status\">OK</str>");
+                
+                log.info("Solr Core {} is ready and mapped to 
{}",coreName,prefix);
+                return true;
+            }
+            
+            @Override
+            public String getDescription() {
+                return "Checking that SolrCore "+coreName+" is ready";
+            }
+        };
+        
+        new RetryLoop(c, TIMEOUT_SECONDS, WAIT_BETWEEN_TRIES_MSEC) {
+            @Override
+            protected void reportException(Throwable t) {
+                log.info("Exception in RetryLoop, will retry for up to " 
+                        + getRemainingTimeSeconds() + " seconds: " + t);
+            }
+            
+            protected void onTimeout() {
+                timedOut = true;
+            }
+        };
+        
+        coreReady = true;
+    }
+    /**
+     * The path to the configured Solr core 
+     * @return <code>prefix+coreName+'/'</code>
+     */
+    public String getCorePath(){
+        return prefix+coreName+'/';
+    }
+}

Propchange: 
incubator/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/commons/solr/web/it/SolrDispatchFilterComponentTestBase.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain


Reply via email to