jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r542568 - in /jackrabbit/trunk/contrib/spi/client/src/test: config/ java/org/apache/jackrabbit/jcr2spi/ java/org/apache/jackrabbit/jcr2spi/name/ java/org/apache/jackrabbit/jcr2spi/nodetype/ java/org/apache/jackrabbit/jcr2spi/query/ java/org...
Date Tue, 29 May 2007 15:45:46 GMT
Author: angela
Date: Tue May 29 08:45:45 2007
New Revision: 542568

URL: http://svn.apache.org/viewvc?view=rev&rev=542568
Log:
- fix license header
- add RepositoryStub (and config entry) for jcr-rmi

Added:
    jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/RMIRepositoryStub.java
  (with props)
Modified:
    jackrabbit/trunk/contrib/spi/client/src/test/config/repositoryStubImpl.properties
    jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/name/TestAll.java
    jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/nodetype/TestAll.java
    jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/query/TestAll.java
    jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/version/TestAll.java

Modified: jackrabbit/trunk/contrib/spi/client/src/test/config/repositoryStubImpl.properties
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/client/src/test/config/repositoryStubImpl.properties?view=diff&rev=542568&r1=542567&r2=542568
==============================================================================
--- jackrabbit/trunk/contrib/spi/client/src/test/config/repositoryStubImpl.properties (original)
+++ jackrabbit/trunk/contrib/spi/client/src/test/config/repositoryStubImpl.properties Tue
May 29 08:45:45 2007
@@ -2,7 +2,7 @@
 # This is the configuration file for the jackrabbit repository test stub.
 #
 
-# Stub implementation class
+# Stub implementation class for testing JCR2SPI on spi2dav
 #javax.jcr.tck.repository_stub_impl=org.apache.jackrabbit.jcr2spi.JCR2SPIRepositoryStub
 
 # Use this stub implementation instead for testing SPI2JCR on Jackrabbit
@@ -14,8 +14,14 @@
 # Use this stub implementation instead for testing SPI-RMI using a stand-alone server
 #javax.jcr.tck.repository_stub_impl=org.apache.jackrabbit.jcr2spi.JCR2SPIOverRMIRepositoryStub
 
-# repository specific configuration
-org.apache.jackrabbit.jcr2spi.repository.url=http://localhost:5502/jackrabbit/server/
+# Use this stub implementation for test the JCR api via RMI
+#javax.jcr.tck.repository_stub_impl=org.apache.jackrabbit.jcr2spi.RMIRepositoryStub
+
+# Use this stub implementation for testing Jackrabbit-Core over JNDI without intermediate
SPI
+# javax.jcr.tck.repository_stub_impl=org.apache.jackrabbit.jcr2spi.DefaultRepositoryStub
+
+# config for JCR2SPIRepositoryStub (SPI2DAV)
+org.apache.jackrabbit.jcr2spi.repository.url=http://localhost:4302/jackrabbit/server/
 org.apache.jackrabbit.jcr2spi.workspace.name=default
 
 # config for jackrabbit repository implementation when testing SPI2JCR
@@ -26,6 +32,10 @@
 
 # config for SPI-RMI repository stub
 org.apache.jackrabbit.spi.rmi.repository.name=spi-server
+
+# config for RMIRepositoryStub
+# format: //{rmi-host}:{rmi-port}/{repository-name}
+org.apache.jackrabbit.rmi.repository.uri=//localhost:1099/jackrabbit.repository
 
 # credential configuration
 javax.jcr.tck.superuser.name=admin

Added: jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/RMIRepositoryStub.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/RMIRepositoryStub.java?view=auto&rev=542568
==============================================================================
--- jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/RMIRepositoryStub.java
(added)
+++ jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/RMIRepositoryStub.java
Tue May 29 08:45:45 2007
@@ -0,0 +1,118 @@
+/*
+ * 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.jcr2spi;
+
+import org.apache.jackrabbit.rmi.client.ClientRepositoryFactory;
+import org.apache.jackrabbit.test.RepositoryStubException;
+import org.apache.log4j.PropertyConfigurator;
+
+import javax.jcr.Repository;
+import java.util.Properties;
+import java.rmi.RemoteException;
+import java.rmi.NotBoundException;
+import java.net.MalformedURLException;
+
+/**
+ * <code>RMIRepositoryStub</code> implements a repository stub that initializes
+ * a Jackrabbit RMI client.
+ */
+public class RMIRepositoryStub extends DefaultRepositoryStub {
+
+    /**
+     * Property for the repository url
+     */
+    public static final String PROP_REPOSITORY_URI = "org.apache.jackrabbit.rmi.repository.uri";
+
+    static {
+        PropertyConfigurator.configure(RMIRepositoryStub.class.getClassLoader().getResource("log4j.properties"));
+    }
+
+    /**
+     * The Jackrabbit repository.
+     */
+    private Repository repo;
+
+    /**
+     * Constructor required by TCK.
+     *
+     * @param env the environment.
+     */
+    public RMIRepositoryStub(Properties env) {
+        super(env);
+    }
+
+    /**
+     * @return the repository instance to test.
+     * @throws RepositoryStubException if an error occurs while starting up the
+     *                                 repository.
+     */
+    public Repository getRepository() throws RepositoryStubException {
+        if (repo == null) {
+            repo = getRepositoryFromRMI();
+        }
+        return repo;
+    }
+
+    private Repository getRepositoryFromRMI() throws RepositoryStubException {
+        try {
+            Class clazz = Class.forName(getServerFactoryDelegaterClass());
+            ClientFactoryDelegater cfd = (ClientFactoryDelegater) clazz.newInstance();
+
+            String repositoryURI = environment.getProperty(PROP_REPOSITORY_URI);
+            Repository r = cfd.getRepository(repositoryURI);
+            //log.info("Acquired repository via RMI.");
+            return r;
+        } catch (Exception e) {
+            //log.error("Error while retrieving repository using RMI: " + e);
+            throw new RepositoryStubException(e.getMessage());
+        }
+    }
+
+    /**
+     * Return the fully qualified name of the class providing the client
+     * repository. The class whose name is returned must implement the
+     * {@link ClientFactoryDelegater} interface.
+     *
+     * @return the qfn of the factory class.
+     */
+    protected String getServerFactoryDelegaterClass() {
+        return getClass().getName() + "$RMIClientFactoryDelegater";
+    }
+
+    /**
+     * optional class for RMI, will only be used, if RMI client is present
+     */
+    protected static abstract class ClientFactoryDelegater {
+
+        public abstract Repository getRepository(String uri)
+                throws RemoteException, MalformedURLException, NotBoundException;
+    }
+
+    /**
+     * optional class for RMI, will only be used, if RMI server is present
+     */
+    protected static class RMIClientFactoryDelegater extends ClientFactoryDelegater {
+
+        // only used to enforce linking upon Class.forName()
+        static String FactoryClassName = ClientRepositoryFactory.class.getName();
+
+        public Repository getRepository(String uri) throws MalformedURLException, NotBoundException,
RemoteException {
+            System.setProperty("java.rmi.server.useCodebaseOnly", "true");
+            return new ClientRepositoryFactory().getRepository(uri);
+        }
+    }
+}

