Author: sseifert
Date: Mon Dec 15 20:26:26 2014
New Revision: 1645738
URL: http://svn.apache.org/r1645738
Log:
SLING-4249 Testing Tools: Refresh Packages should be called after installing or
uninstalling bundles
Added:
sling/trunk/testing/tools/src/main/java/org/apache/sling/testing/tools/osgi/package-info.java
(with props)
Modified:
sling/trunk/testing/tools/src/main/java/org/apache/sling/testing/tools/osgi/WebconsoleClient.java
sling/trunk/testing/tools/src/main/java/org/apache/sling/testing/tools/sling/BundlesInstaller.java
Modified:
sling/trunk/testing/tools/src/main/java/org/apache/sling/testing/tools/osgi/WebconsoleClient.java
URL:
http://svn.apache.org/viewvc/sling/trunk/testing/tools/src/main/java/org/apache/sling/testing/tools/osgi/WebconsoleClient.java?rev=1645738&r1=1645737&r2=1645738&view=diff
==============================================================================
---
sling/trunk/testing/tools/src/main/java/org/apache/sling/testing/tools/osgi/WebconsoleClient.java
(original)
+++
sling/trunk/testing/tools/src/main/java/org/apache/sling/testing/tools/osgi/WebconsoleClient.java
Mon Dec 15 20:26:26 2014
@@ -56,6 +56,8 @@ public class WebconsoleClient {
public void uninstallBundle(String symbolicName, File f) throws Exception {
final long bundleId = getBundleId(symbolicName);
+ log.info("Uninstalling bundle {} with bundleId {}", symbolicName,
bundleId);
+
final MultipartEntity entity = new MultipartEntity();
entity.addPart("action",new StringBody("uninstall"));
executor.execute(
@@ -171,4 +173,19 @@ public class WebconsoleClient {
return CONSOLE_BUNDLES_PATH + "/" + symbolicName
+ (extension == null ? "" : extension);
}
+
+ /** Calls PackageAdmin.refreshPackages to enforce re-wiring of all
bundles. */
+ public void refreshPackages() throws Exception {
+ log.info("Refresh packages.");
+
+ final MultipartEntity entity = new MultipartEntity();
+ entity.addPart("action", new StringBody("refreshPackages"));
+
+ executor.execute(
+ builder.buildPostRequest(CONSOLE_BUNDLES_PATH)
+ .withCredentials(username, password)
+ .withEntity(entity)
+ ).assertStatus(200);
+ }
+
}
Added:
sling/trunk/testing/tools/src/main/java/org/apache/sling/testing/tools/osgi/package-info.java
URL:
http://svn.apache.org/viewvc/sling/trunk/testing/tools/src/main/java/org/apache/sling/testing/tools/osgi/package-info.java?rev=1645738&view=auto
==============================================================================
---
sling/trunk/testing/tools/src/main/java/org/apache/sling/testing/tools/osgi/package-info.java
(added)
+++
sling/trunk/testing/tools/src/main/java/org/apache/sling/testing/tools/osgi/package-info.java
Mon Dec 15 20:26:26 2014
@@ -0,0 +1,23 @@
+/*
+ * 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.
+ */
+/**
+ * OSGI testing tools.
+ */
[email protected]("1.1")
+package org.apache.sling.testing.tools.osgi;
Propchange:
sling/trunk/testing/tools/src/main/java/org/apache/sling/testing/tools/osgi/package-info.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
sling/trunk/testing/tools/src/main/java/org/apache/sling/testing/tools/osgi/package-info.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Mon Dec 15 20:26:26 2014
@@ -0,0 +1 @@
+LastChangedDate LastChangedRevision LastChangedBy HeadURL Id Author
Propchange:
sling/trunk/testing/tools/src/main/java/org/apache/sling/testing/tools/osgi/package-info.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified:
sling/trunk/testing/tools/src/main/java/org/apache/sling/testing/tools/sling/BundlesInstaller.java
URL:
http://svn.apache.org/viewvc/sling/trunk/testing/tools/src/main/java/org/apache/sling/testing/tools/sling/BundlesInstaller.java?rev=1645738&r1=1645737&r2=1645738&view=diff
==============================================================================
---
sling/trunk/testing/tools/src/main/java/org/apache/sling/testing/tools/sling/BundlesInstaller.java
(original)
+++
sling/trunk/testing/tools/src/main/java/org/apache/sling/testing/tools/sling/BundlesInstaller.java
Mon Dec 15 20:26:26 2014
@@ -88,6 +88,10 @@ public class BundlesInstaller {
}
webconsoleClient.installBundle(f, startBundles);
}
+
+ // ensure that bundles are re-wired esp. if an existing bundle was
updated
+ webconsoleClient.refreshPackages();
+
log.info("{} additional bundles installed from {}", toInstall.size(),
toInstall.get(0).getAbsolutePath());
}