jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r677906 - in /jackrabbit/trunk/jackrabbit-spi: ./ src/test/ src/test/java/ src/test/java/org/ src/test/java/org/apache/ src/test/java/org/apache/jackrabbit/ src/test/java/org/apache/jackrabbit/spi/
Date Fri, 18 Jul 2008 13:43:25 GMT
Author: angela
Date: Fri Jul 18 06:43:23 2008
New Revision: 677906

URL: http://svn.apache.org/viewvc?rev=677906&view=rev
Log:
JCR-1629: Testsuite for the SPI Interfaces

Added:
    jackrabbit/trunk/jackrabbit-spi/src/test/
    jackrabbit/trunk/jackrabbit-spi/src/test/java/
    jackrabbit/trunk/jackrabbit-spi/src/test/java/org/
    jackrabbit/trunk/jackrabbit-spi/src/test/java/org/apache/
    jackrabbit/trunk/jackrabbit-spi/src/test/java/org/apache/jackrabbit/
    jackrabbit/trunk/jackrabbit-spi/src/test/java/org/apache/jackrabbit/spi/
    jackrabbit/trunk/jackrabbit-spi/src/test/java/org/apache/jackrabbit/spi/AbstractSPITest.java
  (with props)
    jackrabbit/trunk/jackrabbit-spi/src/test/java/org/apache/jackrabbit/spi/Helper.java  
(with props)
    jackrabbit/trunk/jackrabbit-spi/src/test/java/org/apache/jackrabbit/spi/RepositoryServiceStub.java
  (with props)
    jackrabbit/trunk/jackrabbit-spi/src/test/java/org/apache/jackrabbit/spi/RepositoryServiceTest.java
  (with props)
    jackrabbit/trunk/jackrabbit-spi/src/test/java/org/apache/jackrabbit/spi/SessionInfoTest.java
  (with props)
    jackrabbit/trunk/jackrabbit-spi/src/test/java/org/apache/jackrabbit/spi/TestAll.java 
 (with props)
Modified:
    jackrabbit/trunk/jackrabbit-spi/pom.xml

Modified: jackrabbit/trunk/jackrabbit-spi/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi/pom.xml?rev=677906&r1=677905&r2=677906&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi/pom.xml (original)
+++ jackrabbit/trunk/jackrabbit-spi/pom.xml Fri Jul 18 06:43:23 2008
@@ -44,11 +44,44 @@
     <url>http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi</url>
   </scm>
 
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <executions>
+          <execution>
+            <goals>
+              <goal>jar</goal>
+              <goal>test-jar</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+           <skip>true</skip>
+         </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  
   <dependencies>
     <dependency>
       <groupId>javax.jcr</groupId>
       <artifactId>jcr</artifactId>
     </dependency>
+        <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-log4j12</artifactId>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
 </project>

