You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ace.apache.org by ja...@apache.org on 2012/07/12 17:23:21 UTC
svn commit: r1360724 - in /ace/sandbox/marrs: build/
org.apache.ace.authentication/
org.apache.ace.authenticationprocessor.basicauth/
org.apache.ace.authenticationprocessor.clientcert/
org.apache.ace.authenticationprocessor.password/ org.apache.ace.cli...
Author: jawi
Date: Thu Jul 12 15:23:19 2012
New Revision: 1360724
URL: http://svn.apache.org/viewvc?rev=1360724&view=rev
Log:
Refactored away the util project. All test utilities are moved to the itest project (which should get a better name); all other utilities are moved to the projects that used them.
Added:
ace/sandbox/marrs/org.apache.ace.client.repository.helper.bundle/src/org/apache/ace/client/repository/helper/bundle/impl/VersionRange.java (with props)
ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/
ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/constants/
ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/constants/TestConstants.java (with props)
ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/constants/packageinfo
ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/utils/
ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/utils/FileUtils.java (with props)
ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/utils/NetUtils.java (with props)
ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/utils/TestUtils.java (with props)
ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/utils/Util.java (with props)
ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/utils/deployment/
ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/utils/deployment/BundleStreamGenerator.java (with props)
ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/utils/deployment/TestData.java (with props)
ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/utils/deployment/TestProvider.java (with props)
ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/utils/deployment/packageinfo
ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/utils/packageinfo
ace/sandbox/marrs/org.apache.ace.log/src/org/apache/ace/log/util/
ace/sandbox/marrs/org.apache.ace.log/src/org/apache/ace/log/util/Codec.java (with props)
Modified:
ace/sandbox/marrs/build/bin-build.xml
ace/sandbox/marrs/org.apache.ace.authentication/bnd.bnd
ace/sandbox/marrs/org.apache.ace.authenticationprocessor.basicauth/bnd.bnd
ace/sandbox/marrs/org.apache.ace.authenticationprocessor.clientcert/bnd.bnd
ace/sandbox/marrs/org.apache.ace.authenticationprocessor.password/bnd.bnd
ace/sandbox/marrs/org.apache.ace.client.repository.helper.bundle/bnd.bnd
ace/sandbox/marrs/org.apache.ace.client.repository.helper.bundle/src/org/apache/ace/client/repository/helper/bundle/impl/BundleHelperImpl.java
ace/sandbox/marrs/org.apache.ace.configurator/bnd.bnd
ace/sandbox/marrs/org.apache.ace.connectionfactory/bnd.bnd
ace/sandbox/marrs/org.apache.ace.deployment.deploymentadmin/bnd.bnd
ace/sandbox/marrs/org.apache.ace.deployment.streamgenerator/bnd.bnd
ace/sandbox/marrs/org.apache.ace.deployment.verifier/bnd.bnd
ace/sandbox/marrs/org.apache.ace.discovery.property/bnd.bnd
ace/sandbox/marrs/org.apache.ace.discovery.upnp/bnd.bnd
ace/sandbox/marrs/org.apache.ace.http.itest/bnd.bnd
ace/sandbox/marrs/org.apache.ace.identification.ifconfig/bnd.bnd
ace/sandbox/marrs/org.apache.ace.identification.property/bnd.bnd
ace/sandbox/marrs/org.apache.ace.itest/bnd.bnd
ace/sandbox/marrs/org.apache.ace.log/bnd.bnd
ace/sandbox/marrs/org.apache.ace.log/src/org/apache/ace/log/LogDescriptor.java
ace/sandbox/marrs/org.apache.ace.log/src/org/apache/ace/log/LogEvent.java
ace/sandbox/marrs/org.apache.ace.nodelauncher.amazon/bnd.bnd
ace/sandbox/marrs/org.apache.ace.processlauncher/bnd.bnd
ace/sandbox/marrs/org.apache.ace.range.api/bnd.bnd
ace/sandbox/marrs/org.apache.ace.repository.impl/bnd.bnd
ace/sandbox/marrs/org.apache.ace.scheduler/bnd.bnd
ace/sandbox/marrs/org.apache.ace.server.log.store/bnd.bnd
ace/sandbox/marrs/org.apache.ace.util/bnd.bnd
ace/sandbox/marrs/org.apache.ace.webui.vaadin/bnd.bnd
ace/sandbox/marrs/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/VaadinClient.java
Modified: ace/sandbox/marrs/build/bin-build.xml
URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/build/bin-build.xml?rev=1360724&r1=1360723&r2=1360724&view=diff
==============================================================================
--- ace/sandbox/marrs/build/bin-build.xml (original)
+++ ace/sandbox/marrs/build/bin-build.xml Thu Jul 12 15:23:19 2012
@@ -55,7 +55,6 @@
<file file="../org.apache.ace.range.api/generated/org.apache.ace.range.api.jar" />
<file file="../org.apache.ace.log/generated/org.apache.ace.log.jar" />
<file file="../org.apache.ace.authenticationprocessor.password/generated/org.apache.ace.authenticationprocessor.password.jar" />
- <file file="../org.apache.ace.util/generated/org.apache.ace.util.jar" />
<file file="../org.apache.ace.webui.vaadin/generated/org.apache.ace.webui.vaadin.jar" />
<file file="../org.apache.ace.resourceprocessor.useradmin/generated/org.apache.ace.resourceprocessor.useradmin.jar" />
<file file="../org.apache.ace.server.log.ui/generated/org.apache.ace.server.log.ui.jar" />
Modified: ace/sandbox/marrs/org.apache.ace.authentication/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.authentication/bnd.bnd?rev=1360724&r1=1360723&r2=1360724&view=diff
==============================================================================
--- ace/sandbox/marrs/org.apache.ace.authentication/bnd.bnd (original)
+++ ace/sandbox/marrs/org.apache.ace.authentication/bnd.bnd Thu Jul 12 15:23:19 2012
@@ -3,6 +3,6 @@
osgi.cmpn,\
org.apache.felix.dependencymanager,\
org.mockito.mockito-all,\
- org.apache.ace.util;version=latest
+ org.apache.ace.itest;version=latest
Private-Package: org.apache.ace.authentication.impl
Bundle-Activator: org.apache.ace.authentication.impl.Activator
\ No newline at end of file
Modified: ace/sandbox/marrs/org.apache.ace.authenticationprocessor.basicauth/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.authenticationprocessor.basicauth/bnd.bnd?rev=1360724&r1=1360723&r2=1360724&view=diff
==============================================================================
--- ace/sandbox/marrs/org.apache.ace.authenticationprocessor.basicauth/bnd.bnd (original)
+++ ace/sandbox/marrs/org.apache.ace.authenticationprocessor.basicauth/bnd.bnd Thu Jul 12 15:23:19 2012
@@ -1,10 +1,10 @@
-buildpath: osgi.core,\
osgi.cmpn,\
- org.apache.ace.util;version=latest,\
- org.apache.ace.authentication.api;version=latest,\
javax.servlet,\
org.apache.felix.dependencymanager,\
+ org.apache.ace.authentication.api;version=latest,\
../cnf/lib/commons-codec-1.4.jar;version=file,\
+ org.apache.ace.itest;version=latest,\
org.mockito.mockito-all
Private-Package: org.apache.ace.authenticationprocessor.basicauth,\
org.apache.commons.codec,\
Modified: ace/sandbox/marrs/org.apache.ace.authenticationprocessor.clientcert/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.authenticationprocessor.clientcert/bnd.bnd?rev=1360724&r1=1360723&r2=1360724&view=diff
==============================================================================
--- ace/sandbox/marrs/org.apache.ace.authenticationprocessor.clientcert/bnd.bnd (original)
+++ ace/sandbox/marrs/org.apache.ace.authenticationprocessor.clientcert/bnd.bnd Thu Jul 12 15:23:19 2012
@@ -1,10 +1,10 @@
-buildpath: osgi.core,\
osgi.cmpn,\
javax.servlet,\
+ org.apache.felix.dependencymanager,\
org.apache.ace.authentication.api;version=latest,\
- org.apache.ace.util;version=latest,\
../cnf/lib/bcprov-jdk14-140.jar;version=file,\
- org.apache.felix.dependencymanager,\
+ org.apache.ace.itest;version=latest,\
org.mockito.mockito-all
Private-Package: org.apache.ace.authenticationprocessor.clientcert
Bundle-Activator: org.apache.ace.authenticationprocessor.clientcert.Activator
\ No newline at end of file
Modified: ace/sandbox/marrs/org.apache.ace.authenticationprocessor.password/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.authenticationprocessor.password/bnd.bnd?rev=1360724&r1=1360723&r2=1360724&view=diff
==============================================================================
--- ace/sandbox/marrs/org.apache.ace.authenticationprocessor.password/bnd.bnd (original)
+++ ace/sandbox/marrs/org.apache.ace.authenticationprocessor.password/bnd.bnd Thu Jul 12 15:23:19 2012
@@ -1,9 +1,9 @@
-buildpath: osgi.core,\
osgi.cmpn,\
- org.apache.ace.util;version=latest,\
org.apache.felix.dependencymanager,\
org.apache.ace.authentication.api;version=latest,\
../cnf/lib/commons-codec-1.4.jar;version=file,\
+ org.apache.ace.itest;version=latest,\
org.mockito.mockito-all
Private-Package: org.apache.ace.authenticationprocessor.password,\
org.apache.commons.codec,\
Modified: ace/sandbox/marrs/org.apache.ace.client.repository.helper.bundle/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.client.repository.helper.bundle/bnd.bnd?rev=1360724&r1=1360723&r2=1360724&view=diff
==============================================================================
--- ace/sandbox/marrs/org.apache.ace.client.repository.helper.bundle/bnd.bnd (original)
+++ ace/sandbox/marrs/org.apache.ace.client.repository.helper.bundle/bnd.bnd Thu Jul 12 15:23:19 2012
@@ -3,6 +3,5 @@
org.apache.felix.dependencymanager,\
org.apache.ace.client.repository.api;version=latest,\
org.apache.ace.util;version=latest
-Private-Package: org.apache.ace.client.repository.helper.bundle.impl,\
- org.apache.ace.util
+Private-Package: org.apache.ace.client.repository.helper.bundle.impl
Bundle-Activator: org.apache.ace.client.repository.helper.bundle.impl.Activator
\ No newline at end of file
Modified: ace/sandbox/marrs/org.apache.ace.client.repository.helper.bundle/src/org/apache/ace/client/repository/helper/bundle/impl/BundleHelperImpl.java
URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.client.repository.helper.bundle/src/org/apache/ace/client/repository/helper/bundle/impl/BundleHelperImpl.java?rev=1360724&r1=1360723&r2=1360724&view=diff
==============================================================================
--- ace/sandbox/marrs/org.apache.ace.client.repository.helper.bundle/src/org/apache/ace/client/repository/helper/bundle/impl/BundleHelperImpl.java (original)
+++ ace/sandbox/marrs/org.apache.ace.client.repository.helper.bundle/src/org/apache/ace/client/repository/helper/bundle/impl/BundleHelperImpl.java Thu Jul 12 15:23:19 2012
@@ -33,7 +33,6 @@ import org.apache.ace.client.repository.
import org.apache.ace.client.repository.helper.ArtifactResource;
import org.apache.ace.client.repository.helper.bundle.BundleHelper;
import org.apache.ace.client.repository.object.ArtifactObject;
-import org.apache.ace.util.VersionRange;
import org.osgi.framework.Version;
/**
Added: ace/sandbox/marrs/org.apache.ace.client.repository.helper.bundle/src/org/apache/ace/client/repository/helper/bundle/impl/VersionRange.java
URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.client.repository.helper.bundle/src/org/apache/ace/client/repository/helper/bundle/impl/VersionRange.java?rev=1360724&view=auto
==============================================================================
--- ace/sandbox/marrs/org.apache.ace.client.repository.helper.bundle/src/org/apache/ace/client/repository/helper/bundle/impl/VersionRange.java (added)
+++ ace/sandbox/marrs/org.apache.ace.client.repository.helper.bundle/src/org/apache/ace/client/repository/helper/bundle/impl/VersionRange.java Thu Jul 12 15:23:19 2012
@@ -0,0 +1,109 @@
+/*
+ * 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.ace.client.repository.helper.bundle.impl;
+
+import org.osgi.framework.Version;
+
+class VersionRange
+{
+ private Version m_low = null;
+ private boolean m_isLowInclusive = false;
+ private Version m_high = null;
+ private boolean m_isHighInclusive = false;
+ private String m_toString = null;
+
+ public static final VersionRange infiniteRange = new VersionRange(
+ Version.emptyVersion, true, null, true);
+
+ public VersionRange(Version low, boolean isLowInclusive, Version high, boolean isHighInclusive) {
+ m_low = low;
+ m_isLowInclusive = isLowInclusive;
+ m_high = high;
+ m_isHighInclusive = isHighInclusive;
+ }
+
+ public Version getLow() {
+ return m_low;
+ }
+
+ public boolean isLowInclusive() {
+ return m_isLowInclusive;
+ }
+
+ public Version getHigh() {
+ return m_high;
+ }
+
+ public boolean isHighInclusive() {
+ return m_isHighInclusive;
+ }
+
+ public boolean isInRange(Version version) {
+ // We might not have an upper end to the range.
+ if (m_high == null) {
+ return (version.compareTo(m_low) >= 0);
+ }
+ else if (isLowInclusive() && isHighInclusive()) {
+ return (version.compareTo(m_low) >= 0) &&
+ (version.compareTo(m_high) <= 0);
+ }
+ else if (isHighInclusive()) {
+ return (version.compareTo(m_low) > 0) &&
+ (version.compareTo(m_high) <= 0);
+ }
+ else if (isLowInclusive()) {
+ return (version.compareTo(m_low) >= 0) &&
+ (version.compareTo(m_high) < 0);
+ }
+ return (version.compareTo(m_low) > 0) &&
+ (version.compareTo(m_high) < 0);
+ }
+
+ public static VersionRange parse(String range) {
+ // Check if the version is an interval.
+ if (range.indexOf(',') >= 0) {
+ String s = range.substring(1, range.length() - 1);
+ String vlo = s.substring(0, s.indexOf(',')).trim();
+ String vhi = s.substring(s.indexOf(',') + 1, s.length()).trim();
+ return new VersionRange(new Version(vlo), (range.charAt(0) == '['),
+ new Version(vhi), (range.charAt(range.length() - 1) == ']'));
+ }
+ else {
+ return new VersionRange(new Version(range), true, null, false);
+ }
+ }
+
+ public String toString() {
+ if (m_toString == null) {
+ if (m_high != null) {
+ StringBuffer sb = new StringBuffer();
+ sb.append(m_isLowInclusive ? '[' : '(');
+ sb.append(m_low.toString());
+ sb.append(',');
+ sb.append(m_high.toString());
+ sb.append(m_isHighInclusive ? ']' : ')');
+ m_toString = sb.toString();
+ }
+ else {
+ m_toString = m_low.toString();
+ }
+ }
+ return m_toString;
+ }
+}
\ No newline at end of file
Propchange: ace/sandbox/marrs/org.apache.ace.client.repository.helper.bundle/src/org/apache/ace/client/repository/helper/bundle/impl/VersionRange.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: ace/sandbox/marrs/org.apache.ace.configurator/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.configurator/bnd.bnd?rev=1360724&r1=1360723&r2=1360724&view=diff
==============================================================================
--- ace/sandbox/marrs/org.apache.ace.configurator/bnd.bnd (original)
+++ ace/sandbox/marrs/org.apache.ace.configurator/bnd.bnd Thu Jul 12 15:23:19 2012
@@ -1,7 +1,7 @@
-buildpath: osgi.core,\
osgi.cmpn,\
org.apache.felix.dependencymanager,\
- org.apache.ace.util;version=latest,\
+ org.apache.ace.itest;version=latest,\
../cnf/lib/commons-io-2.0.1.jar;version=file
Bundle-Activator: org.apache.ace.configurator.Activator
Private-Package: org.apache.ace.configurator
\ No newline at end of file
Modified: ace/sandbox/marrs/org.apache.ace.connectionfactory/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.connectionfactory/bnd.bnd?rev=1360724&r1=1360723&r2=1360724&view=diff
==============================================================================
--- ace/sandbox/marrs/org.apache.ace.connectionfactory/bnd.bnd (original)
+++ ace/sandbox/marrs/org.apache.ace.connectionfactory/bnd.bnd Thu Jul 12 15:23:19 2012
@@ -1,6 +1,6 @@
-buildpath: osgi.core,\
osgi.cmpn,\
- org.apache.ace.util;version=latest,\
+ org.apache.ace.itest;version=latest,\
../cnf/lib/commons-codec-1.4.jar;version=file
Private-Package: org.apache.ace.connectionfactory.impl,\
org.apache.commons.codec,\
Modified: ace/sandbox/marrs/org.apache.ace.deployment.deploymentadmin/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.deployment.deploymentadmin/bnd.bnd?rev=1360724&r1=1360723&r2=1360724&view=diff
==============================================================================
--- ace/sandbox/marrs/org.apache.ace.deployment.deploymentadmin/bnd.bnd (original)
+++ ace/sandbox/marrs/org.apache.ace.deployment.deploymentadmin/bnd.bnd Thu Jul 12 15:23:19 2012
@@ -2,6 +2,6 @@
osgi.cmpn,\
org.apache.felix.dependencymanager,\
org.apache.ace.deployment.api;version=latest,\
- org.apache.ace.util;version=latest
+ org.apache.ace.itest;version=latest
Private-Package: org.apache.ace.deployment.deploymentadmin
Bundle-Activator: org.apache.ace.deployment.deploymentadmin.Activator
\ No newline at end of file
Modified: ace/sandbox/marrs/org.apache.ace.deployment.streamgenerator/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.deployment.streamgenerator/bnd.bnd?rev=1360724&r1=1360723&r2=1360724&view=diff
==============================================================================
--- ace/sandbox/marrs/org.apache.ace.deployment.streamgenerator/bnd.bnd (original)
+++ ace/sandbox/marrs/org.apache.ace.deployment.streamgenerator/bnd.bnd Thu Jul 12 15:23:19 2012
@@ -2,7 +2,7 @@
osgi.cmpn,\
org.apache.felix.dependencymanager,\
org.apache.ace.connectionfactory;version=latest,\
- org.apache.ace.util;version=latest,\
+ org.apache.ace.itest;version=latest,\
org.apache.ace.deployment.provider.api;version=latest,\
org.ops4j.pax.swissbox.tinybundles,\
../cnf/lib/commons-logging-1.1.1.jar;version=file,\
Modified: ace/sandbox/marrs/org.apache.ace.deployment.verifier/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.deployment.verifier/bnd.bnd?rev=1360724&r1=1360723&r2=1360724&view=diff
==============================================================================
--- ace/sandbox/marrs/org.apache.ace.deployment.verifier/bnd.bnd (original)
+++ ace/sandbox/marrs/org.apache.ace.deployment.verifier/bnd.bnd Thu Jul 12 15:23:19 2012
@@ -1,6 +1,6 @@
-buildpath: osgi.cmpn,\
osgi.core;version=4.3.0.201102171602,\
- org.apache.ace.util;version=latest
+ org.apache.ace.itest;version=latest
Export-Package: org.apache.ace.deployment.verifier,\
org.osgi.service.log,\
org.osgi.framework.wiring
Modified: ace/sandbox/marrs/org.apache.ace.discovery.property/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.discovery.property/bnd.bnd?rev=1360724&r1=1360723&r2=1360724&view=diff
==============================================================================
--- ace/sandbox/marrs/org.apache.ace.discovery.property/bnd.bnd (original)
+++ ace/sandbox/marrs/org.apache.ace.discovery.property/bnd.bnd Thu Jul 12 15:23:19 2012
@@ -1,8 +1,8 @@
-buildpath: osgi.core,\
osgi.cmpn,\
- org.apache.ace.util;version=latest,\
org.apache.felix.dependencymanager,\
org.apache.ace.discovery.api;version=latest,\
+ org.apache.ace.itest;version=latest,\
org.mockito.mockito-all
Private-Package: org.apache.ace.discovery.property,\
org.apache.ace.discovery.property.constants
Modified: ace/sandbox/marrs/org.apache.ace.discovery.upnp/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.discovery.upnp/bnd.bnd?rev=1360724&r1=1360723&r2=1360724&view=diff
==============================================================================
--- ace/sandbox/marrs/org.apache.ace.discovery.upnp/bnd.bnd (original)
+++ ace/sandbox/marrs/org.apache.ace.discovery.upnp/bnd.bnd Thu Jul 12 15:23:19 2012
@@ -1,7 +1,7 @@
-buildpath: osgi.core,\
osgi.cmpn,\
org.apache.felix.dependencymanager,\
- org.apache.ace.util;version=latest,\
+ org.apache.ace.itest;version=latest,\
org.easymock,\
org.apache.ace.discovery.api;version=latest
Private-Package: org.apache.ace.discovery.upnp
Modified: ace/sandbox/marrs/org.apache.ace.http.itest/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.http.itest/bnd.bnd?rev=1360724&r1=1360723&r2=1360724&view=diff
==============================================================================
--- ace/sandbox/marrs/org.apache.ace.http.itest/bnd.bnd (original)
+++ ace/sandbox/marrs/org.apache.ace.http.itest/bnd.bnd Thu Jul 12 15:23:19 2012
@@ -2,7 +2,6 @@ Test-Cases: ${classes;CONCRETE;EXTENDS;o
-buildpath: junit.osgi,\
osgi.core,\
osgi.cmpn,\
- org.apache.ace.util;version=latest,\
org.apache.felix.dependencymanager,\
org.apache.ace.itest;version=latest,\
org.apache.ace.log;version=latest,\
Modified: ace/sandbox/marrs/org.apache.ace.identification.ifconfig/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.identification.ifconfig/bnd.bnd?rev=1360724&r1=1360723&r2=1360724&view=diff
==============================================================================
--- ace/sandbox/marrs/org.apache.ace.identification.ifconfig/bnd.bnd (original)
+++ ace/sandbox/marrs/org.apache.ace.identification.ifconfig/bnd.bnd Thu Jul 12 15:23:19 2012
@@ -1,7 +1,7 @@
-buildpath: osgi.core,\
osgi.cmpn,\
- org.apache.ace.util;version=latest,\
org.apache.ace.identification.api;version=latest,\
- org.apache.felix.dependencymanager
+ org.apache.felix.dependencymanager,\
+ org.apache.ace.itest;version=latest
Private-Package: org.apache.ace.identification.ifconfig
Bundle-Activator: org.apache.ace.identification.ifconfig.Activator
Modified: ace/sandbox/marrs/org.apache.ace.identification.property/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.identification.property/bnd.bnd?rev=1360724&r1=1360723&r2=1360724&view=diff
==============================================================================
--- ace/sandbox/marrs/org.apache.ace.identification.property/bnd.bnd (original)
+++ ace/sandbox/marrs/org.apache.ace.identification.property/bnd.bnd Thu Jul 12 15:23:19 2012
@@ -2,7 +2,7 @@
org.apache.felix.dependencymanager,\
osgi.cmpn,\
osgi.core,\
- org.apache.ace.util;version=latest,\
+ org.apache.ace.itest;version=latest,\
org.mockito.mockito-all
Private-Package: org.apache.ace.identification.property,\
org.apache.ace.identification.property.constants
Modified: ace/sandbox/marrs/org.apache.ace.itest/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.itest/bnd.bnd?rev=1360724&r1=1360723&r2=1360724&view=diff
==============================================================================
--- ace/sandbox/marrs/org.apache.ace.itest/bnd.bnd (original)
+++ ace/sandbox/marrs/org.apache.ace.itest/bnd.bnd Thu Jul 12 15:23:19 2012
@@ -12,5 +12,8 @@
org.apache.felix.shell;resolution=http://bundles.bndtools.org.s3.amazonaws.com/org.apache.felix.shell/org.apache.felix.shell-1.4.2.jar;version='[1.4.2,1.4.3)',\
org.apache.felix.shell.tui;resolution=http://bundles.bndtools.org.s3.amazonaws.com/org.apache.felix.shell.tui/org.apache.felix.shell.tui-1.4.1.jar;version='[1.4.1,1.4.2)',\
osgi.cmpn;resolution=http://bundles.bndtools.org.s3.amazonaws.com/osgi.cmpn/osgi.cmpn-4.2.1.jar;version='[4.2.1,4.2.2)'
-Export-Package: org.apache.ace.it
-Private-Package: org.apache.ace.test.utils
+Export-Package: org.apache.ace.it,\
+ org.apache.ace.test.constants,\
+ org.apache.ace.test.utils,\
+ org.apache.ace.test.utils.deployment
+
Added: ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/constants/TestConstants.java
URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/constants/TestConstants.java?rev=1360724&view=auto
==============================================================================
--- ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/constants/TestConstants.java (added)
+++ ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/constants/TestConstants.java Thu Jul 12 15:23:19 2012
@@ -0,0 +1,29 @@
+/*
+ * 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.ace.test.constants;
+
+/**
+ * Constants for global test parameters. Use these throughout the test
+ * codebase. Make sure to only use public static finals here, which
+ * can be inlined by the compiler.
+ */
+public interface TestConstants {
+ /** The port the webserver is running on for testing. */
+ public static final int PORT = 9000;
+}
Propchange: ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/constants/TestConstants.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/constants/packageinfo
URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/constants/packageinfo?rev=1360724&view=auto
==============================================================================
--- ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/constants/packageinfo (added)
+++ ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/constants/packageinfo Thu Jul 12 15:23:19 2012
@@ -0,0 +1 @@
+version 1.0
\ No newline at end of file
Added: ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/utils/FileUtils.java
URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/utils/FileUtils.java?rev=1360724&view=auto
==============================================================================
--- ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/utils/FileUtils.java (added)
+++ ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/utils/FileUtils.java Thu Jul 12 15:23:19 2012
@@ -0,0 +1,62 @@
+/*
+ * 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.ace.test.utils;
+
+import java.io.File;
+import java.io.IOException;
+
+public class FileUtils {
+
+ /**
+ * Convenience method for creating temp files.
+ * It creates a temp file, and then deletes it. This is done so the same (unique) filename can be used to create a directory.
+ *
+ * If you use null as the baseDirectoryName, a tempfile is created in the platform specific temp directory.
+ * @throws IOException
+ */
+ public static File createTempFile(File baseDirectory) throws IOException {
+ return createTempFile(baseDirectory, "");
+ }
+
+ public static File createTempFile(File baseDirectory, String extension) throws IOException {
+ File tempFile = File.createTempFile("test", extension, baseDirectory);
+ tempFile.delete();
+ return tempFile;
+ }
+
+ /**
+ * Remove the given directory and all it's files and subdirectories
+ * @param directory the name of the directory to remove
+ */
+ public static void removeDirectoryWithContent(File directory) {
+ if ((directory == null) || !directory.exists()) {
+ return;
+ }
+ File[] filesAndSubDirs = directory.listFiles();
+ for (int i=0; i < filesAndSubDirs.length; i++) {
+ File file = filesAndSubDirs[i];
+ if (file.isDirectory()) {
+ removeDirectoryWithContent(file);
+ }
+ // else just remove the file
+ file.delete();
+ }
+ directory.delete();
+ }
+}
Propchange: ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/utils/FileUtils.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/utils/NetUtils.java
URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/utils/NetUtils.java?rev=1360724&view=auto
==============================================================================
--- ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/utils/NetUtils.java (added)
+++ ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/utils/NetUtils.java Thu Jul 12 15:23:19 2012
@@ -0,0 +1,64 @@
+/*
+ * 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.ace.test.utils;
+
+import java.io.IOException;
+import java.net.HttpURLConnection;
+import java.net.URL;
+
+/**
+ * Class containing utility methods concerning network related stuff.
+ */
+public class NetUtils {
+
+ /**
+ * Waits for a HTTP URL to become 'available', will retry every 100 milliseconds until it is available or timeout
+ * has been exceeded. Available in this context means the specified status code is returned when accessing the URL.
+ *
+ * @param url HTTP URL that should be tested for availability.
+ * @param responseCode The response code to be expected on the specified URL when it is available.
+ * @param timeout Amount of milliseconds to keep trying to access the URL.
+ * @return True if the response of the URL has the specified status code within the specified timeout delay, false otherwise.
+ * @throws IllegalArgumentException If the specified URL does not use the HTTP protocol.
+ */
+ public static boolean waitForURL(URL url, int responseCode, int timeout) {
+ long deadline = System.currentTimeMillis() + timeout;
+ while (System.currentTimeMillis() < deadline) {
+ try {
+ HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+ connection.connect();
+ if (connection.getResponseCode() == responseCode) {
+ return true;
+ }
+ } catch (ClassCastException cce) {
+ throw new IllegalArgumentException("Expected url to be an HTTP url, not: " + url.toString(), cce);
+ }
+ catch (IOException ioe) {
+ // retry
+ }
+ try {
+ Thread.sleep(100);
+ }
+ catch (InterruptedException ie) {
+ return false;
+ }
+ }
+ return false;
+ }
+}
Propchange: ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/utils/NetUtils.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/utils/TestUtils.java
URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/utils/TestUtils.java?rev=1360724&view=auto
==============================================================================
--- ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/utils/TestUtils.java (added)
+++ ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/utils/TestUtils.java Thu Jul 12 15:23:19 2012
@@ -0,0 +1,166 @@
+/*
+ * 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.ace.test.utils;
+
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+
+/**
+ * Utility class that injects dependencies. Can be used to unit test service implementations.
+ */
+public class TestUtils {
+ public static final String UNIT = "unit";
+ public static final String INTEGRATION = "integration";
+ public static final String SMOKE = "smoke";
+ public static final String PERFORMANCE = "performance";
+ public static final String UI = "ui";
+ public static final String BROKEN = "broken";
+ /**
+ * Configures an object to use a null object for the specified service interface.
+ *
+ * @param object the object
+ * @param iface the service interface
+ */
+ public static <T> void configureObject(Object object, Class<T> iface) {
+ configureObject(object, iface, createNullObject(iface));
+ }
+
+ /**
+ * Creates a null object for a service interface.
+ *
+ * @param iface the service interface
+ * @return a null object
+ */
+ @SuppressWarnings("unchecked")
+ public static <T> T createNullObject(Class<T> iface) {
+ return (T) Proxy.newProxyInstance(iface.getClassLoader(), new Class[] { iface }, new NullObject());
+ }
+
+ /**
+ * Wraps the given handler in an adapter that will try to pass on received invocations to the hander if that has
+ * an applicable methods else it defaults to a NullObject.
+ *
+ * @param iface the service interface
+ * @param handler the handler to pass invocations to.
+ * @return an adapter that will try to pass on received invocations to the given handler
+ */
+ @SuppressWarnings("unchecked")
+ public static <T> T createMockObjectAdapter(Class<T> iface, final Object handler) {
+ return (T) Proxy.newProxyInstance(iface.getClassLoader(), new Class[] { iface }, new NullObject() {
+
+ @Override
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+ try {
+ Method bridge = handler.getClass().getMethod(method.getName(), method.getParameterTypes());
+ bridge.setAccessible(true);
+ return bridge.invoke(handler, args);
+ }
+ catch (NoSuchMethodException ex) {
+ return super.invoke(proxy, method, args);
+ }
+ catch (InvocationTargetException ex) {
+ throw ex.getCause();
+ }
+ }
+ });
+ }
+
+ /**
+ * Configures an object to use a specific implementation for the specified service interface.
+ *
+ * @param object the object
+ * @param iface the service interface
+ * @param instance the implementation
+ */
+ @SuppressWarnings("unchecked")
+ public static void configureObject(Object object, Class iface, Object instance) {
+ Class serviceClazz = object.getClass();
+
+ while (serviceClazz != null) {
+ Field[] fields = serviceClazz.getDeclaredFields();
+ AccessibleObject.setAccessible(fields, true);
+ for (int j = 0; j < fields.length; j++) {
+ if (fields[j].getType().equals(iface)) {
+ try {
+ // synchronized makes sure the field is actually written to immediately
+ synchronized (new Object()) {
+ fields[j].set(object, instance);
+ }
+ }
+ catch (Exception e) {
+ throw new IllegalStateException("Could not set field " + fields[j].getName() + " on " + object);
+ }
+ }
+ }
+ serviceClazz = serviceClazz.getSuperclass();
+ }
+ }
+
+ static class NullObject implements InvocationHandler {
+ private static final Boolean DEFAULT_BOOLEAN = Boolean.FALSE;
+
+ private static final Byte DEFAULT_BYTE = new Byte((byte) 0);
+
+ private static final Short DEFAULT_SHORT = new Short((short) 0);
+
+ private static final Integer DEFAULT_INT = new Integer(0);
+
+ private static final Long DEFAULT_LONG = new Long(0);
+
+ private static final Float DEFAULT_FLOAT = new Float(0.0f);
+
+ private static final Double DEFAULT_DOUBLE = new Double(0.0);
+
+ /**
+ * Invokes a method on this null object. The method will return a default value without doing anything.
+ */
+ @SuppressWarnings("unchecked")
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+ Class returnType = method.getReturnType();
+ if (returnType.equals(Boolean.class) || returnType.equals(Boolean.TYPE)) {
+ return DEFAULT_BOOLEAN;
+ }
+ else if (returnType.equals(Byte.class) || returnType.equals(Byte.TYPE)) {
+ return DEFAULT_BYTE;
+ }
+ else if (returnType.equals(Short.class) || returnType.equals(Short.TYPE)) {
+ return DEFAULT_SHORT;
+ }
+ else if (returnType.equals(Integer.class) || returnType.equals(Integer.TYPE)) {
+ return DEFAULT_INT;
+ }
+ else if (returnType.equals(Long.class) || returnType.equals(Long.TYPE)) {
+ return DEFAULT_LONG;
+ }
+ else if (returnType.equals(Float.class) || returnType.equals(Float.TYPE)) {
+ return DEFAULT_FLOAT;
+ }
+ else if (returnType.equals(Double.class) || returnType.equals(Double.TYPE)) {
+ return DEFAULT_DOUBLE;
+ }
+ else {
+ return null;
+ }
+ }
+ }
+}
Propchange: ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/utils/TestUtils.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/utils/Util.java
URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/utils/Util.java?rev=1360724&view=auto
==============================================================================
--- ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/utils/Util.java (added)
+++ ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/utils/Util.java Thu Jul 12 15:23:19 2012
@@ -0,0 +1,38 @@
+/*
+ * 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.ace.test.utils;
+
+import java.util.Properties;
+
+public class Util {
+
+ /**
+ * Creates a Properties object from a list of key-value pairs, e.g.
+ * <pre>
+ * properties("key", "value", "key2", "value2");
+ * </pre>
+ */
+ public static Properties properties(String... values) {
+ Properties props = new Properties();
+ for (int i = 0; i < values.length; i += 2) {
+ props.put(values[i], values[i+1]);
+ }
+ return props;
+ }
+}
Propchange: ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/utils/Util.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/utils/deployment/BundleStreamGenerator.java
URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/utils/deployment/BundleStreamGenerator.java?rev=1360724&view=auto
==============================================================================
--- ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/utils/deployment/BundleStreamGenerator.java (added)
+++ ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/utils/deployment/BundleStreamGenerator.java Thu Jul 12 15:23:19 2012
@@ -0,0 +1,67 @@
+/*
+ * 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.ace.test.utils.deployment;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.net.URISyntaxException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.jar.JarOutputStream;
+import java.util.jar.Manifest;
+
+import org.apache.ace.deployment.provider.ArtifactData;
+import org.osgi.framework.Constants;
+
+public class BundleStreamGenerator {
+
+ public static Manifest getBundleManifest(String symbolicname, String version, Map<String, String> additionalHeaders) {
+ Manifest manifest = new Manifest();
+ manifest.getMainAttributes().putValue("Manifest-Version", "1");
+ manifest.getMainAttributes().putValue(Constants.BUNDLE_MANIFESTVERSION, "2");
+ manifest.getMainAttributes().putValue(Constants.BUNDLE_SYMBOLICNAME, symbolicname);
+ manifest.getMainAttributes().putValue(Constants.BUNDLE_VERSION, version.toString());
+ for (Map.Entry<String, String> entry : additionalHeaders.entrySet()) {
+ manifest.getMainAttributes().putValue(entry.getKey(), entry.getValue());
+ }
+ return manifest;
+ }
+
+ public static void generateBundle(ArtifactData data, Map<String, String> additionalHeaders) throws IOException {
+ OutputStream bundleStream = null;
+ try {
+ File dataFile = new File(data.getUrl().toURI());
+ OutputStream fileStream = new FileOutputStream(dataFile);
+ bundleStream = new JarOutputStream(fileStream, getBundleManifest(data.getSymbolicName(), data.getVersion(), additionalHeaders));
+ bundleStream.flush();
+ } catch (URISyntaxException e) {
+ throw new IOException();
+ } finally {
+ if (bundleStream != null) {
+ bundleStream.close();
+ }
+ }
+ }
+
+ public static void generateBundle(ArtifactData data) throws IOException {
+ generateBundle(data, new HashMap<String, String>());
+ }
+}
Propchange: ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/utils/deployment/BundleStreamGenerator.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/utils/deployment/TestData.java
URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/utils/deployment/TestData.java?rev=1360724&view=auto
==============================================================================
--- ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/utils/deployment/TestData.java (added)
+++ ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/utils/deployment/TestData.java Thu Jul 12 15:23:19 2012
@@ -0,0 +1,85 @@
+/*
+ * 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.ace.test.utils.deployment;
+
+import java.net.URL;
+import java.util.jar.Attributes;
+
+import org.apache.ace.deployment.provider.ArtifactData;
+
+public class TestData implements ArtifactData {
+ private final String m_fileName;
+ private final String m_symbolicName;
+ private final URL m_url;
+ private final String m_version;
+ private final boolean m_changed;
+
+ public TestData(String fileName, String symbolicName, URL url, String version, boolean changed) {
+ m_fileName = fileName;
+ m_symbolicName = symbolicName;
+ m_url = url;
+ m_version = version;
+ m_changed = changed;
+ }
+
+ public boolean hasChanged() {
+ return m_changed;
+ }
+
+ public String getFilename() {
+ return m_fileName;
+ }
+
+ public String getSymbolicName() {
+ return m_symbolicName;
+ }
+
+ public URL getUrl() {
+ return m_url;
+ }
+
+ public String getVersion() {
+ return m_version;
+ }
+
+ public String getDirective() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Attributes getManifestAttributes(boolean fixPackage) {
+ Attributes a = new Attributes();
+ a.putValue("Bundle-SymbolicName", getSymbolicName());
+ a.putValue("Bundle-Version", getVersion());
+ return a;
+ }
+
+ public String getProcessorPid() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public boolean isBundle() {
+ return true;
+ }
+
+ public boolean isCustomizer() {
+ return false;
+ }
+}
Propchange: ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/utils/deployment/TestData.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/utils/deployment/TestProvider.java
URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/utils/deployment/TestProvider.java?rev=1360724&view=auto
==============================================================================
--- ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/utils/deployment/TestProvider.java (added)
+++ ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/utils/deployment/TestProvider.java Thu Jul 12 15:23:19 2012
@@ -0,0 +1,59 @@
+/*
+ * 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.ace.test.utils.deployment;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.ace.deployment.provider.ArtifactData;
+import org.apache.ace.deployment.provider.DeploymentProvider;
+
+public class TestProvider implements DeploymentProvider {
+ private List<ArtifactData> m_collection;
+ private List<String> m_versions;
+
+ public TestProvider() throws Exception {
+ m_collection = new ArrayList<ArtifactData>();
+ m_versions = new ArrayList<String>();
+ }
+
+ public void addData(String fileName, String symbolicName, URL url, String version) {
+ addData(fileName, symbolicName, url, version, true);
+ }
+
+ public void addData(String fileName, String symbolicName, URL url, String version, boolean changed) {
+ m_collection.add(new TestData(fileName, symbolicName, url, version, changed));
+ m_versions.add(version);
+ }
+
+ public List<ArtifactData> getBundleData(String id, String version) {
+ return m_collection;
+ }
+
+ public List<ArtifactData> getBundleData(String id, String versionFrom, String versionTo) {
+ return m_collection;
+ }
+
+ public List<String> getVersions(String id) throws IllegalArgumentException {
+ Collections.sort(m_versions);
+ return m_versions;
+ }
+}
Propchange: ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/utils/deployment/TestProvider.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/utils/deployment/packageinfo
URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/utils/deployment/packageinfo?rev=1360724&view=auto
==============================================================================
--- ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/utils/deployment/packageinfo (added)
+++ ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/utils/deployment/packageinfo Thu Jul 12 15:23:19 2012
@@ -0,0 +1 @@
+version 1.0
\ No newline at end of file
Added: ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/utils/packageinfo
URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/utils/packageinfo?rev=1360724&view=auto
==============================================================================
--- ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/utils/packageinfo (added)
+++ ace/sandbox/marrs/org.apache.ace.itest/src/org/apache/ace/test/utils/packageinfo Thu Jul 12 15:23:19 2012
@@ -0,0 +1 @@
+version 1.0
\ No newline at end of file
Modified: ace/sandbox/marrs/org.apache.ace.log/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.log/bnd.bnd?rev=1360724&r1=1360723&r2=1360724&view=diff
==============================================================================
--- ace/sandbox/marrs/org.apache.ace.log/bnd.bnd (original)
+++ ace/sandbox/marrs/org.apache.ace.log/bnd.bnd Thu Jul 12 15:23:19 2012
@@ -1,4 +1,3 @@
--buildpath: org.apache.ace.range.api;version=latest,\
- org.apache.ace.util;version=latest
+-buildpath: org.apache.ace.range.api;version=latest
Export-Package: org.apache.ace.log
-Private-Package: org.apache.ace.util
\ No newline at end of file
+Private-Package: org.apache.ace.log.util
\ No newline at end of file
Modified: ace/sandbox/marrs/org.apache.ace.log/src/org/apache/ace/log/LogDescriptor.java
URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.log/src/org/apache/ace/log/LogDescriptor.java?rev=1360724&r1=1360723&r2=1360724&view=diff
==============================================================================
--- ace/sandbox/marrs/org.apache.ace.log/src/org/apache/ace/log/LogDescriptor.java (original)
+++ ace/sandbox/marrs/org.apache.ace.log/src/org/apache/ace/log/LogDescriptor.java Thu Jul 12 15:23:19 2012
@@ -22,7 +22,7 @@ import java.util.NoSuchElementException;
import java.util.StringTokenizer;
import org.apache.ace.range.SortedRangeSet;
-import org.apache.ace.util.Codec;
+import org.apache.ace.log.util.Codec;
/**
* Instances of this class represent a range of log events. Such a range is defined by:
Modified: ace/sandbox/marrs/org.apache.ace.log/src/org/apache/ace/log/LogEvent.java
URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.log/src/org/apache/ace/log/LogEvent.java?rev=1360724&r1=1360723&r2=1360724&view=diff
==============================================================================
--- ace/sandbox/marrs/org.apache.ace.log/src/org/apache/ace/log/LogEvent.java (original)
+++ ace/sandbox/marrs/org.apache.ace.log/src/org/apache/ace/log/LogEvent.java Thu Jul 12 15:23:19 2012
@@ -22,7 +22,7 @@ import java.util.Dictionary;
import java.util.Enumeration;
import java.util.Properties;
import java.util.StringTokenizer;
-import org.apache.ace.util.Codec;
+import org.apache.ace.log.util.Codec;
/**
* Log event from a specific target and log.
Added: ace/sandbox/marrs/org.apache.ace.log/src/org/apache/ace/log/util/Codec.java
URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.log/src/org/apache/ace/log/util/Codec.java?rev=1360724&view=auto
==============================================================================
--- ace/sandbox/marrs/org.apache.ace.log/src/org/apache/ace/log/util/Codec.java (added)
+++ ace/sandbox/marrs/org.apache.ace.log/src/org/apache/ace/log/util/Codec.java Thu Jul 12 15:23:19 2012
@@ -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.ace.log.util;
+
+import java.text.CharacterIterator;
+import java.text.StringCharacterIterator;
+
+public class Codec
+{
+
+ public static String decode(String source) throws IllegalArgumentException {
+ StringBuffer result = new StringBuffer();
+ StringCharacterIterator sci = new StringCharacterIterator(source);
+ for (char c = sci.current(); c != CharacterIterator.DONE; c = sci.next()) {
+ if (c == '$') {
+ c = sci.next();
+ if (c != CharacterIterator.DONE) {
+ if (c == '$') {
+ result.append('$');
+ }
+ else if (c == 'k') {
+ result.append(',');
+ }
+ else if (c == 'n') {
+ result.append('\n');
+ }
+ else if (c == 'r') {
+ result.append('\r');
+ }
+ else if (c == 'e') {
+ return null;
+ }
+ else {
+ throw new IllegalArgumentException("Unknown escape character: " + c);
+ }
+ }
+ else {
+ throw new IllegalArgumentException("Unexpected end of input: " + source);
+ }
+ }
+ else {
+ result.append(c);
+ }
+ }
+ return result.toString();
+ }
+
+ public static String encode(String source) {
+ if (source == null) {
+ return "$e";
+ }
+ StringBuffer result = new StringBuffer();
+ StringCharacterIterator sci = new StringCharacterIterator(source);
+ for (char c = sci.current(); c != CharacterIterator.DONE; c = sci.next()) {
+ if (c == '$') {
+ result.append("$$");
+ }
+ else if (c == ',') {
+ result.append("$k");
+ }
+ else if (c == '\n') {
+ result.append("$n");
+ }
+ else if (c == '\r') {
+ result.append("$r");
+ }
+ else {
+ result.append(c);
+ }
+ }
+ return result.toString();
+ }
+}
\ No newline at end of file
Propchange: ace/sandbox/marrs/org.apache.ace.log/src/org/apache/ace/log/util/Codec.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: ace/sandbox/marrs/org.apache.ace.nodelauncher.amazon/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.nodelauncher.amazon/bnd.bnd?rev=1360724&r1=1360723&r2=1360724&view=diff
==============================================================================
--- ace/sandbox/marrs/org.apache.ace.nodelauncher.amazon/bnd.bnd (original)
+++ ace/sandbox/marrs/org.apache.ace.nodelauncher.amazon/bnd.bnd Thu Jul 12 15:23:19 2012
@@ -2,7 +2,7 @@
osgi.cmpn,\
org.apache.felix.dependencymanager,\
org.apache.ace.nodelauncher.api;version=latest,\
- org.apache.ace.util;version=latest,\
+ org.apache.ace.itest;version=latest,\
com.google.inject,\
com.google.gson,\
com.google.inject.assistedinject,\
Modified: ace/sandbox/marrs/org.apache.ace.processlauncher/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.processlauncher/bnd.bnd?rev=1360724&r1=1360723&r2=1360724&view=diff
==============================================================================
--- ace/sandbox/marrs/org.apache.ace.processlauncher/bnd.bnd (original)
+++ ace/sandbox/marrs/org.apache.ace.processlauncher/bnd.bnd Thu Jul 12 15:23:19 2012
@@ -1,5 +1,5 @@
-buildpath: org.apache.felix.dependencymanager,\
- org.apache.ace.util;version=latest,\
+ org.apache.ace.itest;version=latest,\
org.mockito.mockito-all,\
osgi.core,\
osgi.cmpn,\
Modified: ace/sandbox/marrs/org.apache.ace.range.api/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.range.api/bnd.bnd?rev=1360724&r1=1360723&r2=1360724&view=diff
==============================================================================
--- ace/sandbox/marrs/org.apache.ace.range.api/bnd.bnd (original)
+++ ace/sandbox/marrs/org.apache.ace.range.api/bnd.bnd Thu Jul 12 15:23:19 2012
@@ -1,2 +1,2 @@
--buildpath: org.apache.ace.util;version=latest
+-buildpath: org.apache.ace.itest;version=latest
Export-Package: org.apache.ace.range
\ No newline at end of file
Modified: ace/sandbox/marrs/org.apache.ace.repository.impl/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.repository.impl/bnd.bnd?rev=1360724&r1=1360723&r2=1360724&view=diff
==============================================================================
--- ace/sandbox/marrs/org.apache.ace.repository.impl/bnd.bnd (original)
+++ ace/sandbox/marrs/org.apache.ace.repository.impl/bnd.bnd Thu Jul 12 15:23:19 2012
@@ -2,10 +2,10 @@
osgi.cmpn,\
org.apache.felix.dependencymanager,\
javax.servlet,\
- org.apache.ace.util;version=latest,\
org.apache.ace.repository.ext;version=latest,\
org.apache.ace.repository.api;version=latest,\
- org.apache.ace.range.api;version=latest
+ org.apache.ace.range.api;version=latest,\
+ org.apache.ace.itest;version=latest
Private-Package: org.apache.ace.repository.impl,\
org.apache.ace.repository.impl.constants
Bundle-Activator: org.apache.ace.repository.impl.Activator
\ No newline at end of file
Modified: ace/sandbox/marrs/org.apache.ace.scheduler/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.scheduler/bnd.bnd?rev=1360724&r1=1360723&r2=1360724&view=diff
==============================================================================
--- ace/sandbox/marrs/org.apache.ace.scheduler/bnd.bnd (original)
+++ ace/sandbox/marrs/org.apache.ace.scheduler/bnd.bnd Thu Jul 12 15:23:19 2012
@@ -1,7 +1,7 @@
-buildpath: osgi.core,\
osgi.cmpn,\
org.apache.felix.dependencymanager,\
- org.apache.ace.util;version=latest,\
- org.apache.ace.scheduler.api;version=latest
+ org.apache.ace.scheduler.api;version=latest,\
+ org.apache.ace.itest;version=latest
Private-Package: org.apache.ace.scheduler
Bundle-Activator: org.apache.ace.scheduler.Activator
\ No newline at end of file
Modified: ace/sandbox/marrs/org.apache.ace.server.log.store/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.server.log.store/bnd.bnd?rev=1360724&r1=1360723&r2=1360724&view=diff
==============================================================================
--- ace/sandbox/marrs/org.apache.ace.server.log.store/bnd.bnd (original)
+++ ace/sandbox/marrs/org.apache.ace.server.log.store/bnd.bnd Thu Jul 12 15:23:19 2012
@@ -2,8 +2,8 @@
osgi.cmpn,\
org.apache.felix.dependencymanager,\
org.apache.ace.range.api;version=latest,\
- org.apache.ace.util;version=latest,\
- org.apache.ace.log;version=latest
+ org.apache.ace.log;version=latest,\
+ org.apache.ace.itest;version=latest
Private-Package: org.apache.ace.server.log.store.impl
Bundle-Activator: org.apache.ace.server.log.store.impl.Activator
Export-Package: org.apache.ace.server.log.store
\ No newline at end of file
Modified: ace/sandbox/marrs/org.apache.ace.util/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.util/bnd.bnd?rev=1360724&r1=1360723&r2=1360724&view=diff
==============================================================================
--- ace/sandbox/marrs/org.apache.ace.util/bnd.bnd (original)
+++ ace/sandbox/marrs/org.apache.ace.util/bnd.bnd Thu Jul 12 15:23:19 2012
@@ -1,7 +1,3 @@
-buildpath: osgi.cmpn,\
org.apache.ace.deployment.provider.api;version=latest,\
osgi.core
-Export-Package: org.apache.ace.test.constants,\
- org.apache.ace.test.utils,\
- org.apache.ace.test.utils.deployment,\
- org.apache.ace.util
\ No newline at end of file
Modified: ace/sandbox/marrs/org.apache.ace.webui.vaadin/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.webui.vaadin/bnd.bnd?rev=1360724&r1=1360723&r2=1360724&view=diff
==============================================================================
--- ace/sandbox/marrs/org.apache.ace.webui.vaadin/bnd.bnd (original)
+++ ace/sandbox/marrs/org.apache.ace.webui.vaadin/bnd.bnd Thu Jul 12 15:23:19 2012
@@ -10,8 +10,7 @@
javax.servlet
Private-Package: org.apache.ace.webui.domain,\
org.apache.ace.webui.vaadin,\
- org.apache.ace.webui.vaadin.component,\
- org.apache.ace.test.utils
+ org.apache.ace.webui.vaadin.component
Export-Package: org.apache.ace.webui
Include-Resource: resources/
Bundle-Activator: org.apache.ace.webui.vaadin.Activator
\ No newline at end of file
Modified: ace/sandbox/marrs/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/VaadinClient.java
URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/VaadinClient.java?rev=1360724&r1=1360723&r2=1360724&view=diff
==============================================================================
--- ace/sandbox/marrs/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/VaadinClient.java (original)
+++ ace/sandbox/marrs/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/VaadinClient.java Thu Jul 12 15:23:19 2012
@@ -52,7 +52,6 @@ import org.apache.ace.client.repository.
import org.apache.ace.client.repository.stateful.StatefulTargetObject;
import org.apache.ace.client.repository.stateful.StatefulTargetRepository;
import org.apache.ace.connectionfactory.ConnectionFactory;
-import org.apache.ace.test.utils.FileUtils;
import org.apache.ace.webui.NamedObject;
import org.apache.ace.webui.UIExtensionFactory;
import org.apache.ace.webui.vaadin.LoginWindow.LoginFunction;
@@ -164,6 +163,26 @@ public class VaadinClient extends com.va
}
/**
+ * Remove the given directory and all it's files and subdirectories
+ * @param directory the name of the directory to remove
+ */
+ private static void removeDirectoryWithContent(File directory) {
+ if ((directory == null) || !directory.exists()) {
+ return;
+ }
+ File[] filesAndSubDirs = directory.listFiles();
+ for (int i=0; i < filesAndSubDirs.length; i++) {
+ File file = filesAndSubDirs[i];
+ if (file.isDirectory()) {
+ removeDirectoryWithContent(file);
+ }
+ // else just remove the file
+ file.delete();
+ }
+ directory.delete();
+ }
+
+ /**
* Creates a new {@link VaadinClient} instance.
*
* @param aceHost the hostname where the management service can be reached;
@@ -216,7 +235,7 @@ public class VaadinClient extends com.va
public void destroyDependencies() {
m_sessionFactory.destroySession(m_sessionID);
- FileUtils.removeDirectoryWithContent(m_sessionDir);
+ removeDirectoryWithContent(m_sessionDir);
}
public void init() {