Propchange: jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/RMIRepositoryStub.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/RMIRepositoryStub.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision url

Modified: jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/name/TestAll.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/name/TestAll.java?view=diff&rev=542568&r1=542567&r2=542568
==============================================================================
--- jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/name/TestAll.java
(original)
+++ jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/name/TestAll.java
Tue May 29 08:45:45 2007
@@ -1,15 +1,18 @@
 /*
- * $Id$
+ * 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
  *
- * Copyright 1997-2005 Day Management AG
- * Barfuesserplatz 6, 4001 Basel, Switzerland
- * All Rights Reserved.
+ *      http://www.apache.org/licenses/LICENSE-2.0
  *
- * This software is the confidential and proprietary information of
- * Day Management AG, ("Confidential Information"). You shall not
- * disclose such Confidential Information and shall use it only in
- * accordance with the terms of the license agreement you entered into
- * with Day.
+ * 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.jcr2spi.name;
 

Modified: jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/nodetype/TestAll.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/nodetype/TestAll.java?view=diff&rev=542568&r1=542567&r2=542568
==============================================================================
--- jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/nodetype/TestAll.java
(original)
+++ jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/nodetype/TestAll.java
Tue May 29 08:45:45 2007
@@ -1,15 +1,18 @@
 /*
- * $Id$
+ * 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
  *
- * Copyright 1997-2005 Day Management AG
- * Barfuesserplatz 6, 4001 Basel, Switzerland
- * All Rights Reserved.
+ *      http://www.apache.org/licenses/LICENSE-2.0
  *
- * This software is the confidential and proprietary information of
- * Day Management AG, ("Confidential Information"). You shall not
- * disclose such Confidential Information and shall use it only in
- * accordance with the terms of the license agreement you entered into
- * with Day.
+ * 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.jcr2spi.nodetype;
 

Modified: jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/query/TestAll.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/query/TestAll.java?view=diff&rev=542568&r1=542567&r2=542568
==============================================================================
--- jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/query/TestAll.java
(original)
+++ jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/query/TestAll.java
Tue May 29 08:45:45 2007
@@ -1,15 +1,18 @@
 /*
- * $Id$
+ * 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
  *
- * Copyright 1997-2005 Day Management AG
- * Barfuesserplatz 6, 4001 Basel, Switzerland
- * All Rights Reserved.
+ *      http://www.apache.org/licenses/LICENSE-2.0
  *
- * This software is the confidential and proprietary information of
- * Day Management AG, ("Confidential Information"). You shall not
- * disclose such Confidential Information and shall use it only in
- * accordance with the terms of the license agreement you entered into
- * with Day.
+ * 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.jcr2spi.query;
 

Modified: jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/version/TestAll.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/version/TestAll.java?view=diff&rev=542568&r1=542567&r2=542568
==============================================================================
--- jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/version/TestAll.java
(original)
+++ jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/version/TestAll.java
Tue May 29 08:45:45 2007
@@ -1,15 +1,18 @@
 /*
- * $Id$
+ * 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
  *
- * Copyright 1997-2005 Day Management AG
- * Barfuesserplatz 6, 4001 Basel, Switzerland
- * All Rights Reserved.
+ *      http://www.apache.org/licenses/LICENSE-2.0
  *
- * This software is the confidential and proprietary information of
- * Day Management AG, ("Confidential Information"). You shall not
- * disclose such Confidential Information and shall use it only in
- * accordance with the terms of the license agreement you entered into
- * with Day.
+ * 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.jcr2spi.version;
 



Mime
View raw message