Added: jackrabbit/trunk/jackrabbit-spi/src/test/java/org/apache/jackrabbit/spi/AbstractSPITest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi/src/test/java/org/apache/jackrabbit/spi/AbstractSPITest.java?rev=677906&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi/src/test/java/org/apache/jackrabbit/spi/AbstractSPITest.java
(added)
+++ jackrabbit/trunk/jackrabbit-spi/src/test/java/org/apache/jackrabbit/spi/AbstractSPITest.java
Fri Jul 18 06:43:23 2008
@@ -0,0 +1,103 @@
+/*
+ * 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.spi;
+
+import junit.framework.TestCase;
+
+import javax.jcr.RepositoryException;
+
+/** <code>AbstractSPITest</code>... */
+public class AbstractSPITest extends TestCase {
+
+    /**
+     * Helper object to access repository service transparently
+     */
+    public static Helper helper = new Helper();
+
+    /**
+     * SessionInfo with superuser permission
+     */
+    protected SessionInfo sessionInfo;
+
+    /**
+     * Returns the value of the configuration property with <code>propName</code>.
+     * The sequence how configuration properties are read is the follwoing:
+     * <ol>
+     * <li><code>org.apache.jackrabbit.spi.&lt;testClassName>.&lt;testCaseName>.&lt;propName></code></li>
+     * <li><code>org.apache.jackrabbit.spi.&lt;testClassName>.&lt;propName></code></li>
+     * <li><code>org.apache.jackrabbit.spi.&lt;packageName>.&lt;propName></code></li>
+     * <li><code>org.apache.jackrabbit.spi.&lt;propName></code></li>
+     * </ol>
+     * Where:
+     * <ul>
+     * <li><code>&lt;testClassName></code> is the name of the test
class without package prefix.</li>
+     * <li><code>&lt;testMethodName></code> is the name of the test
method</li>
+     * <li><code>&lt;packageName></code> is the name of the package
of the test class.
+     * </ul>
+     * @param propName the propName of the configration property.
+     * @return the value of the property or <code>null</code> if the property
+     *  does not exist.
+     * @throws RepositoryException if an error occurs while reading from
+     *  the configuration.
+     */
+    public String getProperty(String propName) throws RepositoryException {
+        String testCaseName = getName();
+        String testClassName = getClass().getName();
+        String testPackName = "";
+        int idx;
+        if ((idx = testClassName.lastIndexOf('.')) > -1) {
+            testPackName = testClassName.substring(testClassName.lastIndexOf('.', idx - 1)
+ 1, idx);
+            testClassName = testClassName.substring(idx + 1);
+        }
+
+        // 1) test case specific property first
+        String value = helper.getProperty(RepositoryServiceStub.PROP_PREFIX + "."
+                + testClassName + "." + testCaseName + "." + propName);
+        if (value != null) {
+            return value;
+        }
+
+        // 2) check test class property
+        value = helper.getProperty(RepositoryServiceStub.PROP_PREFIX + "."
+                + testClassName + "." + propName);
+        if (value != null) {
+            return value;
+        }
+
+        // 3) check package property
+        value = helper.getProperty(RepositoryServiceStub.PROP_PREFIX + "."
+                + testPackName + "." + propName);
+        if (value != null) {
+            return value;
+        }
+
+        // finally try global property
+        return helper.getProperty(RepositoryServiceStub.PROP_PREFIX + "." + propName);
+    }
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        sessionInfo = helper.getAdminSessionInfo();
+    }
+
+    protected void tearDown() throws Exception {
+        if (sessionInfo != null) {
+            helper.getRepositoryService().dispose(sessionInfo);
+        }
+        super.tearDown();
+    }
+}
\ No newline at end of file

Propchange: jackrabbit/trunk/jackrabbit-spi/src/test/java/org/apache/jackrabbit/spi/AbstractSPITest.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

