Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into master-seeburger
Browse files Browse the repository at this point in the history
Conflicts:
	itests/felix/src/test/java/org/apache/aries/rsa/itests/felix/RsaTestBase.java
	itests/felix/src/test/java/org/apache/aries/rsa/itests/felix/discovery/config/TestConfigDiscoveryRoundTrip.java
	parent/pom.xml
	provider/fastbin/src/test/java/org/apache/aries/rsa/provider/fastbin/tcp/LengthPrefixedCodecTest.java
	rsa/src/main/java/org/apache/aries/rsa/core/RemoteServiceAdminCore.java
	topology-manager/src/main/java/org/apache/aries/rsa/topologymanager/exporter/TopologyManagerExport.java
	topology-manager/src/test/java/org/apache/aries/rsa/topologymanager/exporter/TopologyManagerExportTest.java
  • Loading branch information
Johannes Utzig committed May 30, 2017
2 parents 15e4ca6 + e3bad50 commit a5019a8
Show file tree
Hide file tree
Showing 14 changed files with 129 additions and 131 deletions.
10 changes: 5 additions & 5 deletions itests/felix/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.configadmin</artifactId>
<version>1.8.8</version>
<version>1.8.14</version>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.scr</artifactId>
<version>2.0.2</version>
<version>2.0.10</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -134,7 +134,7 @@
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-container-forked</artifactId>
<artifactId>pax-exam-container-native</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -150,7 +150,7 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.framework</artifactId>
<version>5.0.1</version>
<version>5.6.1</version>
<scope>test</scope>
</dependency>

Expand All @@ -166,7 +166,7 @@
<plugin>
<groupId>org.apache.servicemix.tooling</groupId>
<artifactId>depends-maven-plugin</artifactId>
<version>1.3.1</version>
<version>1.4.0</version>
<executions>
<execution>
<id>generate-depends-file</id>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.options.MavenArtifactProvisionOption;
import org.ops4j.pax.exam.options.OptionalCompositeOption;
import org.ops4j.pax.exam.options.SystemPropertyOption;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.service.cm.ConfigurationAdmin;
Expand Down Expand Up @@ -71,7 +70,7 @@ public void testInstalled() throws Exception {
}
}

