[#1010] Add verify module to check osgi bundles

This commit is contained in:
Andrei Pozolotin 2013-02-01 05:51:50 -06:00 committed by Norman Maurer
parent 56b1a18de0
commit f24872c566
52 changed files with 1402 additions and 48 deletions

View File

@ -69,5 +69,4 @@
</plugin>
</plugins>
</build>
</project>

View File

@ -84,6 +84,7 @@
<module>handler</module>
<module>example</module>
<module>testsuite</module>
<!-- add "verify" back after karaf release -->
<module>all</module>
<module>tarball</module>
</modules>

View File

@ -14,11 +14,11 @@
* under the License.
*/
package io.netty.channel.udt.bench;
package io.netty.test.udt.bench;
import io.netty.channel.udt.util.CaliperBench;
import io.netty.channel.udt.util.CaliperRunner;
import io.netty.channel.udt.util.TrafficControl;
import io.netty.test.udt.util.CaliperBench;
import io.netty.test.udt.util.CaliperRunner;
import io.netty.test.udt.util.TrafficControl;
import java.util.List;

View File

@ -17,5 +17,5 @@
/**
* UDT Benchmarks
*/
package io.netty.channel.udt.bench;
package io.netty.test.udt.bench;

View File

@ -14,11 +14,11 @@
* under the License.
*/
package io.netty.channel.udt.bench.xfer;
package io.netty.test.udt.bench.xfer;
import io.netty.channel.udt.bench.BenchXfer;
import io.netty.channel.udt.util.CaliperRunner;
import io.netty.channel.udt.util.TrafficControl;
import io.netty.test.udt.bench.BenchXfer;
import io.netty.test.udt.util.CaliperRunner;
import io.netty.test.udt.util.TrafficControl;
import java.util.List;

View File

@ -14,15 +14,16 @@
* under the License.
*/
package io.netty.channel.udt.bench.xfer;
package io.netty.test.udt.bench.xfer;
import com.barchart.udt.SocketUDT;
import com.barchart.udt.StatusUDT;
import com.barchart.udt.TypeUDT;
import com.google.caliper.Param;
import io.netty.channel.udt.bench.BenchXfer;
import io.netty.channel.udt.util.CaliperRunner;
import io.netty.channel.udt.util.TrafficControl;
import io.netty.test.udt.bench.BenchXfer;
import io.netty.test.udt.util.CaliperRunner;
import io.netty.test.udt.util.TrafficControl;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
@ -32,7 +33,7 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicBoolean;
import static io.netty.channel.udt.util.UnitHelp.*;
import static io.netty.test.udt.util.UnitHelp.*;
/**
* perform two way native UDT socket send/recv

View File

@ -14,7 +14,7 @@
* under the License.
*/
package io.netty.channel.udt.bench.xfer;
package io.netty.test.udt.bench.xfer;
import com.yammer.metrics.Metrics;
import com.yammer.metrics.core.Counter;
@ -22,11 +22,12 @@ import com.yammer.metrics.core.Meter;
import io.netty.bootstrap.Bootstrap;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelHandler;
import io.netty.channel.udt.util.BootHelp;
import io.netty.channel.udt.util.CustomReporter;
import io.netty.channel.udt.util.EchoMessageHandler;
import io.netty.channel.udt.util.TrafficControl;
import io.netty.channel.udt.util.UnitHelp;
import io.netty.test.udt.util.BootHelp;
import io.netty.test.udt.util.CustomReporter;
import io.netty.test.udt.util.EchoMessageHandler;
import io.netty.test.udt.util.TrafficControl;
import io.netty.test.udt.util.UnitHelp;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -17,5 +17,5 @@
/**
* UDT Transfer Speed Benchmarks
*/
package io.netty.channel.udt.bench.xfer;
package io.netty.test.udt.bench.xfer;

View File

@ -14,10 +14,10 @@
* under the License.
*/
package io.netty.channel.udt.nio;
package io.netty.test.udt.nio;
import static org.junit.Assume.*;
import io.netty.channel.udt.util.UnitHelp;
import io.netty.test.udt.util.UnitHelp;
import org.junit.BeforeClass;

View File

@ -14,9 +14,11 @@
* under the License.
*/
package io.netty.channel.udt.nio;
package io.netty.test.udt.nio;
import io.netty.buffer.BufType;
import io.netty.channel.udt.nio.NioUdtByteAcceptorChannel;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -14,9 +14,11 @@
* under the License.
*/
package io.netty.channel.udt.nio;
package io.netty.test.udt.nio;
import io.netty.buffer.BufType;
import io.netty.channel.udt.nio.NioUdtByteConnectorChannel;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -14,16 +14,18 @@
* under the License.
*/
package io.netty.channel.udt.nio;
package io.netty.test.udt.nio;
import com.yammer.metrics.Metrics;
import com.yammer.metrics.core.Meter;
import io.netty.bootstrap.Bootstrap;
import io.netty.buffer.BufType;
import io.netty.channel.ChannelFuture;
import io.netty.channel.udt.util.BootHelp;
import io.netty.channel.udt.util.EchoByteHandler;
import io.netty.channel.udt.util.UnitHelp;
import io.netty.channel.udt.nio.NioUdtByteRendezvousChannel;
import io.netty.test.udt.util.BootHelp;
import io.netty.test.udt.util.EchoByteHandler;
import io.netty.test.udt.util.UnitHelp;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -14,9 +14,11 @@
* under the License.
*/
package io.netty.channel.udt.nio;
package io.netty.test.udt.nio;
import io.netty.buffer.BufType;
import io.netty.channel.udt.nio.NioUdtMessageAcceptorChannel;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -14,9 +14,11 @@
* under the License.
*/
package io.netty.channel.udt.nio;
package io.netty.test.udt.nio;
import io.netty.buffer.BufType;
import io.netty.channel.udt.nio.NioUdtMessageConnectorChannel;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -14,16 +14,18 @@
* under the License.
*/
package io.netty.channel.udt.nio;
package io.netty.test.udt.nio;
import com.yammer.metrics.Metrics;
import com.yammer.metrics.core.Meter;
import io.netty.bootstrap.Bootstrap;
import io.netty.buffer.BufType;
import io.netty.channel.ChannelFuture;
import io.netty.channel.udt.util.BootHelp;
import io.netty.channel.udt.util.EchoMessageHandler;
import io.netty.channel.udt.util.UnitHelp;
import io.netty.channel.udt.nio.NioUdtMessageRendezvousChannel;
import io.netty.test.udt.util.BootHelp;
import io.netty.test.udt.util.EchoMessageHandler;
import io.netty.test.udt.util.UnitHelp;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -14,9 +14,10 @@
* under the License.
*/
package io.netty.channel.udt.nio;
package io.netty.test.udt.nio;
import io.netty.channel.udt.UdtServerChannel;
import io.netty.channel.udt.nio.NioUdtProvider;
import org.junit.Test;
import org.slf4j.Logger;

View File

@ -14,7 +14,7 @@
* under the License.
*/
package io.netty.channel.udt.util;
package io.netty.test.udt.util;
import io.netty.bootstrap.Bootstrap;
import io.netty.channel.ChannelHandler;

View File

@ -14,7 +14,7 @@
* under the License.
*/
package io.netty.channel.udt.util;
package io.netty.test.udt.util;
import com.google.caliper.SimpleBenchmark;
import org.slf4j.Logger;

View File

@ -14,7 +14,7 @@
* under the License.
*/
package io.netty.channel.udt.util;
package io.netty.test.udt.util;
import com.google.caliper.Measurement;
import com.google.caliper.MeasurementSet;

View File

@ -15,7 +15,7 @@
* under the License.
*/
package io.netty.channel.udt.util;
package io.netty.test.udt.util;
import com.google.caliper.ConfiguredBenchmark;
import com.google.caliper.Environment;

View File

@ -14,7 +14,7 @@
* under the License.
*/
package io.netty.channel.udt.util;
package io.netty.test.udt.util;
import com.yammer.metrics.Metrics;
import com.yammer.metrics.core.Clock;

View File

@ -14,7 +14,7 @@
* under the License.
*/
package io.netty.channel.udt.util;
package io.netty.test.udt.util;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;

View File

@ -14,7 +14,7 @@
* under the License.
*/
package io.netty.channel.udt.util;
package io.netty.test.udt.util;
import com.yammer.metrics.core.Meter;
import io.netty.buffer.ByteBuf;

View File

@ -14,7 +14,7 @@
* under the License.
*/
package io.netty.channel.udt.util;
package io.netty.test.udt.util;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -14,7 +14,7 @@
* under the License.
*/
package io.netty.channel.udt.util;
package io.netty.test.udt.util;
import com.barchart.udt.SocketUDT;
import com.barchart.udt.StatusUDT;

View File

@ -14,7 +14,7 @@
* under the License.
*/
package io.netty.channel.udt.util;
package io.netty.test.udt.util;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;

View File

@ -17,5 +17,5 @@
/**
* UDT Benchmarks and Tests Utilities
*/
package io.netty.channel.udt.util;
package io.netty.test.udt.util;

3
verify/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
target/
reports/

52
verify/pom.xml Normal file
View File

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2013 The Netty Project
~
~ The Netty Project 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.netty</groupId>
<artifactId>netty-parent</artifactId>
<version>4.0.0.Beta1-SNAPSHOT</version>
</parent>
<artifactId>netty-verify</artifactId>
<packaging>pom</packaging>
<name>Netty/Verify</name>
<description>parent for build constrains modules</description>
<modules>
<module>verify-osgi-split</module>
<module>verify-osgi-deps</module>
<module>verify-osgi-exam</module>
</modules>
<build>
<plugins>
<!-- do not deploy this artifact -->
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>

2
verify/readme.md Normal file
View File

@ -0,0 +1,2 @@
parent for build constrains modules

View File

@ -0,0 +1,176 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2013 The Netty Project
~
~ The Netty Project 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.netty</groupId>
<artifactId>netty-verify</artifactId>
<version>4.0.0.Beta1-SNAPSHOT</version>
</parent>
<artifactId>netty-verify-osgi-deps</artifactId>
<packaging>feature</packaging>
<name>Netty/Verify/OSGi/Deps</name>
<description>verify osgi compliance: all transitive dependencies must be osgi bundles</description>
<dependencies>
<!-- MAIN -->
<!-- include all osgi bundle release modules -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-buffer</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-codec</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-codec-http</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-codec-socks</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-handler</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-transport</artifactId>
<version>${project.version}</version>
</dependency>
<!--
* DO NOT install netty-transport-rxtx bundle due to rxtx
* depencency:
* <p>
* 1) rxtx does not have automatic native library loader
* <p>
* 2) rxtx does not have osgi bundle
-->
<!-- <dependency> -->
<!-- <groupId>${project.groupId}</groupId> -->
<!-- <artifactId>netty-transport-rxtx</artifactId> -->
<!-- <version>${project.version}</version> -->
<!-- </dependency> -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-transport-sctp</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-transport-udt</artifactId>
<version>${project.version}</version>
</dependency>
<!-- TEST -->
<!-- file/text conversion -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-io</artifactId>
<version>1.3.2</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<!-- produce karaf feature.xml -->
<plugin>
<groupId>org.apache.karaf.tooling</groupId>
<artifactId>karaf-maven-plugin</artifactId>
<version>3.0.0-SNAPSHOT</version>
<extensions>true</extensions>
</plugin>
<!-- invoke integration tests -->
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- do not deploy this artifact -->
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.karaf.tooling</groupId>
<artifactId>karaf-maven-plugin</artifactId>
<versionRange>[0,)</versionRange>
<goals>
<goal>features-generate-descriptor</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>

