Simplify bundle generation / Add io.netty.versions.properties to all JARs
- Fixes #2003 properly - Instead of using 'bundle' packaging, use 'jar' packaging. This is more robust because some strict build tools fail to retrieve the artifacts from a Maven repository unless their packaging is not 'jar'. - All artifacts now contain META-INF/io.netty.version.properties, which provides the detailed information about the build and repository. - Removed OSGi testsuite temporarily because it gives false errors during split package test and examination. - Add io.netty.util.Version for easy retrieval of version information
This commit is contained in:
parent
8753412d07
commit
407f0a36f5
2
.gitignore
vendored
2
.gitignore
vendored
@ -11,6 +11,4 @@
|
||||
/reports
|
||||
*/reports
|
||||
.DS_Store
|
||||
/common/src/main/java/io/netty/util/Version.java
|
||||
|
||||
|
||||
|
140
all/pom.xml
140
all/pom.xml
@ -30,6 +30,8 @@
|
||||
|
||||
<properties>
|
||||
<quickbuild>true</quickbuild>
|
||||
<generatedSourceDir>${project.build.directory}/src</generatedSourceDir>
|
||||
<dependencyVersionDir>${project.build.directory}/versions</dependencyVersionDir>
|
||||
</properties>
|
||||
|
||||
<profiles>
|
||||
@ -181,6 +183,17 @@
|
||||
<plugin>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<!-- Populate the properties whose key is groupId:artifactId:type
|
||||
and whose value is the path to the artifact -->
|
||||
<execution>
|
||||
<id>locate-dependencies</id>
|
||||
<phase>initialize</phase>
|
||||
<goals>
|
||||
<goal>properties</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
|
||||
<!-- Unpack all source files -->
|
||||
<execution>
|
||||
<id>unpack-sources</id>
|
||||
<phase>prepare-package</phase>
|
||||
@ -191,9 +204,11 @@
|
||||
<classifier>sources</classifier>
|
||||
<includes>io/netty/**</includes>
|
||||
<includeGroupIds>${project.groupId}</includeGroupIds>
|
||||
<outputDirectory>${project.build.directory}/src</outputDirectory>
|
||||
<outputDirectory>${generatedSourceDir}</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
||||
<!-- Unpack all class files -->
|
||||
<execution>
|
||||
<id>unpack-jars</id>
|
||||
<phase>prepare-package</phase>
|
||||
@ -208,6 +223,64 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<executions>
|
||||
<!-- Instead of generating a new version property file, merge others' version property files into one. -->
|
||||
<execution>
|
||||
<id>write-version-properties</id>
|
||||
<phase>none</phase>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>merge-version-properties</id>
|
||||
<phase>prepare-package</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<target>
|
||||
<taskdef resource="net/sf/antcontrib/antlib.xml" />
|
||||
<propertyselector
|
||||
property="versions"
|
||||
match="^(${project.groupId}:(?!netty-example)[^:]+:jar)$" select="\1"/>
|
||||
<for list="${versions}" param="x">
|
||||
<sequential>
|
||||
<unzip src="${@{x}}" dest="${dependencyVersionsDir}">
|
||||
<patternset>
|
||||
<include name="META-INF/${project.groupId}.versions.properties"/>
|
||||
</patternset>
|
||||
</unzip>
|
||||
<concat destfile="${project.build.outputDirectory}/META-INF/${project.groupId}.versions.properties"
|
||||
append="true">
|
||||
<path path="${dependencyVersionsDir}/META-INF/${project.groupId}.versions.properties"/>
|
||||
</concat>
|
||||
</sequential>
|
||||
</for>
|
||||
<delete dir="${dependencyVersionsDir}" quiet="true"/>
|
||||
</target>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
||||
<!-- Clean everything once finished so that IDE doesn't find the unpacked files. -->
|
||||
<execution>
|
||||
<id>clean-source-directory</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<target>
|
||||
<delete dir="${generatedSourceDir}" quiet="true" />
|
||||
<delete dir="${dependencyVersionDir}" quiet="true" />
|
||||
<delete dir="${project.build.outputDirectory}" quiet="true" />
|
||||
</target>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!-- Include the directory where the source files were unpacked -->
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
@ -220,13 +293,50 @@
|
||||
</goals>
|
||||
<configuration>
|
||||
<sources>
|
||||
<source>target/src</source>
|
||||
<source>${generatedSourceDir}</source>
|
||||
</sources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!-- Disable OSGi bundle manifest generation -->
|
||||
<plugin>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>maven-bundle-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>generate-manifest</id>
|
||||
<phase>none</phase>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!-- Override the default JAR configuration -->
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>default-jar</id>
|
||||
<phase>none</phase>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>all-in-one-jar</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifest>
|
||||
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
|
||||
</manifest>
|
||||
<index>true</index>
|
||||
</archive>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!-- Disable animal sniffer -->
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
@ -238,6 +348,7 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!-- Disable checkstyle -->
|
||||
<plugin>
|
||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||
@ -248,6 +359,7 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!-- Disable all plugin executions configured by jar packaging -->
|
||||
<plugin>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
@ -284,6 +396,8 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!-- Generate Xref -->
|
||||
<plugin>
|
||||
<artifactId>maven-jxr-plugin</artifactId>
|
||||
<executions>
|
||||
@ -311,6 +425,8 @@
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
|
||||
<!-- Generate Javadoc -->
|
||||
<plugin>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<executions>
|
||||
@ -326,7 +442,7 @@
|
||||
<excludePackageNames>*.internal,*.example</excludePackageNames>
|
||||
<docfilessubdirs>true</docfilessubdirs>
|
||||
<outputDirectory>${project.build.directory}/api</outputDirectory>
|
||||
<overview>${basedir}/src/javadoc/overview.html</overview>
|
||||
<overview>${project.basedir}/src/javadoc/overview.html</overview>
|
||||
<doctitle>Netty API Reference (${project.version})</doctitle>
|
||||
<windowtitle>Netty API Reference (${project.version})</windowtitle>
|
||||
<detectJavaApiLink>false</detectJavaApiLink>
|
||||
@ -347,24 +463,6 @@
|
||||
<locale>en_US</locale>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>clean-source-directory</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<target>
|
||||
<delete dir="${project.build.directory}/src" quiet="true" />
|
||||
<delete dir="${project.build.directory}/classes" quiet="true" />
|
||||
</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
@ -24,7 +24,7 @@
|
||||
</parent>
|
||||
|
||||
<artifactId>netty-buffer</artifactId>
|
||||
<packaging>bundle</packaging>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Netty/Buffer</name>
|
||||
|
||||
@ -35,5 +35,4 @@
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
@ -24,7 +24,7 @@
|
||||
</parent>
|
||||
|
||||
<artifactId>netty-codec-http</artifactId>
|
||||
<packaging>bundle</packaging>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Netty/Codec/HTTP</name>
|
||||
|
||||
@ -45,7 +45,5 @@
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
</project>
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
</parent>
|
||||
|
||||
<artifactId>netty-codec-socks</artifactId>
|
||||
<packaging>bundle</packaging>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Netty/Codec/Socks</name>
|
||||
|
||||
@ -41,3 +41,4 @@
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
</parent>
|
||||
|
||||
<artifactId>netty-codec</artifactId>
|
||||
<packaging>bundle</packaging>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Netty/Codec</name>
|
||||
|
||||
@ -62,6 +62,5 @@
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
</parent>
|
||||
|
||||
<artifactId>netty-common</artifactId>
|
||||
<packaging>bundle</packaging>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Netty/Common</name>
|
||||
|
||||
@ -55,84 +55,5 @@
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>maven-bundle-plugin</artifactId>
|
||||
<configuration>
|
||||
<instructions>
|
||||
<!-- enforce JVM vendor package as optional -->
|
||||
<Import-Package>
|
||||
sun.misc.*;resolution:=optional,
|
||||
*
|
||||
</Import-Package>
|
||||
<!-- override "internal" private package convention -->
|
||||
<Private-Package>
|
||||
!*
|
||||
</Private-Package>
|
||||
</instructions>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>write-version</id>
|
||||
<phase>validate</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<tasks>
|
||||
<taskdef resource="net/sf/antcontrib/antlib.xml" />
|
||||
<exec executable="git" outputproperty="gitOutput" resultproperty="gitExitCode" failonerror="false" failifexecutionfails="false">
|
||||
<arg value="log" />
|
||||
<arg value="-1" />
|
||||
<arg value="--format=format:%h" />
|
||||
</exec>
|
||||
<if>
|
||||
<equals arg2="0" arg1="${gitExitCode}" />
|
||||
<then>
|
||||
<property name="buildNumber" value="${gitOutput}" />
|
||||
</then>
|
||||
<else>
|
||||
<property name="buildNumber" value="unknown" />
|
||||
</else>
|
||||
</if>
|
||||
<echo>Build number: ${buildNumber}</echo>
|
||||
<mkdir dir="${project.build.directory}" />
|
||||
<echo message="${project.version}" file="${project.build.directory}/version.txt" />
|
||||
<echo message="// DO NOT MODIFY - WILL BE OVERWRITTEN DURING THE BUILD PROCESS${line.separator}package io.netty.util;${line.separator}/**${line.separator} * Provides the version information of Netty.${line.separator} * @apiviz.landmark${line.separator} */${line.separator}@SuppressWarnings("all")${line.separator}public final class Version {${line.separator} /** The version identifier. */${line.separator} public static final String ID = "${project.version}-${buildNumber}";${line.separator} /** Prints out the version identifier to stdout. */${line.separator} public static void main(String[] args) { System.out.println(ID); }${line.separator} private Version() { }${line.separator}}${line.separator}" file="${basedir}/src/main/java/io/netty/util/Version.java" />
|
||||
</tasks>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.ant</groupId>
|
||||
<artifactId>ant</artifactId>
|
||||
<version>1.8.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.ant</groupId>
|
||||
<artifactId>ant-launcher</artifactId>
|
||||
<version>1.8.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ant-contrib</groupId>
|
||||
<artifactId>ant-contrib</artifactId>
|
||||
<version>1.0b3</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>ant</groupId>
|
||||
<artifactId>ant</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
|
201
common/src/main/java/io/netty/util/Version.java
Normal file
201
common/src/main/java/io/netty/util/Version.java
Normal file
@ -0,0 +1,201 @@
|
||||
/*
|
||||
* 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.util;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
|
||||
/**
|
||||
* Retrieves the version information of available Netty artifacts.
|
||||
* <p>
|
||||
* This class retrieves the version information from {@code META-INF/io.netty.versions.properties}, which is
|
||||
* generated in build time. Note that it may not be possible to retrieve the information completely, depending on
|
||||
* your environment, such as the specified {@link ClassLoader}, the current {@link SecurityManager}.
|
||||
* </p>
|
||||
*/
|
||||
public final class Version {
|
||||
|
||||
private static final String PROP_VERSION = ".version";
|
||||
private static final String PROP_BUILD_DATE = ".buildDate";
|
||||
private static final String PROP_COMMIT_DATE = ".commitDate";
|
||||
private static final String PROP_SHORT_COMMIT_HASH = ".shortCommitHash";
|
||||
private static final String PROP_LONG_COMMIT_HASH = ".longCommitHash";
|
||||
private static final String PROP_REPO_STATUS = ".repoStatus";
|
||||
|
||||
/**
|
||||
* Retrieves the version information of Netty artifacts using the current
|
||||
* {@linkplain Thread#getContextClassLoader() context class loader}.
|
||||
*
|
||||
* @return A {@link Map} whose keys are Maven artifact IDs and whose values are {@link Version}s
|
||||
*/
|
||||
public static Map<String, Version> identify() {
|
||||
return identify(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the version information of Netty artifacts using the specified {@link ClassLoader}.
|
||||
*
|
||||
* @return A {@link Map} whose keys are Maven artifact IDs and whose values are {@link Version}s
|
||||
*/
|
||||
public static Map<String, Version> identify(ClassLoader classLoader) {
|
||||
if (classLoader == null) {
|
||||
classLoader = Thread.currentThread().getContextClassLoader();
|
||||
}
|
||||
|
||||
// Collect all properties.
|
||||
Properties props = new Properties();
|
||||
try {
|
||||
Enumeration<URL> resources = classLoader.getResources("META-INF/io.netty.versions.properties");
|
||||
while (resources.hasMoreElements()) {
|
||||
URL url = resources.nextElement();
|
||||
InputStream in = url.openStream();
|
||||
try {
|
||||
props.load(in);
|
||||
} finally {
|
||||
try {
|
||||
in.close();
|
||||
} catch (Exception ignore) {
|
||||
// Ignore.
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception ignore) {
|
||||
// Not critical. Just ignore.
|
||||
}
|
||||
|
||||
// Collect all artifactIds.
|
||||
Set<String> artifactIds = new HashSet<String>();
|
||||
for (Object o: props.keySet()) {
|
||||
String k = (String) o;
|
||||
|
||||
int dotIndex = k.indexOf('.');
|
||||
if (dotIndex <= 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String artifactId = k.substring(0, dotIndex);
|
||||
|
||||
// Skip the entries without required information.
|
||||
if (!props.containsKey(artifactId + PROP_VERSION) ||
|
||||
!props.containsKey(artifactId + PROP_BUILD_DATE) ||
|
||||
!props.containsKey(artifactId + PROP_COMMIT_DATE) ||
|
||||
!props.containsKey(artifactId + PROP_SHORT_COMMIT_HASH) ||
|
||||
!props.containsKey(artifactId + PROP_LONG_COMMIT_HASH) ||
|
||||
!props.containsKey(artifactId + PROP_REPO_STATUS)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
artifactIds.add(artifactId);
|
||||
}
|
||||
|
||||
Map<String, Version> versions = new TreeMap<String, Version>();
|
||||
for (String artifactId: artifactIds) {
|
||||
versions.put(
|
||||
artifactId,
|
||||
new Version(
|
||||
artifactId,
|
||||
props.getProperty(artifactId + PROP_VERSION),
|
||||
parseIso8601(props.getProperty(artifactId + PROP_BUILD_DATE)),
|
||||
parseIso8601(props.getProperty(artifactId + PROP_COMMIT_DATE)),
|
||||
props.getProperty(artifactId + PROP_SHORT_COMMIT_HASH),
|
||||
props.getProperty(artifactId + PROP_LONG_COMMIT_HASH),
|
||||
props.getProperty(artifactId + PROP_REPO_STATUS)));
|
||||
}
|
||||
|
||||
return versions;
|
||||
}
|
||||
|
||||
private static long parseIso8601(String value) {
|
||||
try {
|
||||
return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z").parse(value).getTime();
|
||||
} catch (ParseException e) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints the version information to {@link System#err}.
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
for (Version v: identify().values()) {
|
||||
System.err.println(v);
|
||||
}
|
||||
}
|
||||
|
||||
private final String artifactId;
|
||||
private final String artifactVersion;
|
||||
private final long buildTimeMillis;
|
||||
private final long commitTimeMillis;
|
||||
private final String shortCommitHash;
|
||||
private final String longCommitHash;
|
||||
private final String repositoryStatus;
|
||||
|
||||
private Version(
|
||||
String artifactId, String artifactVersion,
|
||||
long buildTimeMillis, long commitTimeMillis,
|
||||
String shortCommitHash, String longCommitHash, String repositoryStatus) {
|
||||
this.artifactId = artifactId;
|
||||
this.artifactVersion = artifactVersion;
|
||||
this.buildTimeMillis = buildTimeMillis;
|
||||
this.commitTimeMillis = commitTimeMillis;
|
||||
this.shortCommitHash = shortCommitHash;
|
||||
this.longCommitHash = longCommitHash;
|
||||
this.repositoryStatus = repositoryStatus;
|
||||
}
|
||||
|
||||
public String artifactId() {
|
||||
return artifactId;
|
||||
}
|
||||
|
||||
public String artifactVersion() {
|
||||
return artifactVersion;
|
||||
}
|
||||
|
||||
public long buildTimeMillis() {
|
||||
return buildTimeMillis;
|
||||
}
|
||||
|
||||
public long commitTimeMillis() {
|
||||
return commitTimeMillis;
|
||||
}
|
||||
|
||||
public String shortCommitHash() {
|
||||
return shortCommitHash;
|
||||
}
|
||||
|
||||
public String longCommitHash() {
|
||||
return longCommitHash;
|
||||
}
|
||||
|
||||
public String repositoryStatus() {
|
||||
return repositoryStatus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return artifactId + '-' + artifactVersion + '.' + shortCommitHash +
|
||||
("clean".equals(repositoryStatus)? "" : " (repository: " + repositoryStatus + ')');
|
||||
}
|
||||
}
|
@ -87,3 +87,4 @@
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
</parent>
|
||||
|
||||
<artifactId>netty-handler</artifactId>
|
||||
<packaging>bundle</packaging>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Netty/Handler</name>
|
||||
|
||||
@ -45,5 +45,5 @@
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
</project>
|
||||
|
||||
|
185
pom.xml
185
pom.xml
@ -97,7 +97,6 @@
|
||||
<module>handler</module>
|
||||
<module>example</module>
|
||||
<module>testsuite</module>
|
||||
<module>testsuite-osgi</module>
|
||||
<module>microbench</module>
|
||||
<module>all</module>
|
||||
<module>tarball</module>
|
||||
@ -400,8 +399,25 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>maven-bundle-plugin</artifactId>
|
||||
<version>2.3.7</version>
|
||||
<extensions>true</extensions>
|
||||
<version>2.4.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>generate-manifest</id>
|
||||
<phase>process-classes</phase>
|
||||
<goals>
|
||||
<goal>manifest</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<instructions>
|
||||
<Export-Package>${project.groupId}.*</Export-Package>
|
||||
<!-- enforce JVM vendor package as optional -->
|
||||
<Import-Package>sun.misc.*;resolution:=optional,*</Import-Package>
|
||||
<!-- override "internal" private package convention -->
|
||||
<Private-Package>!*</Private-Package>
|
||||
</instructions>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
@ -457,7 +473,154 @@
|
||||
<tagNameFormat>netty-@{project.version}</tagNameFormat>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
|
||||
<!-- Ensure to put maven-antrun-plugin at the end of the plugin list
|
||||
so that they are run lastly in the same phase. -->
|
||||
<plugin>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<executions>
|
||||
<!-- Generate the version properties for all artifacts. -->
|
||||
<execution>
|
||||
<id>write-version-properties</id>
|
||||
<phase>initialize</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<target>
|
||||
<taskdef resource="net/sf/antcontrib/antlib.xml" />
|
||||
|
||||
<!-- Get the information about the latest commit -->
|
||||
<exec executable="git"
|
||||
outputproperty="gitOutput.shortCommitHash"
|
||||
resultproperty="gitExitCode.shortCommitHash"
|
||||
failonerror="false" failifexecutionfails="false">
|
||||
<arg value="log" />
|
||||
<arg value="-1" />
|
||||
<arg value="--format=format:%h" />
|
||||
</exec>
|
||||
<if>
|
||||
<equals arg2="0" arg1="${gitExitCode.shortCommitHash}" />
|
||||
<then>
|
||||
<property name="shortCommitHash" value="${gitOutput.shortCommitHash}" />
|
||||
</then>
|
||||
<else>
|
||||
<property name="shortCommitHash" value="0" />
|
||||
</else>
|
||||
</if>
|
||||
|
||||
<exec executable="git"
|
||||
outputproperty="gitOutput.longCommitHash"
|
||||
resultproperty="gitExitCode.longCommitHash"
|
||||
failonerror="false" failifexecutionfails="false">
|
||||
<arg value="log" />
|
||||
<arg value="-1" />
|
||||
<arg value="--format=format:%H" />
|
||||
</exec>
|
||||
<if>
|
||||
<equals arg2="0" arg1="${gitExitCode.longCommitHash}" />
|
||||
<then>
|
||||
<property name="longCommitHash" value="${gitOutput.longCommitHash}" />
|
||||
</then>
|
||||
<else>
|
||||
<property name="longCommitHash" value="0000000000000000000000000000000000000000" />
|
||||
</else>
|
||||
</if>
|
||||
|
||||
<exec executable="git"
|
||||
outputproperty="gitOutput.commitDate"
|
||||
resultproperty="gitExitCode.commitDate"
|
||||
failonerror="false" failifexecutionfails="false">
|
||||
<arg value="log" />
|
||||
<arg value="-1" />
|
||||
<arg value="--format=format:%cd" />
|
||||
<arg value="--date=iso" />
|
||||
</exec>
|
||||
<if>
|
||||
<equals arg2="0" arg1="${gitExitCode.commitDate}" />
|
||||
<then>
|
||||
<property name="commitDate" value="${gitOutput.commitDate}" />
|
||||
</then>
|
||||
<else>
|
||||
<property name="commitDate" value="1970-01-01 00:00:00 +0000" />
|
||||
</else>
|
||||
</if>
|
||||
|
||||
<exec executable="git"
|
||||
outputproperty="gitOutput.repoStatus"
|
||||
resultproperty="gitExitCode.repoStatus"
|
||||
failonerror="false" failifexecutionfails="false">
|
||||
<arg value="status" />
|
||||
<arg value="--porcelain" />
|
||||
</exec>
|
||||
<if>
|
||||
<equals arg2="0" arg1="${gitExitCode.repoStatus}" />
|
||||
<then>
|
||||
<if>
|
||||
<equals arg2="" arg1="${gitOutput.repoStatus}" />
|
||||
<then>
|
||||
<property name="repoStatus" value="clean" />
|
||||
</then>
|
||||
<else>
|
||||
<property name="repoStatus" value="dirty" />
|
||||
</else>
|
||||
</if>
|
||||
</then>
|
||||
<else>
|
||||
<property name="repoStatus" value="unknown" />
|
||||
</else>
|
||||
</if>
|
||||
|
||||
<!-- Print the obtained commit information. -->
|
||||
<echo>Current commit: ${shortCommitHash} on ${commitDate}</echo>
|
||||
|
||||
<!-- Generate the .properties file. -->
|
||||
<!--
|
||||
<property name="metaInfDir" value="${project.basedir}/src/main/resources/META-INF"/>
|
||||
-->
|
||||
<property name="metaInfDir" value="${project.build.outputDirectory}/META-INF"/>
|
||||
<property name="versionPropFile" value="${metaInfDir}/${project.groupId}.versions.properties" />
|
||||
<mkdir dir="${metaInfDir}" />
|
||||
<delete file="${versionPropFile}" quiet="true"/>
|
||||
|
||||
<propertyfile
|
||||
file="${versionPropFile}"
|
||||
comment="Generated by netty-parent/pom.xml">
|
||||
<entry key="${project.artifactId}.version" value="${project.version}"/>
|
||||
<entry key="${project.artifactId}.buildDate" type="date" value="now" pattern="yyyy-MM-dd HH:mm:ss Z"/>
|
||||
<entry key="${project.artifactId}.commitDate" value="${commitDate}"/>
|
||||
<entry key="${project.artifactId}.shortCommitHash" value="${shortCommitHash}"/>
|
||||
<entry key="${project.artifactId}.longCommitHash" value="${longCommitHash}"/>
|
||||
<entry key="${project.artifactId}.repoStatus" value="${repoStatus}"/>
|
||||
</propertyfile>
|
||||
</target>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.ant</groupId>
|
||||
<artifactId>ant</artifactId>
|
||||
<version>1.8.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.ant</groupId>
|
||||
<artifactId>ant-launcher</artifactId>
|
||||
<version>1.8.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ant-contrib</groupId>
|
||||
<artifactId>ant-contrib</artifactId>
|
||||
<version>1.0b3</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>ant</groupId>
|
||||
<artifactId>ant</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
<pluginManagement>
|
||||
@ -483,6 +646,20 @@
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>default-jar</id>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifest>
|
||||
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
|
||||
</manifest>
|
||||
<index>true</index>
|
||||
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
|
||||
</archive>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
|
3
testsuite-osgi/.gitignore
vendored
3
testsuite-osgi/.gitignore
vendored
@ -1,3 +0,0 @@
|
||||
|
||||
target/
|
||||
reports/
|
@ -1,2 +0,0 @@
|
||||
|
||||
parent for build constrains modules
|
@ -1,61 +0,0 @@
|
||||
<?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.13.Final-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>netty-testsuite-osgi-parent</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>Netty/Testsuite/OSGi</name>
|
||||
<description>parent for build constrains modules</description>
|
||||
|
||||
<!-- This test is guaranteed to fail during the release phase; skip'em all -->
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>no-osgi</id>
|
||||
<properties>
|
||||
<skipITs>true</skipITs>
|
||||
<skipTests>true</skipTests>
|
||||
</properties>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<modules>
|
||||
<module>testsuite-osgi-split</module>
|
||||
<module>testsuite-osgi-deps</module>
|
||||
<module>testsuite-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>
|
@ -1,67 +0,0 @@
|
||||
### 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)
|
||||
```
|
@ -1,180 +0,0 @@
|
||||
<?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-testsuite-osgi-parent</artifactId>
|
||||
<version>4.0.13.Final-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>netty-testsuite-osgi-deps</artifactId>
|
||||
<packaging>bundle</packaging>
|
||||
|
||||
<name>Netty/Testsuite/OSGi/Deps</name>
|
||||
<description>verify osgi compliance: all transitive dependencies must be osgi bundles</description>
|
||||
|
||||
<dependencies>
|
||||
<!-- MAIN -->
|
||||
<!-- 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>
|
||||
<!--
|
||||
* DO NOT install netty-transport-rxtx bundle due to rxtx depencency:
|
||||
*
|
||||
* 1) rxtx does not have automatic native library loader
|
||||
* 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 utilities. -->
|
||||
<dependency>
|
||||
<groupId>commons-io</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.RC1</version>
|
||||
<extensions>true</extensions>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>features-generate-descriptor</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!-- Invoke integration tests. -->
|
||||
<plugin>
|
||||
<artifactId>maven-failsafe-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>test</phase>
|
||||
<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>
|
||||
|
@ -1,26 +0,0 @@
|
||||
/*
|
||||
* 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 {
|
||||
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
/*
|
||||
* 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;
|
||||
|
@ -1,69 +0,0 @@
|
||||
/*
|
||||
* 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 io.netty.util.internal.StringUtil;
|
||||
import io.netty.util.internal.logging.InternalLogger;
|
||||
import io.netty.util.internal.logging.InternalLoggerFactory;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Dependency Integration Tests.
|
||||
*/
|
||||
public class DependencyIT {
|
||||
|
||||
private static final InternalLogger logger = InternalLoggerFactory.getInstance(DependencyIT.class);
|
||||
|
||||
/**
|
||||
* 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";
|
||||
private static final Pattern WRAPPED_MODULE_PATTERN = Pattern.compile("wrap:mvn:io\\.netty/");
|
||||
|
||||
@Test
|
||||
public void verifyKarafFeatureHasNoWrapProtocol() throws Exception {
|
||||
String text = FileUtils.readFileToString(new File(FEATURE));
|
||||
|
||||
// Ignore wrap:mvn:io.netty - it occurs when Maven didn't give the Netty modules to karaf-maven-plugin
|
||||
// as class directories.
|
||||
Matcher matcher = WRAPPED_MODULE_PATTERN.matcher(text);
|
||||
if (matcher.find()) {
|
||||
text = matcher.replaceAll("mvn:io.netty/");
|
||||
logger.info("Ignored wrap:mvn:io.netty");
|
||||
}
|
||||
|
||||
if (text.contains("wrap:")) {
|
||||
fail(
|
||||
"feature.xml generated by karaf-maven-plugin contains 'wrap:' protocol; " +
|
||||
"some transitive dependencies are not OSGi bundles: " + StringUtil.NEWLINE +
|
||||
text
|
||||
);
|
||||
} else {
|
||||
logger.info("All transitive dependencies are OSGi bundles.");
|
||||
}
|
||||
}
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
|
||||
lib/
|
@ -1,10 +0,0 @@
|
||||
### 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))
|
||||
```
|
@ -1,320 +0,0 @@
|
||||
<?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-testsuite-osgi-parent</artifactId>
|
||||
<version>4.0.13.Final-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>netty-testsuite-osgi-exam</artifactId>
|
||||
<packaging>bundle</packaging>
|
||||
|
||||
<name>Netty/Testsuite/OSGi/Exam</name>
|
||||
<description>verify osgi compliance: run tests inside osgi framework</description>
|
||||
|
||||
<properties>
|
||||
<pax.exam.version>3.0.3</pax.exam.version>
|
||||
<pax.url.version>1.5.2</pax.url.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!-- MAIN -->
|
||||
<!-- 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>
|
||||
|
||||
<!-- Logging via http://team.ops4j.org/wiki/display/paxlogging/Pax+Logging -->
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- OSGI Declarative Services 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>
|
||||
|
||||
<!-- OSGI specification. -->
|
||||
<dependency>
|
||||
<groupId>org.osgi</groupId>
|
||||
<artifactId>org.osgi.core</artifactId>
|
||||
<version>4.3.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.osgi</groupId>
|
||||
<artifactId>org.osgi.compendium</artifactId>
|
||||
<version>4.3.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- TEST -->
|
||||
|
||||
<!-- Transport UDT tests and dependencies. -->
|
||||
<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>
|
||||
|
||||
<!-- Pax Exam test environment. -->
|
||||
<dependency>
|
||||
<groupId>org.ops4j.pax.exam</groupId>
|
||||
<artifactId>pax-exam-container-native</artifactId>
|
||||
<version>${pax.exam.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.ops4j.pax.exam</groupId>
|
||||
<artifactId>pax-exam-junit4</artifactId>
|
||||
<version>${pax.exam.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.ops4j.pax.exam</groupId>
|
||||
<artifactId>pax-exam-invoker-junit</artifactId>
|
||||
<version>${pax.exam.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.ops4j.pax.exam</groupId>
|
||||
<artifactId>pax-exam-inject</artifactId>
|
||||
<version>${pax.exam.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.ops4j.pax.exam</groupId>
|
||||
<artifactId>pax-exam-extender-service</artifactId>
|
||||
<version>${pax.exam.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.ops4j.pax.exam</groupId>
|
||||
<artifactId>pax-exam-link-mvn</artifactId>
|
||||
<version>${pax.exam.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.ops4j.pax.url</groupId>
|
||||
<artifactId>pax-url-aether</artifactId>
|
||||
<version>${pax.url.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.ops4j.pax.url</groupId>
|
||||
<artifactId>pax-url-wrap</artifactId>
|
||||
<version>${pax.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 Declarative Services component descriptors. -->
|
||||
<plugin>
|
||||
<groupId>com.carrotgarden.maven</groupId>
|
||||
<artifactId>carrot-maven-scr-plugin</artifactId>
|
||||
<version>3.0.3</version>
|
||||
<configuration>
|
||||
<targetDirectorySCR>OSGI-INF/service-component</targetDirectorySCR>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>generate-test-sources</phase>
|
||||
<goals>
|
||||
<goal>generate</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!-- Include OSGI Declarative Services component descriptors in the bundle. -->
|
||||
<plugin>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>maven-bundle-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>generate-test-sources</phase>
|
||||
<goals>
|
||||
<goal>manifest</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<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>
|
||||
<phase>test</phase>
|
||||
<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>
|
||||
<pluginExecution>
|
||||
<pluginExecutionFilter>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>maven-bundle-plugin</artifactId>
|
||||
<versionRange>[0,)</versionRange>
|
||||
<goals>
|
||||
<goal>manifest</goal>
|
||||
</goals>
|
||||
</pluginExecutionFilter>
|
||||
<action>
|
||||
<execute />
|
||||
</action>
|
||||
</pluginExecution>
|
||||
</pluginExecutions>
|
||||
</lifecycleMappingMetadata>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
</project>
|
@ -1,26 +0,0 @@
|
||||
/*
|
||||
* 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();
|
||||
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
/*
|
||||
* 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");
|
||||
}
|
||||
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
/*
|
||||
* 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;
|
||||
|
@ -1 +0,0 @@
|
||||
mvn:org.ops4j.pax.logging/pax-logging-api/1.7.0
|
@ -1,6 +0,0 @@
|
||||
### info
|
||||
|
||||
override select links from
|
||||
|
||||
http://search.maven.org/#search%7Cga%7C1%7Cpax-exam-link-mvn
|
||||
|
@ -1,56 +0,0 @@
|
||||
/*
|
||||
* 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());
|
||||
}
|
||||
|
||||
}
|
@ -1,70 +0,0 @@
|
||||
/*
|
||||
* 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();
|
||||
}
|
||||
|
||||
}
|
@ -1,142 +0,0 @@
|
||||
/*
|
||||
* 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 final 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 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
<?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>
|
@ -1,17 +0,0 @@
|
||||
### 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
|
||||
```
|
@ -1,116 +0,0 @@
|
||||
<?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-testsuite-osgi-parent</artifactId>
|
||||
<version>4.0.13.Final-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>netty-testsuite-osgi-split</artifactId>
|
||||
<packaging>bundle</packaging>
|
||||
|
||||
<name>Netty/Testsuite/OSGi/Split</name>
|
||||
<description>verify osgi compliance: prohibit split packages</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- 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>
|
||||
|
||||
</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>
|
||||
|
@ -1,26 +0,0 @@
|
||||
/*
|
||||
* 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 {
|
||||
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
/*
|
||||
* 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;
|
||||
|
@ -1,23 +0,0 @@
|
||||
/*
|
||||
* 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 {
|
||||
|
||||
}
|
@ -25,7 +25,7 @@
|
||||
</parent>
|
||||
|
||||
<artifactId>netty-transport-rxtx</artifactId>
|
||||
<packaging>bundle</packaging>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Netty/Transport/RXTX</name>
|
||||
|
||||
@ -46,5 +46,5 @@
|
||||
<artifactId>rxtx</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
</parent>
|
||||
|
||||
<artifactId>netty-transport-sctp</artifactId>
|
||||
<packaging>bundle</packaging>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Netty/Transport/SCTP</name>
|
||||
|
||||
@ -48,7 +48,6 @@
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
@ -59,10 +58,7 @@
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
</parent>
|
||||
|
||||
<artifactId>netty-transport-udt</artifactId>
|
||||
<packaging>bundle</packaging>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Netty/Transport/UDT</name>
|
||||
|
||||
@ -85,7 +85,6 @@
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
|
||||
<!-- attach and deploy tests artifact -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
@ -98,7 +97,7 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
</parent>
|
||||
|
||||
<artifactId>netty-transport</artifactId>
|
||||
<packaging>bundle</packaging>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Netty/Transport</name>
|
||||
|
||||
@ -35,6 +35,5 @@
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user