Removed OSGi support, too buggy
This commit is contained in:
@@ -1,9 +1,6 @@
|
|||||||
|
|
||||||
description = 'Moquette - broker'
|
description = 'Moquette - broker'
|
||||||
|
|
||||||
apply plugin: 'osgi'
|
|
||||||
apply plugin: 'maven'
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile group: 'io.netty', name: 'netty-common', version: nettyVersion
|
compile group: 'io.netty', name: 'netty-common', version: nettyVersion
|
||||||
compile group: 'io.netty', name: 'netty-buffer', version: nettyVersion
|
compile group: 'io.netty', name: 'netty-buffer', version: nettyVersion
|
||||||
@@ -33,19 +30,3 @@ dependencies {
|
|||||||
|
|
||||||
testCompile group: 'com.h2database', name: 'h2', version:'1.4.191'
|
testCompile group: 'com.h2database', name: 'h2', version:'1.4.191'
|
||||||
}
|
}
|
||||||
|
|
||||||
task createPom () {
|
|
||||||
pom { }.writeTo("build/pom.xml")
|
|
||||||
}
|
|
||||||
|
|
||||||
jar {
|
|
||||||
manifest {
|
|
||||||
instruction 'Bundle-Description', 'Moquette lightweight MQTT Broker'
|
|
||||||
instruction 'Bundle-License', 'http://www.apache.org/licenses/LICENSE-2.0.txt, http://www.eclipse.org/org/documents/epl-v10.php'
|
|
||||||
instruction 'Import-Package', '!com.codahale.metrics*, !com.bugsnag*, !com.librato.metrics*, *'
|
|
||||||
}
|
|
||||||
into ("META-INF/maven/io.moquette/${project.name}"){
|
|
||||||
from "build/pom.xml"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
jar.dependsOn createPom
|
|
||||||
|
|||||||
@@ -1,23 +1,9 @@
|
|||||||
|
|
||||||
description = 'Moquette - H2 storage'
|
description = 'Moquette - H2 storage'
|
||||||
|
|
||||||
apply plugin: 'osgi'
|
|
||||||
apply plugin: 'maven'
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(':moquette-broker')
|
compile project(':moquette-broker')
|
||||||
compile group: 'com.h2database', name: 'h2-mvstore', version: '1.4.192'
|
compile group: 'com.h2database', name: 'h2-mvstore', version: '1.4.192'
|
||||||
|
|
||||||
testCompile project(path:':moquette-broker', configuration: 'archives')
|
testCompile project(path:':moquette-broker', configuration: 'archives')
|
||||||
}
|
}
|
||||||
|
|
||||||
task createPom () {
|
|
||||||
pom { }.writeTo("build/pom.xml")
|
|
||||||
}
|
|
||||||
|
|
||||||
jar {
|
|
||||||
into ("META-INF/maven/io.moquette/${project.name}"){
|
|
||||||
from "build/pom.xml"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
jar.dependsOn createPom
|
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
|
|
||||||
description = 'Moquette - MapDB storage'
|
description = 'Moquette - MapDB storage'
|
||||||
|
|
||||||
apply plugin: 'osgi'
|
|
||||||
apply plugin: 'maven'
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(':moquette-broker')
|
compile project(':moquette-broker')
|
||||||
@@ -10,14 +8,3 @@ dependencies {
|
|||||||
|
|
||||||
testCompile project(path:':moquette-broker', configuration: 'archives')
|
testCompile project(path:':moquette-broker', configuration: 'archives')
|
||||||
}
|
}
|
||||||
|
|
||||||
task createPom () {
|
|
||||||
pom { }.writeTo("build/pom.xml")
|
|
||||||
}
|
|
||||||
|
|
||||||
jar {
|
|
||||||
into ("META-INF/maven/io.moquette/${project.name}"){
|
|
||||||
from "build/pom.xml"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
jar.dependsOn createPom
|
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
# Development
|
|
||||||
|
|
||||||
to run the osgi tests use:
|
|
||||||
|
|
||||||
./gradlew install moquette-osgi-test:test --rerun-tasks
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
|
|
||||||
description = 'Moquette - OSGi test'
|
|
||||||
|
|
||||||
ext {
|
|
||||||
paxExamVersion = '4.6.0'
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
compile project(':moquette-broker')
|
|
||||||
compile project(':moquette-h2-storage')
|
|
||||||
compile project(':moquette-mapdb-storage')
|
|
||||||
|
|
||||||
testCompile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.5'
|
|
||||||
testCompile group: 'org.slf4j', name: 'slf4j-log4j12', version: '1.7.5'
|
|
||||||
|
|
||||||
testCompile group: 'org.ops4j.pax.exam', name: 'pax-exam-container-native', version: paxExamVersion
|
|
||||||
testCompile group: 'org.ops4j.pax.exam', name: 'pax-exam-junit4', version: paxExamVersion
|
|
||||||
testCompile group: 'org.ops4j.pax.exam', name: 'pax-exam-link-mvn', version: paxExamVersion
|
|
||||||
testCompile group: 'org.ops4j.pax.url', name: 'pax-url-aether', version:'1.4.0'
|
|
||||||
testCompile group: 'org.apache.felix', name: 'org.apache.felix.framework', version:'5.0.0'
|
|
||||||
testCompile group: 'javax.inject', name: 'javax.inject', version:'1'
|
|
||||||
}
|
|
||||||
@@ -1,108 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2016-2017 The original author or authors
|
|
||||||
* ------------------------------------------------------
|
|
||||||
* All rights reserved. This program and the accompanying materials
|
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
* and Apache License v2.0 which accompanies this distribution.
|
|
||||||
*
|
|
||||||
* The Eclipse Public License is available at
|
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
*
|
|
||||||
* The Apache License v2.0 is available at
|
|
||||||
* http://www.opensource.org/licenses/apache2.0.php
|
|
||||||
*
|
|
||||||
* You may elect to redistribute this code under either of these licenses.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package io.moquette.test.osgi;
|
|
||||||
|
|
||||||
import static org.junit.Assert.fail;
|
|
||||||
import static org.ops4j.pax.exam.CoreOptions.*;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
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.osgi.framework.Bundle;
|
|
||||||
import org.osgi.framework.BundleContext;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Run a set of unit tests inside of an OSGi container to make sure
|
|
||||||
* Moquette works in the OSGi container,
|
|
||||||
*/
|
|
||||||
@RunWith(PaxExam.class)
|
|
||||||
public class MoquetteOsgiTest {
|
|
||||||
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(MoquetteOsgiTest.class);
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private BundleContext bundleContext;
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
public Option[] config() throws IOException {
|
|
||||||
String nettyV = "4.1.12.Final";
|
|
||||||
|
|
||||||
return options(
|
|
||||||
junitBundles(),
|
|
||||||
|
|
||||||
mavenBundle("com.hazelcast", "hazelcast"),
|
|
||||||
|
|
||||||
mavenBundle("io.netty", "netty-common", nettyV),
|
|
||||||
mavenBundle("io.netty", "netty-buffer", nettyV),
|
|
||||||
mavenBundle("io.netty", "netty-transport", nettyV),
|
|
||||||
mavenBundle("io.netty", "netty-resolver", nettyV),
|
|
||||||
mavenBundle("io.netty", "netty-handler", nettyV),
|
|
||||||
mavenBundle("io.netty", "netty-codec", nettyV),
|
|
||||||
mavenBundle("io.netty", "netty-codec-http", nettyV),
|
|
||||||
mavenBundle("io.netty", "netty-codec-mqtt", nettyV),
|
|
||||||
mavenBundle("io.netty", "netty-transport-native-epoll", nettyV),
|
|
||||||
mavenBundle("io.netty", "netty-transport-native-unix-common", nettyV),
|
|
||||||
|
|
||||||
mavenBundle("commons-codec", "commons-codec"),
|
|
||||||
|
|
||||||
mavenBundle("io.moquette", "moquette-broker"),
|
|
||||||
|
|
||||||
mavenBundle("com.h2database", "h2-mvstore"),
|
|
||||||
mavenBundle("io.moquette", "moquette-h2-storage"),
|
|
||||||
|
|
||||||
mavenBundle("org.mapdb", "mapdb", "1.0.8"),
|
|
||||||
mavenBundle("io.moquette", "moquette-mapdb-storage")
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Look for a bundle with moquette in the name.
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* If the OSGi headers are not in the moquette jar, this will fail.
|
|
||||||
*/
|
|
||||||
@Test
|
|
||||||
public void testCanFindOsgiBundle() throws Exception {
|
|
||||||
List<String> list = new LinkedList<>(Arrays.asList("io.moquette.broker", "io.moquette.h2-storage",
|
|
||||||
"io.moquette.mapdb-storage"));
|
|
||||||
|
|
||||||
List<String> inactive = new LinkedList<>();
|
|
||||||
|
|
||||||
for (Bundle b : bundleContext.getBundles()) {
|
|
||||||
String symbolicName = b.getSymbolicName();
|
|
||||||
LOG.info("{} {}", symbolicName, b.getState());
|
|
||||||
System.out.println("" + symbolicName);
|
|
||||||
if (symbolicName != null) {
|
|
||||||
list.remove(symbolicName);
|
|
||||||
if (b.getState() != Bundle.ACTIVE)
|
|
||||||
inactive.add(symbolicName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!inactive.isEmpty() || !list.isEmpty())
|
|
||||||
fail("This osgi bundles are missing: " + list + " this osgi packages are NOT active" + inactive);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
# Set root logger level to DEBUG and its only appender to A1.
|
|
||||||
log4j.rootLogger=ERROR, stdout
|
|
||||||
|
|
||||||
log4j.logger.io.moquette=DEBUG
|
|
||||||
|
|
||||||
# stdout appender is set to be a ConsoleAppender.
|
|
||||||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
|
||||||
log4j.appender.stdout.Threshold=DEBUG
|
|
||||||
# for debug trace
|
|
||||||
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
|
||||||
#log4j.appender.stdout.layout.ConversionPattern=%-4r [%t] %-5p %c{1} %x - %m%n
|
|
||||||
log4j.appender.stdout.layout.ConversionPattern=%d{dd/MM/yyyy HH:mm:ss,SSS} [%t] %-5p %c{1} %M %L %x - %m%n
|
|
||||||
Reference in New Issue
Block a user