View File

@ -0,0 +1,67 @@
### info
this module build will fail if any dependencies are not osgi bundles
http://en.wikipedia.org/wiki/OSGi#Bundles
on failure, build log will show error message similar to the following:
(org.rxtx/rxtx/2.1.7 is not osgi bundle)
```
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running io.netty.verify.osgi.IT
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" name="netty-verify-osgi-deps">
<feature name="netty-verify-osgi-deps" version="4.0.0.Beta1-SNAPSHOT" description="Netty/Verify/OSGi/Deps">
<details>verify osgi compliance: all transitive dependencies are osgi bundles</details>
<bundle>mvn:io.netty/netty-buffer/4.0.0.Beta1-SNAPSHOT</bundle>
<bundle>mvn:io.netty/netty-common/4.0.0.Beta1-SNAPSHOT</bundle>
<bundle>mvn:io.netty/netty-codec/4.0.0.Beta1-SNAPSHOT</bundle>
<bundle>mvn:io.netty/netty-transport/4.0.0.Beta1-SNAPSHOT</bundle>
<bundle>mvn:io.netty/netty-codec-http/4.0.0.Beta1-SNAPSHOT</bundle>
<bundle>mvn:io.netty/netty-handler/4.0.0.Beta1-SNAPSHOT</bundle>
<bundle>mvn:io.netty/netty-codec-socks/4.0.0.Beta1-SNAPSHOT</bundle>
<bundle>mvn:io.netty/netty-transport-rxtx/4.0.0.Beta1-SNAPSHOT</bundle>
<bundle>wrap:mvn:org.rxtx/rxtx/2.1.7</bundle>
<bundle>mvn:io.netty/netty-transport-sctp/4.0.0.Beta1-SNAPSHOT</bundle>
<bundle>mvn:io.netty/netty-transport-udt/4.0.0.Beta1-SNAPSHOT</bundle>
<bundle>mvn:com.barchart.udt/barchart-udt-bundle/2.2.0</bundle>
</feature>
</features>
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.038 sec <<< FAILURE!
verifyNoWrapProtocol(io.netty.verify.osgi.IT) Time elapsed: 0.014 sec <<< FAILURE!
java.lang.AssertionError: karaf feature.xml contains 'wrap:' protocol: some transitive dependencies are not osgi bundles
at org.junit.Assert.fail(Assert.java:93)
at io.netty.verify.osgi.IT.verifyNoWrapProtocol(IT.java:48)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
```

