SLING-4728 - keep old Crankstart around, just in case
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1684873 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/pom.xml b/pom.xml
deleted file mode 100644
index 7343006..0000000
--- a/pom.xml
+++ /dev/null
@@ -1,189 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<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/maven-v4_0_0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache</groupId>
- <artifactId>apache</artifactId>
- <version>10</version>
- <relativePath />
- </parent>
-
- <groupId>org.apache.sling</groupId>
- <artifactId>org.apache.sling.crankstart.launcher</artifactId>
- <packaging>jar</packaging>
- <version>1.0.1-SNAPSHOT</version>
-
- <name>Apache Sling Crankstart Launcher</name>
- <inceptionYear>2014</inceptionYear>
-
- <description>
- A different way of starting Sling
- </description>
-
- <scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/contrib/crankstart/launcher</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/contrib/crankstart/launcher</developerConnection>
- <url>http://sling.apache.org</url>
- </scm>
-
- <properties>
- <pax.url.version>2.1.0</pax.url.version>
- </properties>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <configuration>
- <archive>
- <manifest>
- <mainClass>org.apache.sling.crankstart.launcher.Main</mainClass>
- <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
- </manifest>
- </archive>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <executions>
- <execution>
- <id>embed-dependencies</id>
- <goals>
- <goal>unpack-dependencies</goal>
- </goals>
- <configuration>
- <includeGroupIds>org.slf4j,org.ops4j.pax.url</includeGroupIds>
- <excludeTransitive>false</excludeTransitive>
- <outputDirectory>${project.build.directory}/classes</outputDirectory>
- <overWriteReleases>false</overWriteReleases>
- <overWriteSnapshots>false</overWriteSnapshots>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.6</source>
- <target>1.6</target>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-clean-plugin</artifactId>
- <version>2.2</version>
- <configuration>
- <filesets>
- <fileset>
- <directory>${basedir}</directory>
- <includes>
- <include>sling-crankstart</include>
- </includes>
- </fileset>
- </filesets>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <systemProperties>
- <!-- pax url needs the local Maven repository to find snapshots we just built -->
- <org.ops4j.pax.url.mvn.localRepository>${settings.localRepository}/</org.ops4j.pax.url.mvn.localRepository>
- </systemProperties>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.sling</groupId>
- <artifactId>org.apache.sling.crankstart.api</artifactId>
- <version>1.0.1-SNAPSHOT</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.sling</groupId>
- <artifactId>org.apache.sling.crankstart.api.fragment</artifactId>
- <version>1.0.3-SNAPSHOT</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.sling</groupId>
- <artifactId>org.apache.sling.crankstart.core</artifactId>
- <version>1.0.1-SNAPSHOT</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.sling</groupId>
- <artifactId>org.apache.sling.crankstart.test.services</artifactId>
- <version>1.0.1-SNAPSHOT</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.sling</groupId>
- <artifactId>org.apache.sling.crankstart.sling.extensions</artifactId>
- <version>1.0.1-SNAPSHOT</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>1.7.6</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- <version>1.7.6</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.ops4j.pax.url</groupId>
- <artifactId>pax-url-aether</artifactId>
- <version>${pax.url.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.ops4j.pax.url</groupId>
- <artifactId>pax-url-commons</artifactId>
- <version>${pax.url.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.11</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.sling</groupId>
- <artifactId>org.apache.sling.commons.testing</artifactId>
- <version>2.0.16</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.sling</groupId>
- <artifactId>org.apache.sling.commons.json</artifactId>
- <version>2.0.6</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpclient</artifactId>
- <version>4.1</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <version>2.4</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
diff --git a/src/main/java/org/apache/sling/crankstart/launcher/CrankstartBootstrap.java b/src/main/java/org/apache/sling/crankstart/launcher/CrankstartBootstrap.java
deleted file mode 100644
index 80a47cc..0000000
--- a/src/main/java/org/apache/sling/crankstart/launcher/CrankstartBootstrap.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * 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.crankstart.launcher;
-
-import java.io.BufferedReader;
-import java.io.Closeable;
-import java.io.File;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.Reader;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.Callable;
-
-import org.apache.sling.crankstart.api.CrankstartConstants;
-
-/** Execute a crankstart file */
-public class CrankstartBootstrap {
- public static final String CLASSPATH_PREFIX = "classpath ";
- private final String crankFile;
- private final File tempFile;
-
- public CrankstartBootstrap(String filename) {
- tempFile = null;
- crankFile = filename;
- }
-
- public CrankstartBootstrap(Reader r) throws IOException {
- tempFile = File.createTempFile("CRANKSTART", "crank.txt");
- tempFile.deleteOnExit();
- crankFile = tempFile.getAbsolutePath();
-
- final FileWriter w = new FileWriter(tempFile);
- final char [] buf = new char[4096];
- int len = 0;
- try {
- while( (len = r.read(buf, 0, buf.length)) > 0) {
- w.write(buf, 0, len);
- }
- } finally {
- w.flush();
- w.close();
- }
- }
-
- private void cleanup() {
- if(tempFile != null) {
- tempFile.delete();
- }
- }
-
-
- public void start() throws Exception {
- System.setProperty(CrankstartConstants.CRANKSTART_INPUT_FILENAME, crankFile);
- System.setProperty( "java.protocol.handler.pkgs", "org.ops4j.pax.url" );
- final URL [] launcherClasspath = getClasspath(crankFile);
-
- final URLClassLoader launcherClassloader = new URLClassLoader(launcherClasspath, null);
-
- try {
- final String callableClass = "org.apache.sling.crankstart.core.CrankstartFileProcessor";
-
- @SuppressWarnings("unchecked")
- final Callable<Object> c = (Callable<Object>)launcherClassloader.loadClass(callableClass).newInstance();
- c.call();
- } finally {
- if(launcherClassloader instanceof Closeable) {
- ((Closeable)launcherClassloader).close();
- }
- cleanup();
- }
- }
-
- private static URL[] getClasspath(String filename) throws IOException {
- final List<URL> urls = new ArrayList<URL>();
- final Reader input = new FileReader(new File(filename));
- final BufferedReader r = new BufferedReader(input);
- try {
- String line = null;
- while((line = r.readLine()) != null) {
- if(line.length() == 0 || line.startsWith("#")) {
- // ignore comments and blank lines
- } else if(line.startsWith(CLASSPATH_PREFIX)){
- urls.add(new URL(line.substring(CLASSPATH_PREFIX.length()).trim()));
- }
- }
- return urls.toArray(new URL[] {});
- } finally {
- r.close();
- }
- }
-}
\ No newline at end of file
diff --git a/src/main/java/org/apache/sling/crankstart/launcher/Main.java b/src/main/java/org/apache/sling/crankstart/launcher/Main.java
deleted file mode 100644
index 5c4d30a..0000000
--- a/src/main/java/org/apache/sling/crankstart/launcher/Main.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.crankstart.launcher;
-
-import org.apache.sling.crankstart.api.CrankstartConstants;
-
-/** Execute a crankstart file */
-public class Main {
- public static final String CLASSPATH_PREFIX = "classpath ";
-
- public static void main(String [] args) throws Exception {
- String crankFile = "default.crank.txt";
- if(args.length < 1) {
- System.err.println("Using default crank file " + crankFile);
- System.err.println("To use a different one, provide its name as a jar file argument");
- } else {
- crankFile = args[0];
- }
- System.setProperty(CrankstartConstants.CRANKSTART_JAR_PATH, Main.class.getProtectionDomain().getCodeSource().getLocation().getPath());
- new CrankstartBootstrap(crankFile).start();
- }
-}
\ No newline at end of file
diff --git a/src/test/java/org/apache/sling/crankstart/launcher/CrankstartBootstrapTest.java b/src/test/java/org/apache/sling/crankstart/launcher/CrankstartBootstrapTest.java
deleted file mode 100644
index 4c2dbbd..0000000
--- a/src/test/java/org/apache/sling/crankstart/launcher/CrankstartBootstrapTest.java
+++ /dev/null
@@ -1,302 +0,0 @@
-package org.apache.sling.crankstart.launcher;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.net.ServerSocket;
-import java.util.Random;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.http.HttpResponse;
-import org.apache.http.auth.AuthScope;
-import org.apache.http.auth.UsernamePasswordCredentials;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.client.methods.HttpUriRequest;
-import org.apache.http.impl.client.DefaultHttpClient;
-import org.apache.http.util.EntityUtils;
-import org.apache.sling.commons.json.JSONArray;
-import org.apache.sling.commons.json.JSONObject;
-import org.apache.sling.commons.testing.junit.Retry;
-import org.apache.sling.commons.testing.junit.RetryRule;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Rule;
-import org.junit.Test;
-
-/** Verify that we can start the Felix HTTP service
- * with a {@link CrankstartBootstrap}.
- */
-public class CrankstartBootstrapTest {
-
- private static final int port = getAvailablePort();
- private static DefaultHttpClient client;
- private static Thread crankstartThread;
- private static String baseUrl = "http://localhost:" + port;
- public static final String TEST_RESOURCE = "/launcher-test.crank.txt";
- public static final String TEST_SYSTEM_PROPERTY = "the.test.system.property";
-
- @Rule
- public final RetryRule retryRule = new RetryRule();
-
- private static int getAvailablePort() {
- int result = -1;
- ServerSocket s = null;
- try {
- try {
- s = new ServerSocket(0);
- result = s.getLocalPort();
- } finally {
- if(s != null) {
- s.close();
- }
- }
- } catch(Exception e) {
- throw new RuntimeException("getAvailablePort failed", e);
- }
- return result;
- }
-
- @Before
- public void setupHttpClient() {
- client = new DefaultHttpClient();
- }
-
- private void setAdminCredentials() {
- client.getCredentialsProvider().setCredentials(
- AuthScope.ANY,
- new UsernamePasswordCredentials("admin", "admin"));
- client.addRequestInterceptor(new PreemptiveAuthInterceptor(), 0);
- }
-
- @BeforeClass
- public static void testExtensionPropertyBeforeTests() {
- assertNull(TEST_SYSTEM_PROPERTY + " should not be set before tests", System.getProperty(TEST_SYSTEM_PROPERTY));
- }
-
- @BeforeClass
- public static void setup() {
- client = new DefaultHttpClient();
- final HttpUriRequest get = new HttpGet(baseUrl);
- System.setProperty("http.port", String.valueOf(port));
- System.setProperty("osgi.storage.path", getOsgiStoragePath());
-
- final InputStream is = CrankstartBootstrapTest.class.getResourceAsStream(TEST_RESOURCE);
- assertNotNull("Expecting test resource to be found:" + TEST_RESOURCE, is);
- final Reader input = new InputStreamReader(is);
-
- try {
- client.execute(get);
- fail("Expecting connection to " + port + " to fail before starting HTTP service");
- } catch(IOException expected) {
- }
-
- crankstartThread = new Thread() {
- public void run() {
- try {
- new CrankstartBootstrap(input).start();
- } catch(Exception e) {
- e.printStackTrace();
- fail("CrankstartBootstrap exception:" + e);
- } finally {
- try {
- input.close();
- } catch(IOException ignoreTheresNotMuchWeCanDoAnyway) {
- }
- }
- }
- };
- crankstartThread.setDaemon(true);
- crankstartThread.start();
- }
-
- @AfterClass
- public static void cleanup() throws InterruptedException {
- crankstartThread.interrupt();
- crankstartThread.join();
- }
-
- private void closeConnection(HttpResponse r) throws IOException {
- if(r != null && r.getEntity() != null) {
- EntityUtils.consume(r.getEntity());
- }
- }
-
- @Test
- @Retry(timeoutMsec=10000, intervalMsec=250)
- public void testHttpRoot() throws Exception {
- final HttpUriRequest get = new HttpGet(baseUrl);
- HttpResponse response = null;
- try {
- response = client.execute(get);
- assertEquals("Expecting page not found at " + get.getURI(), 404, response.getStatusLine().getStatusCode());
- } finally {
- closeConnection(response);
- }
- }
-
- @Test
- @Retry(timeoutMsec=10000, intervalMsec=250)
- public void testSingleConfigServlet() throws Exception {
- final HttpUriRequest get = new HttpGet(baseUrl + "/single");
- HttpResponse response = null;
- try {
- response = client.execute(get);
- assertEquals("Expecting success for " + get.getURI(), 200, response.getStatusLine().getStatusCode());
- } finally {
- closeConnection(response);
- }
- }
-
- @Test
- @Retry(timeoutMsec=10000, intervalMsec=250)
- public void testConfigFactoryServlet() throws Exception {
- final String [] paths = { "/foo", "/bar/test" };
- for(String path : paths) {
- final HttpUriRequest get = new HttpGet(baseUrl + path);
- HttpResponse response = null;
- try {
- response = client.execute(get);
- assertEquals("Expecting success for " + get.getURI(), 200, response.getStatusLine().getStatusCode());
- } finally {
- closeConnection(response);
- }
- }
- }
-
- @Test
- public void testExtensionCommand() {
- // The SystemPropertyCommand, provided by our test-services bundle, should have
- // processed the test.system.property instruction in our launcher file
- assertEquals("was set by test-services bundle", System.getProperty(TEST_SYSTEM_PROPERTY));
- }
-
- @Test
- @Retry(timeoutMsec=10000, intervalMsec=250)
- public void testJUnitServlet() throws Exception {
- final String path = "/system/sling/junit";
- final HttpUriRequest get = new HttpGet(baseUrl + path);
- HttpResponse response = null;
- try {
- response = client.execute(get);
- assertEquals("Expecting JUnit servlet to be installed via sling extension command, at " + get.getURI(), 200, response.getStatusLine().getStatusCode());
- } finally {
- closeConnection(response);
- }
- }
-
- @Test
- @Retry(timeoutMsec=10000, intervalMsec=250)
- public void testAdditionalBundles() throws Exception {
- setAdminCredentials();
- final String basePath = "/system/console/bundles/";
- final String [] addBundles = {
- "org.apache.sling.commons.mime",
- "org.apache.sling.settings"
- };
-
- for(String name : addBundles) {
- final String path = basePath + name;
- final HttpUriRequest get = new HttpGet(baseUrl + path);
- HttpResponse response = null;
- try {
- response = client.execute(get);
- assertEquals("Expecting additional bundle to be present at " + get.getURI(), 200, response.getStatusLine().getStatusCode());
- } finally {
- closeConnection(response);
- }
- }
- }
-
- @Test
- @Retry(timeoutMsec=10000, intervalMsec=250)
- public void testSpecificStartLevel() throws Exception {
- // Verify that this bundle is only installed, as it's set to start level 99
- setAdminCredentials();
- final String path = "/system/console/bundles/org.apache.commons.collections.json";
- final HttpUriRequest get = new HttpGet(baseUrl + path);
- HttpResponse response = null;
- try {
- response = client.execute(get);
- assertEquals("Expecting bundle status to be available at " + get.getURI(), 200, response.getStatusLine().getStatusCode());
- assertNotNull("Expecting response entity", response.getEntity());
- String encoding = "UTF-8";
- if(response.getEntity().getContentEncoding() != null) {
- encoding = response.getEntity().getContentEncoding().getValue();
- }
- final String content = IOUtils.toString(response.getEntity().getContent(), encoding);
-
- // Start level is in the props array, with key="Start Level"
- final JSONObject status = new JSONObject(content);
- final JSONArray props = status.getJSONArray("data").getJSONObject(0).getJSONArray("props");
- final String KEY = "key";
- final String SL = "Start Level";
- boolean found = false;
- for(int i=0; i < props.length(); i++) {
- final JSONObject o = props.getJSONObject(i);
- if(o.has(KEY) && SL.equals(o.getString(KEY))) {
- found = true;
- assertEquals("Expecting the start level that we set", "99", o.getString("value"));
- }
- }
- assertTrue("Expecting start level to be found in JSON output", found);
- } finally {
- closeConnection(response);
- }
- }
-
- @Test
- @Retry(timeoutMsec=10000, intervalMsec=250)
- public void testEmptyConfig() throws Exception {
- setAdminCredentials();
- assertHttpGet(
- "/test/config/empty.config.should.work",
- "empty.config.should.work#service.pid=(String)empty.config.should.work##EOC#");
- }
-
- @Test
- @Retry(timeoutMsec=10000, intervalMsec=250)
- public void testFelixFormatConfig() throws Exception {
- setAdminCredentials();
- assertHttpGet(
- "/test/config/felix.format.test",
- "felix.format.test#array=(String[])[foo, bar.from.launcher.test]#mongouri=(String)mongodb://localhost:27017#service.pid=(String)felix.format.test#service.ranking.launcher.test=(Integer)54321##EOC#");
- }
-
- private void assertHttpGet(String path, String expectedContent) throws Exception {
- final HttpUriRequest get = new HttpGet(baseUrl + path);
- HttpResponse response = null;
- try {
- response = client.execute(get);
- assertEquals("Expecting 200 response at " + path, 200, response.getStatusLine().getStatusCode());
- assertNotNull("Expecting response entity", response.getEntity());
- String encoding = "UTF-8";
- if(response.getEntity().getContentEncoding() != null) {
- encoding = response.getEntity().getContentEncoding().getValue();
- }
- final String content = IOUtils.toString(response.getEntity().getContent(), encoding);
- assertEquals(expectedContent, content);
- } finally {
- closeConnection(response);
- }
- }
-
- private static String getOsgiStoragePath() {
- final File tmpRoot = new File(System.getProperty("java.io.tmpdir"));
- final Random random = new Random();
- final File tmpFolder = new File(tmpRoot, System.currentTimeMillis() + "_" + random.nextInt());
- if(!tmpFolder.mkdir()) {
- fail("Failed to create " + tmpFolder.getAbsolutePath());
- }
- tmpFolder.deleteOnExit();
- return tmpFolder.getAbsolutePath();
- }
-}
\ No newline at end of file
diff --git a/src/test/java/org/apache/sling/crankstart/launcher/PreemptiveAuthInterceptor.java b/src/test/java/org/apache/sling/crankstart/launcher/PreemptiveAuthInterceptor.java
deleted file mode 100644
index 5e82a54..0000000
--- a/src/test/java/org/apache/sling/crankstart/launcher/PreemptiveAuthInterceptor.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package org.apache.sling.crankstart.launcher;
-
-import java.io.IOException;
-
-import org.apache.http.HttpException;
-import org.apache.http.HttpHost;
-import org.apache.http.HttpRequest;
-import org.apache.http.HttpRequestInterceptor;
-import org.apache.http.auth.AuthScope;
-import org.apache.http.auth.AuthState;
-import org.apache.http.auth.Credentials;
-import org.apache.http.client.CredentialsProvider;
-import org.apache.http.client.protocol.ClientContext;
-import org.apache.http.impl.auth.BasicScheme;
-import org.apache.http.protocol.ExecutionContext;
-import org.apache.http.protocol.HttpContext;
-
-/** It's not like httpclient 4.1 makes this simple... */
-class PreemptiveAuthInterceptor implements HttpRequestInterceptor {
-
- public void process(HttpRequest request, HttpContext context) throws HttpException, IOException {
-
- AuthState authState = (AuthState) context.getAttribute(ClientContext.TARGET_AUTH_STATE);
- CredentialsProvider credsProvider = (CredentialsProvider) context.getAttribute(ClientContext.CREDS_PROVIDER);
- HttpHost targetHost = (HttpHost) context.getAttribute(ExecutionContext.HTTP_TARGET_HOST);
-
- // If not auth scheme has been initialized yet
- if (authState.getAuthScheme() == null) {
- AuthScope authScope = new AuthScope(targetHost.getHostName(), targetHost.getPort());
-
- // Obtain credentials matching the target host
- Credentials creds = credsProvider.getCredentials(authScope);
-
- // If found, generate BasicScheme preemptively
- if (creds != null) {
- authState.setAuthScheme(new BasicScheme());
- authState.setCredentials(creds);
- }
- }
- }
-}
diff --git a/src/test/resources/launcher-test.crank.txt b/src/test/resources/launcher-test.crank.txt
deleted file mode 100644
index 0b73fa8..0000000
--- a/src/test/resources/launcher-test.crank.txt
+++ /dev/null
@@ -1,70 +0,0 @@
-# Test the crankstart launcher by setting up an HTTP
-# server with a few servlets that require specific OSGi configurations
-
-# Default values for our variables
-defaults single.path /single
-
-# Bootstrap classpath (variables are not supported here)
-classpath mvn:org.apache.felix/org.apache.felix.framework/4.4.0
-classpath mvn:org.slf4j/slf4j-api/1.6.2
-classpath mvn:org.slf4j/slf4j-simple/1.6.2
-classpath mvn:org.apache.sling/org.apache.sling.crankstart.core/1.0.1-SNAPSHOT
-classpath mvn:org.apache.sling/org.apache.sling.crankstart.api/1.0.1-SNAPSHOT
-classpath mvn:org.apache.sling/org.apache.sling.provisioning.model/1.1.0
-
-# OSGi properties
-osgi.property org.osgi.service.http.port ${http.port}
-osgi.property org.osgi.framework.storage ${osgi.storage.path}
-
-# Start the framework. Crankstart file processing will stop here
-# if this is not the first startup.
-start.framework
-
-# The crankstart.api.fragment bundle makes the crankstart.api package available
-# to bundles, required for bundles to provide crankstart extension commands like
-# the test.system.property command below
-bundle mvn:org.apache.sling/org.apache.sling.crankstart.api.fragment/1.0.3-SNAPSHOT
-bundle mvn:org.apache.sling/org.apache.sling.crankstart.test.services/1.0.1-SNAPSHOT
-
-# Add provisioning model artifacts
-# TODO move all bundles there
-provisioning.model src/test/resources/provisioning-model
-
-# Now start our bundles
-start.all.bundles
-
-# OSGi configs that activate our test servlets
-config org.apache.sling.crankstart.testservices.SingleConfigServlet
- path=${single.path}
- message=doesn't matter
-
-config.factory org.apache.sling.crankstart.testservices.ConfigFactoryServlet
- CRANKSTART_CONFIG_ID=some.unique.ID
- path=/foo
- message=Not used
-
-config.factory org.apache.sling.crankstart.testservices.ConfigFactoryServlet
- path=/bar/test
- message=Not used
-
-# Test Felix format configs
-config felix.format.test FORMAT:felix.config
- mongouri="mongodb://localhost:27017"
- service.ranking.launcher.test=I"54321"
- array=["foo","bar.from.launcher.test"]
-
-config empty.config.should.work FORMAT:felix.config
-
-# Test an extension command provided by our test-services bundle
-test.system.property the.test.system.property was set by test-services bundle
-
-# Prepare additional resources for the Sling installer
-sling.installer.resource mvn:org.apache.sling/org.apache.sling.junit.core/1.0.8
-sling.installer.resource mvn:org.apache.sling/org.apache.sling.commons.mime/2.1.4
-sling.installer.resource mvn:org.apache.sling/org.apache.sling.settings/1.3.0
-
-# And register the installer resources
-sling.installer.register crankstart
-
-# Informative log
-log felix http service should come up at http://localhost:${http.port}
diff --git a/src/test/resources/provisioning-model/base.txt b/src/test/resources/provisioning-model/base.txt
deleted file mode 100644
index 16a4b23..0000000
--- a/src/test/resources/provisioning-model/base.txt
+++ /dev/null
@@ -1,39 +0,0 @@
-#
-# 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.
-#
-# This is a feature description
-#
-# A feature consists of variables and run mode dependent artifacts.
-#
-
-# Test our Sling extension commands, that add a bundle via the Sling installer
-# (which requires commons.json and jcr-wrapper)
-[feature name=crankstart.test.base]
-
-[variables]
- felix.http.jetty.version=2.2.0
-
-[artifacts]
- org.apache.felix/org.apache.felix.http.jetty/${felix.http.jetty.version}
- org.apache.felix/org.apache.felix.eventadmin/1.3.2
- org.apache.felix/org.apache.felix.scr/1.8.2
- org.apache.felix/org.apache.felix.metatype/1.0.10
- org.apache.sling/org.apache.sling.commons.osgi/2.2.0
- org.apache.sling/org.apache.sling.commons.log/2.1.2
- org.apache.felix/org.apache.felix.configadmin/1.6.0
- org.apache.felix/org.apache.felix.webconsole/3.1.6
\ No newline at end of file
diff --git a/src/test/resources/provisioning-model/sling-extensions.txt b/src/test/resources/provisioning-model/sling-extensions.txt
deleted file mode 100644
index 3cc7634..0000000
--- a/src/test/resources/provisioning-model/sling-extensions.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-#
-# 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.
-#
-# This is a feature description
-#
-# A feature consists of variables and run mode dependent artifacts.
-#
-
-# Test our Sling extension commands, that add a bundle via the Sling installer
-# (which requires commons.json and jcr-wrapper)
-[feature name=sling.extensions]
-
-[artifacts]
- org.apache.sling/org.apache.sling.installer.core/3.5.0
- org.apache.sling/org.apache.sling.commons.json/2.0.6
- org.apache.sling/org.apache.sling.jcr.jcr-wrapper/2.0.0
- org.apache.sling/org.apache.sling.crankstart.sling.extensions/1.0.1-SNAPSHOT
- commons-io/commons-io/2.4
diff --git a/src/test/resources/provisioning-model/start-level-99.txt b/src/test/resources/provisioning-model/start-level-99.txt
deleted file mode 100644
index 922a2de..0000000
--- a/src/test/resources/provisioning-model/start-level-99.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# 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.
-#
-# Add a bundle at a start level higher that our framework's to verify
-# that it is installed but not active
-[feature name=startlevel99]
-
-[artifacts startLevel=99]
- commons-collections/commons-collections/3.2.1