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/07/01 19:39:30 UTC

svn commit: r1688696 - in /sling/whiteboard/bdelacretaz/it-startup: ./ src/ src/test/ src/test/java/ src/test/java/org/ src/test/java/org/apache/ src/test/java/org/apache/sling/ src/test/java/org/apache/sling/launchpad/ src/test/java/org/apache/sling/l...

Author: bdelacretaz
Date: Wed Jul  1 17:39:30 2015
New Revision: 1688696

URL: http://svn.apache.org/r1688696
Log:
it-startup module created, just a skeleton for now

Added:
    sling/whiteboard/bdelacretaz/it-startup/   (with props)
    sling/whiteboard/bdelacretaz/it-startup/pom.xml
    sling/whiteboard/bdelacretaz/it-startup/src/
    sling/whiteboard/bdelacretaz/it-startup/src/test/
    sling/whiteboard/bdelacretaz/it-startup/src/test/java/
    sling/whiteboard/bdelacretaz/it-startup/src/test/java/org/
    sling/whiteboard/bdelacretaz/it-startup/src/test/java/org/apache/
    sling/whiteboard/bdelacretaz/it-startup/src/test/java/org/apache/sling/
    sling/whiteboard/bdelacretaz/it-startup/src/test/java/org/apache/sling/launchpad/
    sling/whiteboard/bdelacretaz/it-startup/src/test/java/org/apache/sling/launchpad/it/
    sling/whiteboard/bdelacretaz/it-startup/src/test/java/org/apache/sling/launchpad/it/startup/
    sling/whiteboard/bdelacretaz/it-startup/src/test/java/org/apache/sling/launchpad/it/startup/IncrementalStartupIT.java
    sling/whiteboard/bdelacretaz/it-startup/src/test/java/org/apache/sling/launchpad/it/startup/P.java

Propchange: sling/whiteboard/bdelacretaz/it-startup/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Jul  1 17:39:30 2015
@@ -0,0 +1,17 @@
+target
+sling
+bin
+logs
+jackrabbit-repository
+derby.log
+*.iml
+*.ipr
+*.iws
+.settings
+.project
+.classpath
+.externalToolBuilders
+maven-eclipse.xml
+jackrabbit
+
+