Added: jackrabbit/trunk/jackrabbit-spi/src/test/java/org/apache/jackrabbit/spi/Helper.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi/src/test/java/org/apache/jackrabbit/spi/Helper.java?rev=677906&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi/src/test/java/org/apache/jackrabbit/spi/Helper.java (added)
+++ jackrabbit/trunk/jackrabbit-spi/src/test/java/org/apache/jackrabbit/spi/Helper.java Fri
Jul 18 06:43:23 2008
@@ -0,0 +1,114 @@
+/*
+ * 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.spi;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.Credentials;
+import java.util.HashMap;
+import java.util.Map;
+
+/** <code>Helper</code>... */
+public class Helper {
+
+    private static Logger log = LoggerFactory.getLogger(Helper.class);
+
+    /**
+     * RepositoryService stub reference.
+     */
+    private RepositoryServiceStub repoServiceStub;
+
+    /**
+     * Overlay configuration.
+     */
+    private Map configuration = new HashMap();
+
+    /**
+     * Creates a repository helper with configuration from
+     * <code>repositoryStubImpl.properties</code> file.
+     */
+    public Helper() {
+    }
+
+    /**
+     * Creates a repository helper with additional configuration parameters.
+     *
+     * @param config configuration which overlays the values from the property
+     *   file.
+     */
+    public Helper(Map config) {
+        configuration.putAll(config);
+    }
+
+    /**
+     * Returns the repository service instance to test.
+     * @return the repository service instance to test.
+     * @throws RepositoryException if the repository could not be obtained.
+     */
+    public RepositoryService getRepositoryService() throws RepositoryException {
+        if (repoServiceStub == null) {
+            repoServiceStub = RepositoryServiceStub.getInstance(configuration);
+        }
+        return repoServiceStub.getRepositoryService();
+    }
+
+    /**
+     * Returns the value of the configuration property with specified
+     * <code>name</code>. If the property does not exist <code>null</code>
is
+     * returned.
+     * <p/>
+     * Configuration properties are defined in the file:
+     * <code>repositoryStubImpl.properties</code>.
+     *
+     * @param name the name of the property to retrieve.
+     * @return the value of the property or <code>null</code> if non existent.
+     * @throws RepositoryException if the configuration file cannot be found.
+     */
+    public String getProperty(String name) throws RepositoryException {
+        // force assignment of repoStub
+        getRepositoryService();
+        return repoServiceStub.getProperty(name);
+    }
+
+    public Credentials getAdminCredentials() throws RepositoryException {
+        // force assignment of repoStub
+        getRepositoryService();
+        return repoServiceStub.getAdminCredentials();
+    }
+
+    public Credentials getReadOnlyCredentials() throws RepositoryException {
+        // force assignment of repoStub
+        getRepositoryService();
+        return repoServiceStub.getReadOnlyCredentials();
+    }
+
+    public SessionInfo getAdminSessionInfo() throws RepositoryException {
+        // force assignment of repoStub
+        getRepositoryService();
+        String wspName = repoServiceStub.getProperty(RepositoryServiceStub.PROP_WORKSPACE);
+        return getRepositoryService().obtain(getAdminCredentials(), wspName);
+    }
+
+    public SessionInfo getReadOnlySessionInfo() throws RepositoryException {
+        // force assignment of repoStub
+        getRepositoryService();
+        String wspName = repoServiceStub.getProperty(RepositoryServiceStub.PROP_WORKSPACE);
+        return getRepositoryService().obtain(getReadOnlyCredentials(), wspName);
+    }
+}
\ No newline at end of file

Propchange: jackrabbit/trunk/jackrabbit-spi/src/test/java/org/apache/jackrabbit/spi/Helper.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

