Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkuppe2009-03-01 08:20:52 +0000
committermkuppe2009-03-01 08:20:52 +0000
commit45fbe7ee283091e4b77c669f5da934d455b755e3 (patch)
tree328c0f1d74d2c56bbaf60cab6365c9861f90252d
parent53ef4604f7eac13230edbfc6f4c85bd4b3c7a018 (diff)
downloadorg.eclipse.ecf-45fbe7ee283091e4b77c669f5da934d455b755e3.tar.gz
org.eclipse.ecf-45fbe7ee283091e4b77c669f5da934d455b755e3.tar.xz
org.eclipse.ecf-45fbe7ee283091e4b77c669f5da934d455b755e3.zip
NEW - bug 264527: [Discovery][jSLP] Receive Timed Out Error
https://bugs.eclipse.org/bugs/show_bug.cgi?id=264527
-rw-r--r--protocols/bundles/ch.ethz.iks.slp/pom.xml124
-rw-r--r--protocols/bundles/ch.ethz.iks.slp/runtimeTests/pom.xml2
-rw-r--r--protocols/bundles/ch.ethz.iks.slp/runtimeTests/src/main/java/ch/ethz/iks/slp/impl/TestActivator.java29
-rw-r--r--protocols/bundles/ch.ethz.iks.slp/src/main/java/ch/ethz/iks/slp/impl/OSGiPlatformAbstraction.java2
-rw-r--r--protocols/bundles/ch.ethz.iks.slp/src/main/java/ch/ethz/iks/slp/impl/SLPCore.java3
-rw-r--r--protocols/bundles/ch.ethz.iks.slp/test/init.xargs6
6 files changed, 150 insertions, 16 deletions
diff --git a/protocols/bundles/ch.ethz.iks.slp/pom.xml b/protocols/bundles/ch.ethz.iks.slp/pom.xml
index 00a701d1d..233eb81ff 100644
--- a/protocols/bundles/ch.ethz.iks.slp/pom.xml
+++ b/protocols/bundles/ch.ethz.iks.slp/pom.xml
@@ -65,6 +65,9 @@
<phase>integration-test</phase>
<configuration>
<tasks>
+ <property name="debug.suspend" value="n" />
+ <property name="debug.port" value="10044" />
+ <property name="jslp.port" value="10427" />
<echo message="Compiling the unit test environment..."/>
<mkdir dir="runtimeTests/target"/>
<condition property="maven.executable" value="mvn.bat">
@@ -75,15 +78,96 @@
<arg line="package"/>
</exec>
<delete dir="test/storage" quiet="true"/>
+ <echo file="target/init.xargs" append="false">
+ -Dorg.osgi.framework.system.packages=junit.framework,junit.textui
+ -init
+ -istart file:target/jslp-osgi-${pom.version}.jar
+ -istart file:runtimeTests/target/jslp-test-${pom.version}.jar
+ </echo>
<java fork="true" classname="ch.ethz.iks.concierge.framework.Framework" failonerror="true" resultproperty="testresult">
<classpath>
<pathelement location="${maven.dependency.ch.ethz.iks.concierge.concierge.jar.path}"/>
<pathelement location="${maven.dependency.junit.junit.jar.path}"/>
</classpath>
- <jvmarg value="-Dxargs=test/init.xargs"/>
- <jvmarg value="-Dnet.slp.port=10427"/>
+ <jvmarg value="-Dxargs=target/init.xargs"/>
+ <jvmarg value="-Dnet.slp.port=${jslp.port}"/>
+ <jvmarg value="-Dch.ethz.iks.concierge.log.level=4"/> <!-- LOG_DEBUG -->
+ <jvmarg value="-Dch.ethz.iks.concierge.log.enabled=true"/>
+ <jvmarg value="-Dch.ethz.iks.slp.debug=true" />
+ <jvmarg value="-Dnet.slp.traceDATraffic=true" />
+ <jvmarg value="-Dnet.slp.traceMsg=true" />
+ <jvmarg value="-Dnet.slp.traceDrop=true" />
+ <jvmarg value="-Dnet.slp.traceReg=true" />
+ <jvmarg value="-Xrunjdwp:transport=dt_socket,address=${debug.port},server=y,suspend=${debug.suspend}" />
+ <jvmarg value="-Xdebug" />
+ <jvmarg value="-Dnet.slp.versionUnderTest=${pom.version}" />
</java>
<delete dir="test/storage" quiet="true"/>
+
+ <!-- run integration tests with two instances running -->
+ <get src="http://ecf2.osuosl.org/ch.ethz.iks.slp_1.1.0.v20090227-1900.jar" dest="target/ch.ethz.iks.slp_1.1.0.v20090227-1900.jar"/>
+
+ <mkdir dir="target/configuration" />
+ <echo file="target/configuration/config.ini" append="false">
+ eclipse.ignoreApp=true
+ eclipse.consoleLog=true
+ osgi.bundles=file:${maven.dependency.org.eclipse.osgi.services.jar.path}@2:start, \
+ file:${maven.dependency.org.junit.jar.path}@start, \
+ file:${basedir}/target/ch.ethz.iks.slp_1.1.0.v20090227-1900.jar@start, \
+ file:${basedir}/target/jslp-osgi-${pom.version}.jar@start, \
+ file:${basedir}/runtimeTests/target/jslp-test-${pom.version}.jar@start
+ </echo>
+ <java fork="true" classname="org.eclipse.core.runtime.adaptor.EclipseStarter" failonerror="true" resultproperty="testresult2">
+ <classpath>
+ <pathelement location="${maven.dependency.org.eclipse.osgi.jar.path}"/>
+ </classpath>
+ <!-- osgi locations -->
+ <jvmarg value="-Dosgi.configuration.area=target/configuration" />
+ <!-- jSLP options -->
+ <jvmarg value="-Dnet.slp.port=${jslp.port}"/>
+ <jvmarg value="-Dch.ethz.iks.slp.debug=true" />
+ <jvmarg value="-Dnet.slp.traceDATraffic=true" />
+ <jvmarg value="-Dnet.slp.traceMsg=true" />
+ <jvmarg value="-Dnet.slp.traceDrop=true" />
+ <jvmarg value="-Dnet.slp.traceReg=true" />
+ <jvmarg value="-Dnet.slp.versionUnderTest=${pom.version}" />
+ <!-- enable remote debug mode -->
+ <jvmarg value="-Xrunjdwp:transport=dt_socket,address=${debug.port},server=y,suspend=${debug.suspend}" />
+ <jvmarg value="-Xdebug" />
+ <jvmarg value="-noverify"/>
+ </java>
+
+ <!-- run integration tests with openslp running on 427 -->
+ <!--
+ <condition property="openslp.running">
+ <socket server="localhost" port="427"/>
+ </condition>
+ <fail message="An OpenSLP instance must be running on port 427" unless="openslp.running"/>
+ <echo file="target/configuration/config.ini" append="false">
+ eclipse.ignoreApp=true
+ eclipse.consoleLog=true
+ osgi.bundles=file:${maven.dependency.org.eclipse.osgi.services.jar.path}@2:start, \
+ file:${maven.dependency.org.junit.jar.path}@start, \
+ file:${basedir}/target/jslp-osgi-${pom.version}.jar@start, \
+ file:${basedir}/runtimeTests/target/jslp-test-${pom.version}.jar@start
+ </echo>
+ <java fork="true" classname="org.eclipse.core.runtime.adaptor.EclipseStarter" failonerror="true" resultproperty="testresult3">
+ <classpath>
+ <pathelement location="${maven.dependency.org.eclipse.osgi.jar.path}"/>
+ </classpath>
+ <jvmarg value="-Dosgi.configuration.area=target/configuration" />
+ <jvmarg value="-Dnet.slp.port=427"/>
+ <jvmarg value="-Dch.ethz.iks.slp.debug=true" />
+ <jvmarg value="-Dnet.slp.traceDATraffic=true" />
+ <jvmarg value="-Dnet.slp.traceMsg=true" />
+ <jvmarg value="-Dnet.slp.traceDrop=true" />
+ <jvmarg value="-Dnet.slp.traceReg=true" />
+ <jvmarg value="-Dnet.slp.versionUnderTest=${pom.version}" />
+ <jvmarg value="-Xrunjdwp:transport=dt_socket,address=${debug.port},server=y,suspend=${debug.suspend}" />
+ <jvmarg value="-Xdebug" />
+ <jvmarg value="-noverify"/>
+ </java>
+ -->
</tasks>
</configuration>
<goals>
@@ -113,6 +197,7 @@
<Bundle-Version>${pom.version}</Bundle-Version>
<Bundle-Name>jslp-osgi</Bundle-Name>
<Bundle-SymbolicName>ch.ethz.iks.slp</Bundle-SymbolicName>
+ <Export-Package>ch.ethz.iks.slp;version=1.0.0</Export-Package>
<_include>~META-INF/MANIFEST.MF</_include>
<!-- BND just produces Bundle-ManifestVersion: 2 headers which we don't want -->
<_removeheaders>Bundle-ManifestVersion</_removeheaders>
@@ -170,6 +255,36 @@
<version>1.0_RC2</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.eclipse</groupId>
+ <artifactId>osgi</artifactId>
+ <version>3.3.0-v20070530</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.osgi</groupId>
+ <artifactId>services</artifactId>
+ <version>3.1.200-v20070605</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse</groupId>
+ <artifactId>osgi</artifactId>
+ <version>3.3.0-v20070530</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.osgi</groupId>
+ <artifactId>services</artifactId>
+ <version>3.1.200-v20070605</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.2-v200706111738</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<repositories>
@@ -178,6 +293,11 @@
<name>ETH Zurich IKS Repository</name>
<url>http://www.flowsgi.inf.ethz.ch/repository/maven2/</url>
</repository>
+ <repository>
+ <id>Maven eclipse</id>
+ <name>Eclipse Maven</name>
+ <url>http://repo2.maven.org/eclipse/</url>
+ </repository>
</repositories>
<pluginRepositories>
<pluginRepository>
diff --git a/protocols/bundles/ch.ethz.iks.slp/runtimeTests/pom.xml b/protocols/bundles/ch.ethz.iks.slp/runtimeTests/pom.xml
index 535ae70b3..8253608f0 100644
--- a/protocols/bundles/ch.ethz.iks.slp/runtimeTests/pom.xml
+++ b/protocols/bundles/ch.ethz.iks.slp/runtimeTests/pom.xml
@@ -20,7 +20,7 @@
<Bundle-Name>jslp-test</Bundle-Name>
<Bundle-SymbolicName>ch.ethz.iks.slp.test</Bundle-SymbolicName>
<Bundle-Vendor>Jan S. Rellermeyer, IKS, ETH Zurich</Bundle-Vendor>
- <Import-Package>org.osgi.framework, ch.ethz.iks.slp, junit.framework, junit.textui</Import-Package>
+ <Import-Package>org.osgi.framework, ch.ethz.iks.slp;version="1.0.0", junit.framework, junit.textui</Import-Package>
<Private-Package>*</Private-Package>
<Bundle-Activator>ch.ethz.iks.slp.impl.TestActivator</Bundle-Activator>
<!-- BND just produces Bundle-ManifestVersion: 2 headers which we don't want -->
diff --git a/protocols/bundles/ch.ethz.iks.slp/runtimeTests/src/main/java/ch/ethz/iks/slp/impl/TestActivator.java b/protocols/bundles/ch.ethz.iks.slp/runtimeTests/src/main/java/ch/ethz/iks/slp/impl/TestActivator.java
index ce1450e8a..2b11f6fe5 100644
--- a/protocols/bundles/ch.ethz.iks.slp/runtimeTests/src/main/java/ch/ethz/iks/slp/impl/TestActivator.java
+++ b/protocols/bundles/ch.ethz.iks.slp/runtimeTests/src/main/java/ch/ethz/iks/slp/impl/TestActivator.java
@@ -8,6 +8,7 @@ import junit.textui.TestRunner;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
import ch.ethz.iks.slp.Advertiser;
import ch.ethz.iks.slp.Locator;
@@ -18,14 +19,31 @@ public class TestActivator implements BundleActivator {
static Locator locator;
public void start(BundleContext context) throws Exception {
+ ServiceReference advertiserRef = null;
try {
- advertiser = (Advertiser) context.getService(context
- .getServiceReference(Advertiser.class.getName()));
- locator = (Locator) context.getService(context
- .getServiceReference(Locator.class.getName()));
+ ServiceReference[] aSrefs = context
+ .getServiceReferences(Advertiser.class.getName(), null);
+ for (int i = 0; i < aSrefs.length; i++) {
+ ServiceReference serviceReference = aSrefs[i];
+ String version = (String) serviceReference.getBundle().getHeaders().get("Bundle-Version");
+ if(version.equals(System.getProperty("net.slp.versionUnderTest"))) {
+ advertiserRef = serviceReference;
+ } else {
+ context.getService(serviceReference);
+ }
+ }
+
+ advertiser = (Advertiser) context.getService(advertiserRef);
+ locator = (Locator) context.getService(context
+ .getServiceReference(Locator.class.getName()));
} catch (Exception e) {
System.exit(1);
}
+
+ startTests();
+ }
+
+ private void startTests() {
TestResult result = TestRunner.run(new SelfDiscoveryTest());
if (result.wasSuccessful()) {
System.exit(0);
@@ -48,8 +66,9 @@ public class TestActivator implements BundleActivator {
}
System.exit(1);
}
- }
+ }
+
public void stop(BundleContext context) throws Exception {
advertiser = null;
locator = null;
diff --git a/protocols/bundles/ch.ethz.iks.slp/src/main/java/ch/ethz/iks/slp/impl/OSGiPlatformAbstraction.java b/protocols/bundles/ch.ethz.iks.slp/src/main/java/ch/ethz/iks/slp/impl/OSGiPlatformAbstraction.java
index 6ca378dea..eb1b53ea9 100644
--- a/protocols/bundles/ch.ethz.iks.slp/src/main/java/ch/ethz/iks/slp/impl/OSGiPlatformAbstraction.java
+++ b/protocols/bundles/ch.ethz.iks.slp/src/main/java/ch/ethz/iks/slp/impl/OSGiPlatformAbstraction.java
@@ -220,7 +220,7 @@ public class OSGiPlatformAbstraction implements PlatformAbstraction,
}
public void log(int level, String message, Throwable exception) {
- log(level, message + exception.getMessage());
+ log(level, message + " " + exception.toString());
}
public void log(ServiceReference sr, int level, String message) {
diff --git a/protocols/bundles/ch.ethz.iks.slp/src/main/java/ch/ethz/iks/slp/impl/SLPCore.java b/protocols/bundles/ch.ethz.iks.slp/src/main/java/ch/ethz/iks/slp/impl/SLPCore.java
index 6c0c45834..a224599ac 100644
--- a/protocols/bundles/ch.ethz.iks.slp/src/main/java/ch/ethz/iks/slp/impl/SLPCore.java
+++ b/protocols/bundles/ch.ethz.iks.slp/src/main/java/ch/ethz/iks/slp/impl/SLPCore.java
@@ -399,6 +399,7 @@ public abstract class SLPCore {
try {
daemon = (SLPDaemon) daemonConstr.newInstance(null);
} catch (Exception e) {
+ platform.logWarning("jSLP has not created a SLPDaemon", e);
daemon = null;
}
}
@@ -698,7 +699,7 @@ public abstract class SLPCore {
if (msg.xid == 0) {
msg.xid = nextXid();
}
- if (msg.getSize() > CONFIG.getMTU() || TCP_ONLY) {
+ if (msg.getSize() > CONFIG.getMTU() || TCP_ONLY || (daemon == null && isMulticastSocketInitialized)) {
return sendMessageTCP(msg);
}
diff --git a/protocols/bundles/ch.ethz.iks.slp/test/init.xargs b/protocols/bundles/ch.ethz.iks.slp/test/init.xargs
deleted file mode 100644
index b8665f496..000000000
--- a/protocols/bundles/ch.ethz.iks.slp/test/init.xargs
+++ /dev/null
@@ -1,6 +0,0 @@
--Dorg.osgi.framework.system.packages=junit.framework,junit.textui
-
--init
-
--istart file:target/jslp-osgi-1.1.0.RC1.jar
--istart file:runtimeTests/target/jslp-test-1.1.0.RC1.jar \ No newline at end of file

Back to the top