View File

@ -0,0 +1,26 @@
/*
* Copyright 2013 The Netty Project
*
* The Netty Project 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 io.netty.verify.osgi;
/**
* Placeholder class to generate valid OSGI bundle.
* <p>
* maven-bundle-plugin enforces OSGI specification and rejects to build non
* fragment bundles which export no packages / no classes.
*/
public class Dummy {
}

View File

@ -0,0 +1,19 @@
/*
* Copyright 2013 The Netty Project
*
* The Netty Project 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 io.netty.verify.osgi;

View File

@ -0,0 +1,55 @@
/*
* Copyright 2013 The Netty Project
*
* The Netty Project 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 io.netty.verify.osgi;
import static org.junit.Assert.*;
import java.io.File;
import org.apache.commons.io.FileUtils;
import org.junit.Test;
/**
* Dependency Integration Tests.
*/
public class DependencyIT {
/**
* Default location of generated karaf features file.
* <p>
* See <a href=
* "http://karaf.apache.org/manual/3.0.0-SNAPSHOT/developers-guide/karaf-maven-plugin.html"
* >karaf-maven-plugin</a>
*/
public static final String FEATURE = "./target/feature/feature.xml";
@Test
public void verifyKarafFeatureHasNoWrapProtocol() throws Exception {
final File file = new File(FEATURE);
final String text = FileUtils.readFileToString(file);
if (text.contains("wrap:")) {
System.err.println(text);
fail("karaf feature.xml contains 'wrap:' protocol: some transitive dependencies are not osgi bundles");
} else {
System.out.println("all transitive dependencies are osgi bundles");
}
}
}