Added: jackrabbit/trunk/jackrabbit-spi/src/test/java/org/apache/jackrabbit/spi/RepositoryServiceStub.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi/src/test/java/org/apache/jackrabbit/spi/RepositoryServiceStub.java?rev=677906&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi/src/test/java/org/apache/jackrabbit/spi/RepositoryServiceStub.java
(added)
+++ jackrabbit/trunk/jackrabbit-spi/src/test/java/org/apache/jackrabbit/spi/RepositoryServiceStub.java
Fri Jul 18 06:43:23 2008
@@ -0,0 +1,151 @@
+/*
+ * 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.spi;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.Credentials;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Map;
+import java.util.Properties;
+
+/**
+ * The <code>RepositoryServiceStub</code> is the entry point to the SPI
+ * RepositoryService.
+ */
+public abstract class RepositoryServiceStub {
+
+    public static final String STUB_IMPL_PROPS = "repositoryServiceStubImpl.properties";
+
+    public static final String PROP_PREFIX = "org.apache.jackrabbit.spi";
+
+    public static final String STUB_IMPL_SYS_PROPS = PROP_PREFIX + ".properties";
+
+    public static final String PROP_STUB_IMPL_CLASS = PROP_PREFIX + ".repository_service_stub_impl";
+
+    public static final String PROP_ADMIN_PWD = "admin.pwd";
+
+    public static final String PROP_ADMIN_NAME = "admin.name";
+
+    public static final String PROP_READONLY_PWD = "readonly.pwd";
+
+    public static final String PROP_READONLY_NAME = "readonly.name";
+
+    public static final String PROP_WORKSPACE = "workspacename";
+
+    protected final Properties environment;
+
+    /**
+     * Implementations of this class must overwrite this constructor.
+     *
+     * @param env the environment variables. This parameter must not be null.
+     */
+    protected RepositoryServiceStub(Properties env) {
+        if (env == null) {
+            throw new IllegalArgumentException("Parameter 'env' must not be null!");
+        }
+        environment = env;
+    }
+
+    public static RepositoryServiceStub getInstance(Map configuration) throws RepositoryException
{
+        Properties props = null;
+        RepositoryServiceStub stub = null;
+        String implProp = System.getProperty(RepositoryServiceStub.STUB_IMPL_SYS_PROPS);
+        if (implProp != null) {
+            File implPropFile = new File(implProp);
+            if (implPropFile.exists()) {
+                props = new Properties();
+                try {
+                    props.load(new FileInputStream(implPropFile));
+                } catch (IOException e) {
+                    throw new RepositoryException("Unable to load config file: "
+                            + implProp + " " + e.toString());
+                }
+            } else {
+                throw new RepositoryException("File does not exist: " + implProp);
+            }
+        }
+
+        if (props == null) {
+            props = new Properties();
+            InputStream is = RepositoryServiceStub.class.getClassLoader().getResourceAsStream(RepositoryServiceStub.STUB_IMPL_PROPS);
+            if (is != null) {
+                try {
+                    props.load(is);
+                } catch (IOException e) {
+                    throw new RepositoryException("Exception reading "
+                            + RepositoryServiceStub.STUB_IMPL_PROPS + ": " + e.toString());
+                }
+            }
+        }
+
+        // overlay with configuration parameter
+        props.putAll(configuration);
+
+        try {
+            String className = props.getProperty(RepositoryServiceStub.PROP_STUB_IMPL_CLASS);
+            if (className == null || className.length() == 0) {
+                throw new RepositoryException("Property " + RepositoryServiceStub.PROP_STUB_IMPL_CLASS
+ " not defined!");
+            }
+            Class stubClass = Class.forName(className);
+            Constructor constr = stubClass.getConstructor(new Class[]{Properties.class});
+            stub = (RepositoryServiceStub) constr.newInstance(new Object[]{props});
+        } catch (ClassCastException e) {
+            throw new RepositoryException(e.toString());
+        } catch (NoSuchMethodException e) {
+            throw new RepositoryException(e.toString());
+        } catch (ClassNotFoundException e) {
+            throw new RepositoryException(e.toString());
+        } catch (InstantiationException e) {
+            throw new RepositoryException(e.toString());
+        } catch (IllegalAccessException e) {
+            throw new RepositoryException(e.toString());
+        } catch (InvocationTargetException e) {
+            throw new RepositoryException(e.toString());
+        }
+
+        return stub;
+    }
+
+    /**
+     * Returns a reference to the <code>RepositoryService</code> provided by
this
+     * <code>RepositoryServiceStub</code>.
+     *
+     * @return
+     */
+    public abstract RepositoryService getRepositoryService() throws RepositoryException;
+
+    /**
+     * Returns the property with the specified <code>name</code>. If a
+     * property with the given name does not exist, <code>null</code> is
+     * returned.
+     * @param name the name of the property.
+     * @return the property, or <code>null</code> if the property does not
+     * exist.
+     */
+    public String getProperty(String name) {
+        return environment.getProperty(name);
+    }
+
+    public abstract Credentials getAdminCredentials() throws RepositoryException;
+
+    public abstract Credentials getReadOnlyCredentials() throws RepositoryException;
+}
\ No newline at end of file

Propchange: jackrabbit/trunk/jackrabbit-spi/src/test/java/org/apache/jackrabbit/spi/RepositoryServiceStub.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