protected static int getFreePort() throws IOException {
protected int getFreePort() throws IOException {
ServerSocket socket = new ServerSocket();
try {
socket.setReuseAddress(true); // enables quickly reopening socket on same port
Expand All @@ -82,51 +81,62 @@ protected static int getFreePort() throws IOException {
}
}

protected Bundle getBundle(String symName) {
Bundle serviceBundle = null;
Bundle[] bundles = bundleContext.getBundles();
for (Bundle bundle : bundles) {
if(symName.equals(bundle.getSymbolicName())) {
serviceBundle = bundle;
break;
}
}
return serviceBundle;
}

protected static Option echoTcpAPI() {
return mvn("org.apache.aries.rsa.examples.echotcp", "org.apache.aries.rsa.examples.echotcp.api");
}

protected static Option echoTcpConsumer() {
return CoreOptions.composite(
mvn("org.apache.felix", "org.apache.felix.scr"),
mvn("org.apache.aries.rsa.examples.echotcp", "org.apache.aries.rsa.examples.echotcp.api"),
// Consumer is needed to trigger service import. Pax exam inject does not trigger it
echoTcpAPI(),
// Consumer bundle is needed to trigger service import. Pax exam inject does not trigger it
mvn("org.apache.aries.rsa.examples.echotcp", "org.apache.aries.rsa.examples.echotcp.consumer")
);
}

protected static Option echoTcpService() {
return composite(
mvn("org.apache.felix", "org.apache.felix.scr"),
mvn("org.apache.aries.rsa.examples.echotcp", "org.apache.aries.rsa.examples.echotcp.api"),
echoTcpAPI(),
mvn("org.apache.aries.rsa.examples.echotcp", "org.apache.aries.rsa.examples.echotcp.service")
);
}

protected static Option rsaCore() {
return composite(junitBundles(),
return composite(junitBundles(),
localRepo(),
systemProperty("pax.exam.osgi.unresolved.fail").value("true"),
systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("INFO"),
systemProperty("aries.rsa.hostname").value("localhost"),
mvn("org.apache.felix", "org.apache.felix.configadmin"),
mvn("org.apache.felix", "org.apache.felix.scr"),
mvn("org.apache.aries.rsa", "org.apache.aries.rsa.core"),
mvn("org.apache.aries.rsa", "org.apache.aries.rsa.spi"),
mvn("org.apache.aries.rsa", "org.apache.aries.rsa.topology-manager"),
mvn("org.apache.aries.rsa.discovery", "org.apache.aries.rsa.discovery.local")
);
}

protected static Option debug() {
return CoreOptions.vmOption("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005");
}

protected static Option rsaDiscoveryConfig() {
return composite(
mvn("org.apache.aries.rsa.discovery", "org.apache.aries.rsa.discovery.config")
);
}

protected static Option rsaDiscoveryZookeeper() {
return composite(
systemProperty("zkPort").value("15201"),
Expand All @@ -135,14 +145,11 @@ protected static Option rsaDiscoveryZookeeper() {
);
}

protected static Option rsaTcp() {
return composite(
systemProperty("java.net.preferIPv4Stack").value("true"),
mvn("org.apache.aries.rsa.provider", "org.apache.aries.rsa.provider.tcp")
);
protected static Option rsaProviderTcp() {
return mvn("org.apache.aries.rsa.provider", "org.apache.aries.rsa.provider.tcp");
}

protected static Option rsaFastBin() {
protected static Option rsaProviderFastBin() {
return composite(mvn("org.fusesource.hawtbuf", "hawtbuf"),
mvn("org.fusesource.hawtdispatch", "hawtdispatch"),
mvn("org.apache.aries.rsa.provider", "org.apache.aries.rsa.provider.fastbin"));
Expand All @@ -160,7 +167,7 @@ protected static Option configZKServer() {
.asOption();
}

protected static Option configFastBin(String port) {
protected static Option configFastBinPort(String port) {
return newConfiguration("org.apache.aries.rsa.provider.fastbin") //
.put("uri", "tcp://0.0.0.0:" + port) //
.asOption();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@
import org.ops4j.pax.exam.junit.PaxExam;
import org.ops4j.pax.exam.spi.PaxExamRuntime;

/**
* Can be used instead of the PaxExam runner to start a second
* OSGi container that typically hosts the server side for the test.
*
* Use the @ServerConfiguration annotation to mark the config of your server side
*/
public class TwoContainerPaxExam extends PaxExam {

private Class<?> testClass;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,66 +19,61 @@
*/


import static org.junit.Assert.assertEquals;
import static org.ops4j.pax.exam.cm.ConfigurationAdminOptions.factoryConfiguration;

import java.io.IOException;

import javax.inject.Inject;

import org.apache.aries.rsa.examples.echotcp.api.EchoService;
import org.apache.aries.rsa.itests.felix.RsaTestBase;
import org.apache.aries.rsa.itests.felix.ServerConfiguration;
import org.apache.aries.rsa.itests.felix.TwoContainerPaxExam;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Configuration;
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.options.SystemPropertyOption;

import javax.inject.Inject;
import java.io.IOException;

import static org.junit.Assert.assertEquals;
import static org.ops4j.pax.exam.cm.ConfigurationAdminOptions.factoryConfiguration;

@RunWith(TwoContainerPaxExam.class)
public class TestConfigDiscoveryRoundTrip extends RsaTestBase {

@Inject
EchoService echoService;

static String tcpPort = "8201";

@ServerConfiguration
public static Option[] remoteConfig() throws IOException {
return new Option[] {
rsaCore(),
rsaTcp(),
echoTcpService()
return new Option[] //
{
rsaCore(), //
rsaProviderTcp(), //
echoTcpService()
};
}

@Configuration
public static Option[] configure() throws Exception {
return new Option[] {
rsaCore(),
rsaDiscoveryConfig(),
rsaTcp(),
echoTcpConsumer(),
configTcpConfigDiscovery()
return new Option[] //
{
rsaCore(), //
rsaDiscoveryConfig(), //
rsaProviderTcp(), //
echoTcpConsumer(), //
configImportEchoService()
};
}


protected static Option configTcpConfigDiscovery() {
protected static Option configImportEchoService() {
return factoryConfiguration("org.apache.aries.rsa.discovery.config")
.put("service.imported", "true")
.put("service.imported.configs", "aries.tcp")
.put("objectClass", "org.apache.aries.rsa.examples.echotcp.api.EchoService")
.put("endpoint.id", "tcp://localhost:"+tcpPort)
.put("endpoint.id", "tcp://localhost:8201")
.put("aries.tcp.hostname", "localhost")
.put("aries.tcp.port", tcpPort)
.put("aries.tcp.port", "8201")
.asOption();
}

@Test
@Ignore //cannot get this to work on the new buildslaves in openstack
public void testCall() throws Exception {
assertEquals("test", echoService.echo("test"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,32 +36,35 @@

@RunWith(TwoContainerPaxExam.class)
public class TestFastbinRoundTrip extends RsaTestBase {
private static final String FASTBIN_PORT_SERVER = "2544";
private static final String FASTBIN_PORT_CLIENT = "2545";
@Inject
EchoService echoService;

@ServerConfiguration
public static Option[] remoteConfig() throws IOException {
return new Option[] //
{
rsaCore(),
rsaDiscoveryZookeeper(),
rsaFastBin(),
echoTcpService(),
configZKServer(),
configZKDiscovery(),
configFastBin("2544"),
{
rsaCore(), //
rsaDiscoveryZookeeper(), //
rsaProviderFastBin(), //
echoTcpService(), //
configZKServer(), //
configZKDiscovery(), //
configFastBinPort(FASTBIN_PORT_SERVER),
};
}

@Configuration
public static Option[] configure() throws Exception {
return new Option[] {
rsaCore(),
rsaDiscoveryZookeeper(),
rsaFastBin(),
echoTcpConsumer(),
configZKDiscovery(),
configFastBin("2545")
return new Option[] //
{
rsaCore(), //
rsaDiscoveryZookeeper(), //
rsaProviderFastBin(), //
echoTcpConsumer(), //
configZKDiscovery(), //
configFastBinPort(FASTBIN_PORT_CLIENT)
};
}

Expand Down
Loading

0 comments on commit a5019a8

Please # to comment.