Added: sling/whiteboard/bdelacretaz/it-startup/pom.xml
URL: http://svn.apache.org/viewvc/sling/whiteboard/bdelacretaz/it-startup/pom.xml?rev=1688696&view=auto
==============================================================================
--- sling/whiteboard/bdelacretaz/it-startup/pom.xml (added)
+++ sling/whiteboard/bdelacretaz/it-startup/pom.xml Wed Jul  1 17:39:30 2015
@@ -0,0 +1,171 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.sling</groupId>
+    <artifactId>sling</artifactId>
+    <version>23</version>
+    <relativePath/>
+  </parent>
+
+  <artifactId>org.apache.sling.lauchpad.it.startup</artifactId>
+  <version>2.1.11-SNAPSHOT</version>
+  <packaging>jar</packaging>
+
+  <name>Apache Sling Launchpad Startup Integration Tests</name>
+  <description>This module tests the Launchpad startup mechanisms</description>
+
+  <properties>
+    <exam.version>3.5.0</exam.version>
+    <url.version>1.5.2</url.version>
+    <bundle.file.name>${basedir}/target/${project.build.finalName}.jar</bundle.file.name>
+    <pax.vm.options>-Xmx256M -XX:MaxPermSize=256m</pax.vm.options>
+
+    <!-- argLine needs to be here so that jacoco plugin adds its own stuff to it -->
+    <argLine>${pax.vm.options}</argLine>
+  </properties>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-scr-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-failsafe-plugin</artifactId>
+        <executions>
+          <execution>
+            <goals>
+              <goal>integration-test</goal>
+              <goal>verify</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <systemPropertyVariables>
+            <java.protocol.handler.pkgs>org.ops4j.pax.url</java.protocol.handler.pkgs>
+            <bundle.file.name>${bundle.file.name}</bundle.file.name>
+            <sling.launchpad.version>${sling.launchpad.version}</sling.launchpad.version>
+            <dump.test.bundles>${dump.test.bundles}</dump.test.bundles>
+          </systemPropertyVariables>
+          <classpathDependencyExcludes>
+            <!-- The osgi.org dependencies cause trouble with pax exam -->
+            <classpathDependencyExcludes>org.osgi:org.osgi.core</classpathDependencyExcludes>
+            <classpathDependencyExcludes>org.osgi:org.osgi.compendium</classpathDependencyExcludes>
+          </classpathDependencyExcludes>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.servicemix.tooling</groupId>
+        <artifactId>depends-maven-plugin</artifactId>
+        <version>1.2</version>
+        <executions>
+          <execution>
+            <id>generate-depends-file</id>
+            <goals>
+              <goal>generate-depends-file</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.compendium</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.felix</groupId>
+      <artifactId>org.apache.felix.scr.annotations</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>biz.aQute.bnd</groupId>
+      <artifactId>bndlib</artifactId>
+      <version>2.1.0</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-simple</artifactId>
+      <scope>test</scope>
+    </dependency>
+     <dependency>
+      <groupId>javax.inject</groupId>
+      <artifactId>javax.inject</artifactId>
+      <version>1</version>
+      <scope>test</scope>
+    </dependency>
+     <dependency>
+      <groupId>org.ops4j.pax.exam</groupId>
+      <artifactId>pax-exam-junit4</artifactId>
+      <version>${exam.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.ops4j.pax.exam</groupId>
+      <artifactId>pax-exam-container-native</artifactId>
+      <version>${exam.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.ops4j.pax.exam</groupId>
+      <artifactId>pax-exam-link-mvn</artifactId>
+      <version>${exam.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.ops4j.pax.url</groupId>
+      <artifactId>pax-url-wrap</artifactId>
+      <version>2.1.0</version>
+      <scope>test</scope>
+    </dependency>
+     <dependency>
+      <groupId>org.apache.felix</groupId>
+      <artifactId>org.apache.felix.framework</artifactId>
+      <version>4.2.1</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.ops4j.pax.tinybundles</groupId>
+      <artifactId>tinybundles</artifactId>
+      <version>2.0.0</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+</project>

Added: sling/whiteboard/bdelacretaz/it-startup/src/test/java/org/apache/sling/launchpad/it/startup/IncrementalStartupIT.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/bdelacretaz/it-startup/src/test/java/org/apache/sling/launchpad/it/startup/IncrementalStartupIT.java?rev=1688696&view=auto
==============================================================================
--- sling/whiteboard/bdelacretaz/it-startup/src/test/java/org/apache/sling/launchpad/it/startup/IncrementalStartupIT.java (added)
+++ sling/whiteboard/bdelacretaz/it-startup/src/test/java/org/apache/sling/launchpad/it/startup/IncrementalStartupIT.java Wed Jul  1 17:39:30 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.it.startup;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+import javax.inject.Inject;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.tinybundles.core.TinyBundles;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/** Test the Sling Launchpad incremental startup mechanism */
+@RunWith(PaxExam.class)
+public class IncrementalStartupIT {
+    
+    private final Logger log = LoggerFactory.getLogger(getClass());
+    
+    @Inject
+    protected BundleContext bundleContext;
+    
+    private List<Bundle> bundles;
+
+    @org.ops4j.pax.exam.Configuration
+    public Option[] config() {
+        return P.paxConfig();
+    }
+    
+    private InputStream getTestBundleStream(String bundleSymbolicName) throws Exception {
+        return TinyBundles.bundle()
+            .set(Constants.BUNDLE_SYMBOLICNAME, bundleSymbolicName)
+            .build(TinyBundles.withBnd());
+    }
+
+    @Before
+    public void setup() throws Exception {
+        bundles = new ArrayList<Bundle>();
+        final String basename = UUID.randomUUID().toString();
+        for(int i=0; i<25; i++) {
+            final InputStream is = getTestBundleStream(basename + "_" + i);
+            try {
+                final Bundle b = bundleContext.installBundle(basename, is);
+                bundles.add(b);
+                b.start();
+                log.info("Started test bundle {}", b);
+            } finally {
+                is.close();
+            }
+        }
+    }
+
+    @Test
+    public void allBundlesActive() throws Exception {
+        // TODO setup is not called by JUnit??
+        setup();
+        for(Bundle b : bundles) {
+            assertEquals("Expecting bundle to be active:" + b, Bundle.ACTIVE, b.getState());
+        }
+    }
+}
\ No newline at end of file

Added: sling/whiteboard/bdelacretaz/it-startup/src/test/java/org/apache/sling/launchpad/it/startup/P.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/bdelacretaz/it-startup/src/test/java/org/apache/sling/launchpad/it/startup/P.java?rev=1688696&view=auto
==============================================================================
--- sling/whiteboard/bdelacretaz/it-startup/src/test/java/org/apache/sling/launchpad/it/startup/P.java (added)
+++ sling/whiteboard/bdelacretaz/it-startup/src/test/java/org/apache/sling/launchpad/it/startup/P.java Wed Jul  1 17:39:30 2015
@@ -0,0 +1,42 @@
+/*
+ * 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.it.startup;
+
+import static org.ops4j.pax.exam.CoreOptions.bundle;
+import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
+import static org.ops4j.pax.exam.CoreOptions.provision;
+import static org.ops4j.pax.exam.CoreOptions.wrappedBundle;
+
+import java.io.File;
+
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.options.DefaultCompositeOption;
+
+/** Utilities for Pax Exam testing */
+public class P {
+    public static Option[] paxConfig() {
+        final File thisProjectsBundle = new File(System.getProperty( "bundle.file.name", "BUNDLE_FILE_NOT_SET" ));
+        return new DefaultCompositeOption(
+                provision(bundle(thisProjectsBundle.toURI().toString())),
+                wrappedBundle(mavenBundle("org.ops4j.pax.tinybundles", "tinybundles").versionAsInProject()),
+                mavenBundle("biz.aQute.bnd", "bndlib").versionAsInProject(),
+                wrappedBundle(mavenBundle("junit", "junit").versionAsInProject())
+        ).getOptions();
+    }
+}