Added: jackrabbit/trunk/jackrabbit-spi/src/test/java/org/apache/jackrabbit/spi/RepositoryServiceTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi/src/test/java/org/apache/jackrabbit/spi/RepositoryServiceTest.java?rev=677906&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi/src/test/java/org/apache/jackrabbit/spi/RepositoryServiceTest.java
(added)
+++ jackrabbit/trunk/jackrabbit-spi/src/test/java/org/apache/jackrabbit/spi/RepositoryServiceTest.java
Fri Jul 18 06:43:23 2008
@@ -0,0 +1,65 @@
+/*
+ * 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.spi;
+
+import javax.jcr.RepositoryException;
+import java.util.Map;
+import java.util.Arrays;
+
+/** <code>RepositoryServiceTest</code>... */
+public class RepositoryServiceTest extends AbstractSPITest {
+
+    private RepositoryService service;
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        service = helper.getRepositoryService();
+    }
+
+    public void testGetIdFactory() throws RepositoryException {
+        assertNotNull(service.getIdFactory());
+    }
+
+    public void testGetQValueFactory() throws RepositoryException {
+        assertNotNull(service.getQValueFactory());
+    }
+
+    public void testGetNameFactory() throws RepositoryException {
+        assertNotNull(service.getNameFactory());
+    }
+
+    public void testGetPathFactory() throws RepositoryException {
+        assertNotNull(service.getPathFactory());
+    }
+
+    public void testGetRepositoryDescriptors() throws RepositoryException {
+        Map descriptors = service.getRepositoryDescriptors();
+        assertNotNull(descriptors);
+        assertTrue(!descriptors.isEmpty());
+    }
+
+    public void testGetWorkspaceNames() throws RepositoryException {
+        String[] workspaceNames = service.getWorkspaceNames(sessionInfo);
+        assertNotNull("Workspace names must not be null", workspaceNames);
+        assertTrue("Workspace names must contain at least a single workspace", workspaceNames.length
> 1);
+
+        String wspName = getProperty(RepositoryServiceStub.PROP_WORKSPACE);
+        assertTrue("Workspace name used for retrieving the SessionInfo must be included in
the available workspaces.", Arrays.asList(workspaceNames).contains(wspName));
+    }
+
+    // TODO: add tests
+}
\ No newline at end of file

Propchange: jackrabbit/trunk/jackrabbit-spi/src/test/java/org/apache/jackrabbit/spi/RepositoryServiceTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

Added: jackrabbit/trunk/jackrabbit-spi/src/test/java/org/apache/jackrabbit/spi/SessionInfoTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi/src/test/java/org/apache/jackrabbit/spi/SessionInfoTest.java?rev=677906&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi/src/test/java/org/apache/jackrabbit/spi/SessionInfoTest.java
(added)
+++ jackrabbit/trunk/jackrabbit-spi/src/test/java/org/apache/jackrabbit/spi/SessionInfoTest.java
Fri Jul 18 06:43:23 2008
@@ -0,0 +1,49 @@
+/*
+ * 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.spi;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/** <code>SessionInfoTest</code>... */
+public class SessionInfoTest extends AbstractSPITest {
+
+    private static Logger log = LoggerFactory.getLogger(SessionInfoTest.class);
+
+    private String workspaceName;
+    private SessionInfo sessionInfo;
+
+    protected void setUp() throws Exception {
+        super.setUp();
+
+        workspaceName = getProperty(RepositoryServiceStub.PROP_WORKSPACE);
+        sessionInfo = helper.getRepositoryService().obtain(helper.getAdminCredentials(),
workspaceName);
+    }
+
+    protected void tearDown() throws Exception {
+        if (sessionInfo != null) {
+            helper.getRepositoryService().dispose(sessionInfo);
+        }
+        super.tearDown();
+    }
+
+    public void testGetWorkspaceName() {
+        assertEquals(workspaceName, sessionInfo.getWorkspaceName());
+    }
+
+    // TODO: add more tests
+}
\ No newline at end of file

Propchange: jackrabbit/trunk/jackrabbit-spi/src/test/java/org/apache/jackrabbit/spi/SessionInfoTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

Added: jackrabbit/trunk/jackrabbit-spi/src/test/java/org/apache/jackrabbit/spi/TestAll.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi/src/test/java/org/apache/jackrabbit/spi/TestAll.java?rev=677906&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi/src/test/java/org/apache/jackrabbit/spi/TestAll.java (added)
+++ jackrabbit/trunk/jackrabbit-spi/src/test/java/org/apache/jackrabbit/spi/TestAll.java Fri
Jul 18 06:43:23 2008
@@ -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.spi;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/** <code>TestAll</code>... */
+public class TestAll extends TestCase {
+
+    public static Test suite() {
+
+        TestSuite suite = new TestSuite("SPI tests");
+
+        suite.addTestSuite(RepositoryServiceTest.class);
+        suite.addTestSuite(SessionInfoTest.class);
+
+        return suite;
+    }
+}
\ No newline at end of file

Propchange: jackrabbit/trunk/jackrabbit-spi/src/test/java/org/apache/jackrabbit/spi/TestAll.java
------------------------------------------------------------------------------
    svn:eol-style = native

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



Mime
View raw message