2
verify/verify-osgi-exam/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
lib/

View File

@ -0,0 +1,310 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2013 The Netty Project
~
~ The Netty Project 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.netty</groupId>
<artifactId>netty-verify</artifactId>
<version>4.0.0.Beta1-SNAPSHOT</version>
</parent>
<artifactId>netty-verify-osgi-exam</artifactId>
<packaging>bundle</packaging>
<name>Netty/Verify/OSGi/Exam</name>
<description>verify osgi compliance: run tests inside osgi framework</description>
<properties>
<exam.version>3.0.0</exam.version>
<url.version>1.5.0</url.version>
</properties>
<dependencies>
<!-- MAIN -->
<!-- logging via http://team.ops4j.org/wiki/display/paxlogging/Pax+Logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<!-- osgi scr annotations https://github.com/carrot-garden/carrot-osgi/tree/master/carrot-osgi-anno-scr/carrot-osgi-anno-scr-core -->
<dependency>
<groupId>com.carrotgarden.osgi</groupId>
<artifactId>carrot-osgi-anno-scr-core</artifactId>
<version>1.1.3</version>
</dependency>
<!-- osgi scr runtime http://felix.apache.org/site/apache-felix-service-component-runtime.html -->
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.scr</artifactId>
<version>1.6.2</version>
</dependency>
<!-- include all netty osgi bundle release modules -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-buffer</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-codec</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-codec-http</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-codec-socks</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-handler</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-transport</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-transport-rxtx</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-transport-sctp</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-transport-udt</artifactId>
<version>${project.version}</version>
</dependency>
<!-- TEST -->
<!-- transport udt tests and deps -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-transport-udt</artifactId>
<version>${project.version}</version>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.yammer.metrics</groupId>
<artifactId>metrics-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.caliper</groupId>
<artifactId>caliper</artifactId>
<scope>test</scope>
</dependency>
<!-- java 7 compatibility http://blog.osgi.org/2012/10/43-companion-code-for-java-7.html -->
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<version>4.3.1</version>
<scope>provided</scope>
</dependency>
<!-- pax exam environment -->
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-container-native</artifactId>
<version>${exam.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-junit4</artifactId>
<version>${exam.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-invoker-junit</artifactId>
<version>${exam.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-inject</artifactId>
<version>${exam.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-extender-service</artifactId>
<version>${exam.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-link-mvn</artifactId>
<version>${exam.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.url</groupId>
<artifactId>pax-url-aether</artifactId>
<version>${url.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.url</groupId>
<artifactId>pax-url-wrap</artifactId>
<version>${url.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.framework</artifactId>
<version>4.0.3</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<!-- make dependency versions available for pax exam -->
<plugin>
<groupId>org.apache.servicemix.tooling</groupId>
<artifactId>depends-maven-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<id>generate-depends-file</id>
<phase>generate-resources</phase>
<goals>
<goal>generate-depends-file</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- generate osgi scr component descriptors -->
<plugin>
<groupId>com.carrotgarden.maven</groupId>
<artifactId>carrot-maven-scr-plugin</artifactId>
<version>1.1.5</version>
<configuration>
<targetDirectorySCR>OSGI-INF/service-component</targetDirectorySCR>
</configuration>
<executions>
<execution>
<id>clean</id>
<phase>clean</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
<execution>
<id>generate</id>
<phase>process-classes</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- include osgi scr component descriptors -->
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<Service-Component>OSGI-INF/service-component/*.xml</Service-Component>
</instructions>
</configuration>
</plugin>
<!-- invoke integration tests -->
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- do not deploy this artifact -->
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.servicemix.tooling</groupId>
<artifactId>depends-maven-plugin</artifactId>
<versionRange>[0,)</versionRange>
<goals>
<goal>generate-depends-file</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>

View File

@ -0,0 +1,10 @@
### info
this module build will fail if
* netty osgi modules can not be loaded by osgi framework
* netty tests fail inside osgi framework
for example
```
ERROR: Bundle io.netty.buffer [15] Error starting mvn:io.netty/netty-buffer/4.0.0.Beta1-SNAPSHOT (org.osgi.framework.BundleException: Unresolved constraint in bundle io.netty.buffer [15]: Unable to resolve 15.0: missing requirement [15.0] osgi.wiring.package; (osgi.wiring.package=io.netty.util.internal))
```

View File

@ -0,0 +1,26 @@
/*
* Copyright 2013 The Netty Project
*
* The Netty Project 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 io.netty.verify.osgi;
/**
* Service for testing inside OSGI framework.
*/
public interface NettyService {
/** verify osgi startup */
String getHelloNetty();
}

View File

@ -0,0 +1,47 @@
/*
* Copyright 2013 The Netty Project
*
* The Netty Project 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 io.netty.verify.osgi;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Deactivate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Tester Service Component/Implementation.
*/
@Component
public class NettyServiceProvider implements NettyService {
protected final Logger log = LoggerFactory.getLogger(getClass());
@Override
public String getHelloNetty() {
return "hello netty";
}
@Activate
protected void activate() {
log.info("activate");
}
@Deactivate
protected void deactivate() {
log.info("deactivate");
}
}

View File

@ -0,0 +1,20 @@
/*
* Copyright 2013 The Netty Project
*
* The Netty Project 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 Framework Tests.
*/
package io.netty.verify.osgi;

View File

@ -0,0 +1 @@
mvn:org.ops4j.pax.logging/pax-logging-api/1.7.0

View File

@ -0,0 +1,6 @@
### info
override select links from
http://search.maven.org/#search%7Cga%7C1%7Cpax-exam-link-mvn

View File

@ -0,0 +1,56 @@
/*
* Copyright 2013 The Netty Project
*
* The Netty Project 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 io.netty.verify.osgi;
import static org.junit.Assert.*;
import javax.inject.Inject;
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.junit.PaxExam;
import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
import org.ops4j.pax.exam.spi.reactors.PerClass;
import org.osgi.framework.BundleContext;
/**
* Invoke Netty Tests inside configured OSGI framework.
*/
@RunWith(PaxExam.class)
@ExamReactorStrategy(PerClass.class)
public class BasicFrameworkIT {
@Inject
private BundleContext bundleContext;
@Inject
private NettyService nettyService;
@Configuration
public Option[] config() {
return UnitHelp.config();
}
@Test
public void verifyNettyService() {
assertNotNull(bundleContext);
assertNotNull(nettyService);
assertEquals("hello netty", nettyService.getHelloNetty());
}
}

View File

@ -0,0 +1,70 @@
/*
* Copyright 2013 The Netty Project
*
* The Netty Project 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 io.netty.verify.osgi;
import static org.junit.Assert.*;
import static org.ops4j.pax.exam.CoreOptions.*;
import io.netty.test.udt.nio.NioUdtMessageRendezvousChannelTest;
import javax.inject.Inject;
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.junit.PaxExam;
import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
import org.ops4j.pax.exam.spi.reactors.PerClass;
import org.osgi.framework.BundleContext;
/**
* Invoke UDT Test inside configured OSGI framework.
*/
@RunWith(PaxExam.class)
@ExamReactorStrategy(PerClass.class)
public class NioUdtMessageRendezvousChannelIT extends
NioUdtMessageRendezvousChannelTest {
@Inject
private BundleContext bundleContext;
@Configuration
public Option[] config() {
return UnitHelp.config(
/** install UDT tests bundle */
wrappedBundle(maven().groupId("io.netty")
.artifactId("netty-transport-udt").classifier("tests")
.versionAsInProject()),
/** install tests dependency */
wrappedBundle(maven().groupId("com.yammer.metrics")
.artifactId("metrics-core").versionAsInProject()),
/** install tests dependency */
wrappedBundle(maven().groupId("com.google.caliper")
.artifactId("caliper").versionAsInProject())
);
}
@Test
public void verify() throws Exception {
assertNotNull(bundleContext);
super.basicEcho();
}
}

View File

@ -0,0 +1,146 @@
/*
* Copyright 2013 The Netty Project
*
* The Netty Project 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 io.netty.verify.osgi;
import static org.ops4j.pax.exam.CoreOptions.*;
import java.util.Arrays;
import java.util.List;
import org.ops4j.pax.exam.Option;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.wiring.BundleWire;
import org.osgi.framework.wiring.BundleWiring;
/**
* Unit Test Utilities.
*/
public class UnitHelp {
private UnitHelp() {
}
/**
* Default framework test configuration.
*/
public static Option[] config() {
return options(
/** set test logging level inside osgi container */
systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level")
.value("INFO"),
/** install logging */
// mavenBundle().groupId("org.ops4j.pax.logging").artifactId(
// "pax-logging-api"),
// mavenBundle().groupId("org.ops4j.pax.logging").artifactId(
// "pax-logging-service"),
/** install scr annotations */
mavenBundle("com.carrotgarden.osgi",
"carrot-osgi-anno-scr-core").versionAsInProject(),
/** install scr runtime provider */
mavenBundle("org.apache.felix", "org.apache.felix.scr")
.versionAsInProject(),
/** install netty bundle */
mavenBundle("io.netty", "netty-common").versionAsInProject(),
/** install netty bundle */
mavenBundle("io.netty", "netty-buffer").versionAsInProject(),
/** install netty bundle */
mavenBundle("io.netty", "netty-codec").versionAsInProject(),
/** install netty bundle */
mavenBundle("io.netty", "netty-codec-http")
.versionAsInProject(),
/** install netty bundle */
mavenBundle("io.netty", "netty-codec-socks")
.versionAsInProject(),
/** install netty bundle */
mavenBundle("io.netty", "netty-handler").versionAsInProject(),
/** install netty bundle */
mavenBundle("io.netty", "netty-transport").versionAsInProject(),
/**
* DO NOT install netty-transport-rxtx bundle due to rxtx
* depencency:
* <p>
* 1) rxtx does not have automatic native library loader
* <p>
* 2) rxtx does not have osgi bundle
*/
// mavenBundle("io.netty", "netty-transport-rxtx")
// .versionAsInProject(),
/** install netty bundle */
mavenBundle("io.netty", "netty-transport-sctp")
.versionAsInProject(),
/** install netty bundle with dependency */
mavenBundle("io.netty", "netty-transport-udt")
.versionAsInProject(),
mavenBundle("com.barchart.udt", "barchart-udt-bundle")
.versionAsInProject(),
/** install this module bundle */
bundle("reference:file:target/classes"),
/** install java unit bundles */
junitBundles());
}
/**
* Combine default framework options with custom options.
*/
public static Option[] config(final Option... options) {
return concat(config(), options);
}
/**
* Concatenate generic arrays.
*/
public static <T> T[] concat(final T[] first, final T[] second) {
final T[] result = Arrays.copyOf(first, first.length + second.length);
System.arraycopy(second, 0, result, first.length, second.length);
return result;
}
/**
* Display bundle dependencies.
*/
public static void logBundleWires(final BundleContext context) {
for (final Bundle bundle : context.getBundles()) {
final BundleWiring wiring = bundle.adapt(BundleWiring.class);
System.out.println("# bundle=" + bundle);
final List<BundleWire> provided = wiring.getProvidedWires(null);
for (final BundleWire wire : provided) {
System.out.println("# provided=" + wire);
}
final List<BundleWire> required = wiring.getRequiredWires(null);
for (final BundleWire wire : required) {
System.out.println("# required=" + wire);
}
}
}
}

View File

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2013 The Netty Project
~
~ The Netty Project 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.
-->
<configuration>
<!-- logging outside osgi container -->
<!-- console -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>//%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<!-- file -->
<appender name="TEST_LOG" class="ch.qos.logback.core.FileAppender">
<file>target/test.log</file>
<encoder>
<pattern>//%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<root level="INFO">
<appender-ref ref="STDOUT" />
<appender-ref ref="TEST_LOG" />
</root>
<logger name="org.ops4j.pax" level="INFO" />
</configuration>

View File

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2013 The Netty Project
~
~ The Netty Project 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.netty</groupId>
<artifactId>netty-verify</artifactId>
<version>4.0.0.Beta1-SNAPSHOT</version>
</parent>
<artifactId>netty-verify-osgi-split</artifactId>
<packaging>bundle</packaging>
<name>Netty/Verify/OSGi/Split</name>
<description>verify osgi compliance: prohibit split packages</description>
<dependencies>
<!-- include all osgi bundle release modules -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-buffer</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-codec</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-codec-http</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-codec-socks</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-handler</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-transport</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-transport-rxtx</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-transport-sctp</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-transport-udt</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<!-- fail build on package split -->
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<Export-Package>
!META-INF,
*;-split-package:=error
</Export-Package>
</instructions>
</configuration>
</plugin>
<!-- do not deploy this artifact -->
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,17 @@
### info
this module build will fail if any dependencies introduce osgi split package
http://wiki.osgi.org/wiki/Split_Packages
on failure, build log will show error message similar to the following:
```
[INFO] --- maven-bundle-plugin:2.3.7:bundle (default-bundle) @ netty-verify-osgi ---
[ERROR] Bundle io.netty:netty-verify-osgi:bundle:4.0.0.Beta1-SNAPSHOT : Split package io/netty/buffer
Use directive -split-package:=(merge-first|merge-last|error|first) on Export/Private Package instruction to get rid of this warning
Package found in [Jar:netty-buffer, Jar:netty-transport-udt]
Reference from /home/user1/.m2/repository/io/netty/netty-transport-udt/4.0.0.Beta1-SNAPSHOT/netty-transport-udt-4.0.0.Beta1-SNAPSHOT.jar
Classpath [Jar:., Jar:netty-buffer, Jar:netty-codec, Jar:netty-codec-http, Jar:netty-codec-socks, Jar:netty-common, Jar:netty-handler, Jar:netty-transport, Jar:netty-transport-rxtx, Jar:rxtx, Jar:netty-transport-sctp, Jar:netty-transport-udt, Jar:barchart-udt-bundle]
[ERROR] Error(s) found in bundle configuration
```

View File

@ -0,0 +1,26 @@
/*
* Copyright 2013 The Netty Project
*
* The Netty Project 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 io.netty.verify.osgi;
/**
* Placeholder class to generate valid OSGI bundle.
* <p>
* maven-bundle-plugin enforces OSGI specification and rejects to build non
* fragment bundles which export no packages / no classes.
*/
public class Dummy {
}

View File

@ -0,0 +1,19 @@
/*
* Copyright 2013 The Netty Project
*
* The Netty Project 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 io.netty.verify.osgi;

View File

@ -0,0 +1,23 @@
/*
* Copyright 2013 The Netty Project
*
* The Netty Project 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 io.netty.verify.osgi;
/**
* Placeholder class.
*/
public class TestDummy {
}