You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by bd...@apache.org on 2015/09/21 17:09:13 UTC

svn commit: r1704314 - in /sling/trunk/launchpad/integration-tests: ./ src/main/java/org/apache/sling/launchpad/webapp/integrationtest/installer/ src/main/resources/scripts/sling-it/

Author: bdelacretaz
Date: Mon Sep 21 15:09:06 2015
New Revision: 1704314

URL: http://svn.apache.org/viewvc?rev=1704314&view=rev
Log:
SLING-5040 - move installer-duplicate.jsp to ServerSideInstallerTest

Added:
    sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/installer/
    sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/installer/ServerSideInstallerTest.java
Removed:
    sling/trunk/launchpad/integration-tests/src/main/resources/scripts/sling-it/installer-duplicate.jsp
Modified:
    sling/trunk/launchpad/integration-tests/pom.xml

Modified: sling/trunk/launchpad/integration-tests/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/integration-tests/pom.xml?rev=1704314&r1=1704313&r2=1704314&view=diff
==============================================================================
--- sling/trunk/launchpad/integration-tests/pom.xml (original)
+++ sling/trunk/launchpad/integration-tests/pom.xml Mon Sep 21 15:09:06 2015
@@ -328,6 +328,11 @@
       <version>2.0.9-SNAPSHOT</version>
     </dependency>
     <dependency>
+      <groupId>org.apache.sling</groupId>
+      <artifactId>org.apache.sling.installer.core</artifactId>
+      <version>3.6.6</version>
+    </dependency>
+    <dependency>
     	<groupId>org.codehaus.plexus</groupId>
     	<artifactId>plexus-utils</artifactId>
     	<version>3.0.9</version>

Added: sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/installer/ServerSideInstallerTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/installer/ServerSideInstallerTest.java?rev=1704314&view=auto
==============================================================================
--- sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/installer/ServerSideInstallerTest.java (added)
+++ sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/installer/ServerSideInstallerTest.java Mon Sep 21 15:09:06 2015
@@ -0,0 +1,89 @@
+/*
+ * 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.installer;
+
+import static org.junit.Assert.fail;
+
+import java.util.List;
+
+import org.apache.sling.api.resource.LoginException;
+import org.apache.sling.installer.api.info.InfoProvider;
+import org.apache.sling.installer.api.info.InstallationState;
+import org.apache.sling.installer.api.info.Resource;
+import org.apache.sling.installer.api.info.ResourceGroup;
+import org.apache.sling.junit.rules.TeleporterRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+/** Installer test, converted to teleported tests from
+ *  the previous installer-duplicate.jsp test script
+ */
+public class ServerSideInstallerTest {
+    private InfoProvider ip;
+    private InstallationState is;
+    
+    @Rule
+    public final TeleporterRule teleporter = TeleporterRule.forClass(getClass(), "Launchpad");
+
+    @Before
+    public void setup() throws LoginException {
+        ip = teleporter.getService(InfoProvider.class);
+        is = ip.getInstallationState();
+    }
+    
+    @Test
+    public void noUntransformedResources() {
+        final List<?> utr = is.getUntransformedResources();
+        if(utr.size() > 0) {
+            fail("Untransformed resources found: " + utr); 
+        }
+    }
+    
+    @Test
+    public void noActiveResources() {
+        final List<?> ar = is.getActiveResources();
+        if(ar.size() > 0) {
+            fail("Active resources found: " + ar); 
+        }
+    }
+    
+    @Test
+    public void noDuplicates() {
+        String output = "";
+        final List<ResourceGroup> resources = is.getInstalledResources();
+        for(final ResourceGroup group : resources) {
+            if ( group.getResources().size() > 1 ) {            
+                boolean first = true;
+                for(final Resource rsrc : group.getResources()) {
+                    if ( first ) {
+                        output += "Duplicate resources for '" + rsrc.getEntityId() + "' : ";
+                        first = false;
+                    } else {
+                        output += ", ";
+                    }
+                    output += rsrc.getURL();
+                }
+                output += "\n";
+            }
+        }
+        if(output.length() > 0) {
+            fail(output);
+        }
+        
+    }
+}
\ No newline at end of file