incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r1539292 - in /sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest: ./ repository/ util/
Date Wed, 06 Nov 2013 10:06:52 GMT
Author: bdelacretaz
Date: Wed Nov  6 10:06:51 2013
New Revision: 1539292

URL: http://svn.apache.org/r1539292
Log:
SLING-2788 - split repository name test to make it easier to find out which implementation
was used in a test run - only one of the OakRepositoryNameTest and JackrabbitRepositoryNameTest
test classes will be executed in a given test run (or JUnitCategoriesTest will fail)

Added:
    sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/repository/
    sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/repository/JackrabbitRepositoryNameTest.java
      - copied, changed from r1539250, sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/RepositoryNameTest.java
    sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/repository/OakRepositoryNameTest.java
  (with props)
    sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/util/RepositoryTestUtil.java
  (with props)
Removed:
    sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/RepositoryNameTest.java

Copied: sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/repository/JackrabbitRepositoryNameTest.java
(from r1539250, sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/RepositoryNameTest.java)
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/repository/JackrabbitRepositoryNameTest.java?p2=sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/repository/JackrabbitRepositoryNameTest.java&p1=sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/RepositoryNameTest.java&r1=1539250&r2=1539292&rev=1539292&view=diff
==============================================================================
--- sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/RepositoryNameTest.java
(original)
+++ sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/repository/JackrabbitRepositoryNameTest.java
Wed Nov  6 10:06:51 2013
@@ -14,21 +14,25 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.sling.launchpad.webapp.integrationtest;
+package org.apache.sling.launchpad.webapp.integrationtest.repository;
 
 import static org.junit.Assert.assertEquals;
 
-import org.apache.sling.commons.json.JSONObject;
 import org.apache.sling.commons.testing.integration.HttpTest;
 import org.apache.sling.commons.testing.junit.categories.JackrabbitOnly;
-import org.apache.sling.commons.testing.junit.categories.OakOnly;
+import org.apache.sling.launchpad.webapp.integrationtest.util.RepositoryTestUtil;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
-/** Verify the repository name, to make sure we're testing the right one */
-public class RepositoryNameTest {
+/** Verify the repository name when running on Jackrabbit.
+ *  Checking that this test class was executed is a good
+ *  way of verifying which repository implementation was
+ *  used to run the integration tests.
+ */
+@Category(JackrabbitOnly.class)
+public class JackrabbitRepositoryNameTest {
 
     private final HttpTest H = new HttpTest();
     
@@ -42,23 +46,8 @@ public class RepositoryNameTest {
         H.tearDown();
     }
     
-    private void assertRepositoryName(String expectedName) throws Exception {
-        final String path = "/testing/RepositoryDescriptors.json";
-        final JSONObject json = new JSONObject(H.getContent(HttpTest.HTTP_BASE_URL + path,
HttpTest.CONTENT_TYPE_JSON));
-        final String key = "jcr.repository.name";
-        final String actualName = json.getJSONObject("descriptors").getString(key);
-        assertEquals("Expecting the correct value for " + key, expectedName, actualName);
-    }
-    
-    @Category(JackrabbitOnly.class)
     @Test
     public void checkJackrabbitName() throws Exception {
-        assertRepositoryName("Jackrabbit");
-    }
-    
-    @Category(OakOnly.class)
-    @Test
-    public void checkOakName() throws Exception {
-        assertRepositoryName("Apache Jackrabbit Oak");
+        assertEquals("Jackrabbit", RepositoryTestUtil.getDescriptor(H, "jcr.repository.name"));
     }
 }
\ No newline at end of file

Added: sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/repository/OakRepositoryNameTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/repository/OakRepositoryNameTest.java?rev=1539292&view=auto
==============================================================================
--- sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/repository/OakRepositoryNameTest.java
(added)
+++ sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/repository/OakRepositoryNameTest.java
Wed Nov  6 10:06:51 2013
@@ -0,0 +1,53 @@
+/*
+ * 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.sling.launchpad.webapp.integrationtest.repository;
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.sling.commons.testing.integration.HttpTest;
+import org.apache.sling.commons.testing.junit.categories.OakOnly;
+import org.apache.sling.launchpad.webapp.integrationtest.util.RepositoryTestUtil;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+/** Verify the repository name when running on Oak.
+ *  Checking that this test class was executed is a good
+ *  way of verifying which repository implementation was
+ *  used to run the integration tests.
+ */
+@Category(OakOnly.class)
+public class OakRepositoryNameTest {
+
+    private final HttpTest H = new HttpTest();
+    
+    @Before
+    public void setup() throws Exception {
+        H.setUp();
+    }
+    
+    @After
+    public void cleanup() throws Exception {
+        H.tearDown();
+    }
+    
+    @Test
+    public void checkJackrabbitName() throws Exception {
+        assertEquals("Apache Jackrabbit Oak", RepositoryTestUtil.getDescriptor(H, "jcr.repository.name"));
+    }
+}
\ No newline at end of file

Propchange: sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/repository/OakRepositoryNameTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/repository/OakRepositoryNameTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/util/RepositoryTestUtil.java
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/util/RepositoryTestUtil.java?rev=1539292&view=auto
==============================================================================
--- sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/util/RepositoryTestUtil.java
(added)
+++ sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/util/RepositoryTestUtil.java
Wed Nov  6 10:06:51 2013
@@ -0,0 +1,37 @@
+/*
+ * 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.sling.launchpad.webapp.integrationtest.util;
+
+import java.io.IOException;
+
+import org.apache.sling.commons.json.JSONException;
+import org.apache.sling.commons.json.JSONObject;
+import org.apache.sling.commons.testing.integration.HttpTest;
+import org.apache.sling.commons.testing.integration.HttpTestBase;
+
+public class RepositoryTestUtil {
+    
+    public static final String DESCRIPTORS_KEY = "descriptors";
+    
+    public static String getDescriptor(HttpTestBase H, String descriptorName) throws JSONException,
IOException {
+        final String path = "/testing/RepositoryDescriptors.json";
+        final JSONObject json = new JSONObject(H.getContent(HttpTest.HTTP_BASE_URL + path,
HttpTest.CONTENT_TYPE_JSON));
+        return json.getJSONObject("descriptors").getString(descriptorName);
+    }
+}
\ No newline at end of file

Propchange: sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/util/RepositoryTestUtil.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/util/RepositoryTestUtil.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL



Mime
View raw message