Skip to content

Commit

Permalink
Merge pull request #27 from eclipse/bug/start-server
Browse files Browse the repository at this point in the history
Fixed component to launch Server
  • Loading branch information
ruspl-afed authored Nov 4, 2019
2 parents 7734d2a + a250dec commit 516de73
Show file tree
Hide file tree
Showing 14 changed files with 185 additions and 90 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="activate" deactivate="deactivate" name="org.eclipse.passage.lbc.internal.equinox.ServerRunnerImpl">
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="activate" deactivate="deactivate" immediate="true" name="org.eclipse.passage.lbc.internal.equinox.ServerRunnerImpl">
<service>
<provide interface="org.eclipse.passage.lbc.api.BackendCluster"/>
</service>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import org.osgi.service.log.Logger;
import org.osgi.service.log.LoggerFactory;

@Component
@Component(immediate = true)
public class ServerRunnerImpl implements BackendCluster {

private List<BackendLauncher> backendLaunchers = new ArrayList<>();
Expand Down
17 changes: 17 additions & 0 deletions features/org.eclipse.passage.lbc.execute.feature/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.eclipse.passage.lbc.execute.feature</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.pde.FeatureBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.FeatureNature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# Contributors:
# ArSysOp - initial API and implementation
###############################################################################
featureName=Passage LBC
featureName=Passage LBC Server
providerName=Eclipse Passage
description=Passage Licensing Back-end Components: OSGi-based server to manage licensing data.
copyright=Copyright (c) 2018-2019 ArSysOp and others.\n\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
ArSysOp - initial API and implementation
-->
<feature
id="org.eclipse.passage.lbc.feature"
id="org.eclipse.passage.lbc.execute.feature"
label="%featureName"
version="0.6.0.qualifier"
provider-name="%providerName"
Expand All @@ -31,6 +31,10 @@
%license
</license>

<requires>
<import feature="org.eclipse.passage.lbc.target.feature"/>
</requires>

<plugin
id="org.eclipse.passage.lbc.api"
download-size="0"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.eclipse.passage.lbc.feature</name>
<name>org.eclipse.passage.lbc.target.feature</name>
<comment></comment>
<projects>
</projects>
Expand Down
14 changes: 14 additions & 0 deletions features/org.eclipse.passage.lbc.target.feature/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
###############################################################################
# Copyright (c) 019 ArSysOp and others
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0.
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# ArSysOp - initial API and implementation
###############################################################################
bin.includes = feature.xml,\
feature.properties
23 changes: 23 additions & 0 deletions features/org.eclipse.passage.lbc.target.feature/feature.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
###############################################################################
# Copyright (c) 2019 ArSysOp and others
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0.
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# ArSysOp - initial API and implementation
###############################################################################
featureName=Passage LBC Target
providerName=Eclipse Passage
description=Passage Licensing Back-end Components: required target dependencies.
copyright=Copyright (c) 2019 ArSysOp and others.\n\
\n\
This program and the accompanying materials are made\n\
available under the terms of the Eclipse Public License 2.0\n\
which is available at https://www.eclipse.org/legal/epl-2.0/\n\
\n\
SPDX-License-Identifier: EPL-2.0\n\
76 changes: 76 additions & 0 deletions features/org.eclipse.passage.lbc.target.feature/feature.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2019 ArSysOp and others
This program and the accompanying materials are made available under the
terms of the Eclipse Public License 2.0 which is available at
http://www.eclipse.org/legal/epl-2.0.
SPDX-License-Identifier: EPL-2.0
Contributors:
ArSysOp - initial API and implementation
-->
<feature
id="org.eclipse.passage.lbc.target.feature"
label="%featureName"
version="0.6.0.qualifier"
provider-name="%providerName"
license-feature="org.eclipse.license"
license-feature-version="0.0.0">

<description>
%description
</description>

<copyright>
%copyright
</copyright>

<license url="%licenseURL">
%license
</license>

<plugin
id="javax.inject"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>

<plugin
id="org.tukaani.xz"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>

<plugin
id="org.eclipse.equinox.concurrent"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>

<plugin
id="org.eclipse.equinox.event"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>

<plugin
id="org.eclipse.core.runtime"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>

<plugin
id="org.eclipse.core.contenttype"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>

</feature>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?pde version="3.5"?>

<product name="Passage Licensing Data Server" uid="org.eclipse.passage.lbc.server.product" id="org.eclipse.passage.lbc.server.product" application="org.eclipse.passage.lbc.server.application" version="0.6.0.qualifier" useFeatures="false" includeLaunchers="true">
<product name="Passage Licensing Data Server" uid="org.eclipse.passage.lbc.server.product" id="org.eclipse.passage.lbc.server.product" application="org.eclipse.passage.lbc.server.application" version="0.6.0.qualifier" useFeatures="true" includeLaunchers="true">

<configIni use="default">
</configIni>
Expand All @@ -26,96 +26,31 @@
<vm>
</vm>

<plugins>
<plugin id="com.fasterxml.jackson.core.jackson-annotations"/>
<plugin id="com.fasterxml.jackson.core.jackson-core"/>
<plugin id="com.fasterxml.jackson.core.jackson-databind"/>
<plugin id="javax.inject"/>
<plugin id="javax.servlet"/>
<plugin id="org.apache.commons.codec"/>
<plugin id="org.apache.commons.logging"/>
<plugin id="org.apache.felix.gogo.runtime"/>
<plugin id="org.apache.felix.gogo.shell"/>
<plugin id="org.apache.felix.scr"/>
<plugin id="org.apache.httpcomponents.httpclient"/>
<plugin id="org.apache.httpcomponents.httpcore"/>
<plugin id="org.eclipse.core.contenttype"/>
<plugin id="org.eclipse.core.jobs"/>
<plugin id="org.eclipse.core.runtime"/>
<plugin id="org.eclipse.ecf"/>
<plugin id="org.eclipse.ecf.identity"/>
<plugin id="org.eclipse.ecf.ssl" fragment="true"/>
<plugin id="org.eclipse.equinox.app"/>
<plugin id="org.eclipse.equinox.common"/>
<plugin id="org.eclipse.equinox.concurrent"/>
<plugin id="org.eclipse.equinox.console"/>
<plugin id="org.eclipse.equinox.ds"/>
<plugin id="org.eclipse.equinox.event"/>
<plugin id="org.eclipse.equinox.frameworkadmin"/>
<plugin id="org.eclipse.equinox.frameworkadmin.equinox"/>
<plugin id="org.eclipse.equinox.http.jetty"/>
<plugin id="org.eclipse.equinox.http.servlet"/>
<plugin id="org.eclipse.equinox.p2.core"/>
<plugin id="org.eclipse.equinox.p2.director"/>
<plugin id="org.eclipse.equinox.p2.engine"/>
<plugin id="org.eclipse.equinox.p2.metadata"/>
<plugin id="org.eclipse.equinox.p2.metadata.repository"/>
<plugin id="org.eclipse.equinox.p2.repository"/>
<plugin id="org.eclipse.equinox.preferences"/>
<plugin id="org.eclipse.equinox.region" fragment="true"/>
<plugin id="org.eclipse.equinox.registry"/>
<plugin id="org.eclipse.equinox.security"/>
<plugin id="org.eclipse.equinox.security.macosx" fragment="true"/>
<plugin id="org.eclipse.equinox.simpleconfigurator"/>
<plugin id="org.eclipse.equinox.simpleconfigurator.manipulator"/>
<plugin id="org.eclipse.equinox.supplement"/>
<plugin id="org.eclipse.equinox.transforms.hook" fragment="true"/>
<plugin id="org.eclipse.equinox.useradmin.source"/>
<plugin id="org.eclipse.equinox.weaving.hook" fragment="true"/>
<plugin id="org.eclipse.jetty.http"/>
<plugin id="org.eclipse.jetty.io"/>
<plugin id="org.eclipse.jetty.security"/>
<plugin id="org.eclipse.jetty.server"/>
<plugin id="org.eclipse.jetty.servlet"/>
<plugin id="org.eclipse.jetty.util"/>
<plugin id="org.eclipse.osgi"/>
<plugin id="org.eclipse.osgi.compatibility.state" fragment="true"/>
<plugin id="org.eclipse.osgi.services"/>
<plugin id="org.eclipse.osgi.util"/>
<plugin id="org.eclipse.passage.lic.api"/>
<plugin id="org.eclipse.passage.lic.base"/>
<plugin id="org.eclipse.passage.lic.equinox"/>
<plugin id="org.eclipse.passage.lic.net"/>
<plugin id="org.eclipse.passage.lbc.api"/>
<plugin id="org.eclipse.passage.lbc.base"/>
<plugin id="org.eclipse.passage.lbc.equinox"/>
<plugin id="org.eclipse.passage.lbc.jetty"/>
<plugin id="org.eclipse.passage.lbc.server"/>
<plugin id="org.sat4j.core"/>
<plugin id="org.sat4j.pb"/>
<plugin id="org.tukaani.xz"/>
</plugins>

<features>
<feature id="org.eclipse.passage.lbc.feature"/>
<feature id="org.eclipse.equinox.server.core"/>
<feature id="org.eclipse.equinox.server.jetty"/>
<feature id="org.eclipse.equinox.server.p2"/>
<feature id="org.eclipse.ecf.filetransfer.httpclient4.feature"/>
<feature id="org.eclipse.equinox.core.feature"/>
<feature id="org.eclipse.equinox.executable"/>
<feature id="org.eclipse.ecf.core.ssl.feature"/>
<feature id="org.eclipse.ecf.filetransfer.httpclient4.ssl.feature"/>
<feature id="org.eclipse.ecf.filetransfer.ssl.feature"/>
<feature id="org.eclipse.ecf.core.feature"/>
<feature id="org.eclipse.ecf.filetransfer.feature"/>
</features>
<feature id="org.eclipse.ecf.filetransfer.httpclient45.feature" installMode="root"/>
<feature id="org.eclipse.passage.lic.net.feature" installMode="root"/>
<feature id="org.eclipse.passage.lic.equinox.feature" installMode="root"/>
<feature id="org.eclipse.passage.lic.oshi.feature" installMode="root"/>
<feature id="org.eclipse.passage.lbc.target.feature"/>
<feature id="org.eclipse.passage.lbc.execute.feature"/>
</features>

<configurations>
<plugin id="org.eclipse.osgi" autoStart="true" startLevel="-1" />
<plugin id="org.eclipse.equinox.simpleconfigurator" autoStart="true" startLevel="1" />
<plugin id="org.apache.felix.scr" autoStart="true" startLevel="2" />
<plugin id="org.eclipse.core.runtime" autoStart="true" startLevel="4" />
<plugin id="org.eclipse.equinox.common" autoStart="true" startLevel="2" />
<plugin id="org.eclipse.equinox.event" autoStart="true" startLevel="2" />
<plugin id="org.eclipse.core.runtime" autoStart="true" startLevel="4" />
<plugin id="org.eclipse.equinox.simpleconfigurator" autoStart="true" startLevel="1" />
<plugin id="org.eclipse.osgi" autoStart="true" startLevel="-1" />
<plugin id="org.eclipse.passage.lic.equinox" autoStart="true" startLevel="4" />
</configurations>

Expand Down
4 changes: 3 additions & 1 deletion releng/org.eclipse.passage.lbc.aggregator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@
<relativePath>../../releng/org.eclipse.passage.parent</relativePath>
</parent>
<modules>
<module>../../features/org.eclipse.passage.lbc.target.feature</module>

<module>../../bundles/org.eclipse.passage.lbc.api</module>
<module>../../bundles/org.eclipse.passage.lbc.base</module>
<module>../../bundles/org.eclipse.passage.lbc.equinox</module>
<module>../../bundles/org.eclipse.passage.lbc.jetty</module>
<module>../../bundles/org.eclipse.passage.lbc.server</module>
<module>../../features/org.eclipse.passage.lbc.feature</module>
<module>../../features/org.eclipse.passage.lbc.execute.feature</module>

<module>../../tests/org.eclipse.passage.lbc.server.test</module>

Expand Down
8 changes: 6 additions & 2 deletions releng/org.eclipse.passage.lbc.repository/category.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@
</description>
</category-def>
<feature
id="org.eclipse.passage.lbc.feature">
id="org.eclipse.passage.lbc.target.feature">
<category name="org.eclipse.passage.lbc.category" />
</feature>
<feature
id="org.eclipse.passage.lbc.execute.feature">
<category name="org.eclipse.passage.lbc.category" />
</feature>
<category-def
Expand All @@ -32,7 +36,7 @@
</description>
</category-def>
<feature
id="org.eclipse.passage.lbc.feature.source">
id="org.eclipse.passage.lbc.execute.feature.source">
<category name="org.eclipse.passage.lbc.category.source" />
</feature>
</site>
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@
import static org.junit.Assert.assertTrue;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import org.eclipse.passage.lbc.api.BackendCluster;
import org.eclipse.passage.lbc.api.BackendLauncher;
import org.eclipse.passage.lic.api.LicensingResult;
import org.junit.Before;
import org.junit.Test;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
Expand All @@ -31,21 +34,38 @@
public class ServerBackendLauncherTests {

private static final int DEFAULT_CAPACITY = 2;
private BundleContext context;

@Test
public void checkServerRegistredComponents() {
@Before
public void getContext() {
Bundle bundle = FrameworkUtil.getBundle(ServerBackendLauncherTests.class);
BundleContext context = bundle.getBundleContext();
context = bundle.getBundleContext();
}

@Test
public void serverBackendLauncherTest() {
assertNotNull(context);
ServiceReference<BackendCluster> serviceReference = context.getServiceReference(BackendCluster.class);
assertNotNull(serviceReference);
BackendCluster service = context.getService(serviceReference);
assertNotNull(service);
Iterable<BackendLauncher> backendLaunchers = service.getBackendLaunchers();
assertNotNull(backendLaunchers);
List<BackendLauncher> launchers = new ArrayList<>();
List<BackendLauncher> launchers = new ArrayList<>();
backendLaunchers.forEach(launchers::add);
assertNotNull(launchers);
assertFalse(launchers.isEmpty());
assertTrue(launchers.size() >= DEFAULT_CAPACITY);

launchers.stream().forEach(launcher -> {
LicensingResult result = launcher.launch(Collections.emptyMap());
assertTrue(result.getSeverity() == LicensingResult.OK);
});

launchers.stream().forEach(launcher -> {
LicensingResult result = launcher.terminate();
assertTrue(result.getSeverity() == LicensingResult.OK);
});

}
}

0 comments on commit 516de73

Please sign in to comment.