Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Hoffmann <m.hoffmann@data-in-motion.biz>
  • Loading branch information
maho7791 committed May 24, 2023
1 parent 1b74676 commit f017b14
Show file tree
Hide file tree
Showing 14 changed files with 45 additions and 34 deletions.
9 changes: 2 additions & 7 deletions org.gecko.playground.ds.config/launch-config.bndrun
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
bnd.identity;id='org.apache.felix.gogo.shell',\
bnd.identity;id='org.apache.felix.configadmin',\
bnd.identity;id='org.eclipse.parsson.jakarta.json',\
bnd.identity;id='org.gecko.playground.ds.config.configadmin',\
bnd.identity;id='org.gecko.playground.ds.config.configurator'
bnd.identity;id='org.gecko.playground.ds.config.configadmin'
-runbundles: \
org.apache.felix.configadmin;version='[1.9.26,1.9.27)',\
org.apache.felix.gogo.command;version='[1.1.2,1.1.3)',\
Expand All @@ -16,9 +15,5 @@
org.osgi.service.component;version='[1.5.1,1.5.2)',\
org.osgi.util.function;version='[1.2.0,1.2.1)',\
org.osgi.util.promise;version='[1.3.0,1.3.1)',\
org.apache.felix.cm.json;version='[2.0.0,2.0.1)',\
org.apache.felix.configurator;version='[1.0.18,1.0.19)',\
org.osgi.util.converter;version='[1.0.9,1.0.10)',\
org.eclipse.parsson.jakarta.json;version='[1.1.1,1.1.2)',\
org.gecko.playground.ds.config.configadmin;version=snapshot,\
org.gecko.playground.ds.config.configurator;version=snapshot
org.gecko.playground.ds.config.configadmin;version=snapshot
4 changes: 3 additions & 1 deletion org.gecko.playground.ds.dynamics/bnd.bnd
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
-buildpath: org.gecko.playground.exchange.api
-buildpath: \
org.gecko.playground.exchange.api,\
org.osgi.service.component
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
@Component
public class ExchangeComponent {

private AtomicReference<Exchange> exchangeRef;
private AtomicReference<Exchange> exchangeRef = new AtomicReference<Exchange>();

@Activate
public void activate() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,9 @@ public void logMessage(String message) {
System.out.println("LOG : " + message);
}

@Override
public String info(String message) {
return "INFO: " + message;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
public interface Log {

void logMessage(String message);

String info(String message);
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,9 @@ public void logMessage(String message) {
System.out.println("ANOTHER LOG : " + message);
}

@Override
public String info(String message) {
return "Another: " + message;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ void setLog(Log log) {
}

void unsetLog(Log log) {
System.out.println("set Log " + log.getClass().getName());
System.out.println("unset Log " + log.getClass().getName());
}

}
11 changes: 7 additions & 4 deletions org.gecko.playground.exchange.client/launch.bndrun
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-runfw: org.apache.felix.framework;version='[7.0.5,7.0.5]'
-runfw: org.eclipse.osgi;version='[3.18.200.v20221116-1324,3.18.200.v20221116-1324]'
-runee: JavaSE-17
-runrequires: \
bnd.identity;id='org.gecko.playground.exchange.impl',\
Expand All @@ -14,9 +14,12 @@
org.gecko.playground.exchange.api;version=snapshot,\
org.gecko.playground.exchange.impl;version=snapshot,\
org.osgi.service.component;version='[1.5.1,1.5.2)',\
org.osgi.service.log;version='[1.5.0,1.5.1)',\
org.osgi.util.function;version='[1.2.0,1.2.1)',\
org.osgi.util.promise;version='[1.3.0,1.3.1)',\
org.gecko.playground.ds.simple;version=snapshot,\
org.gecko.playground.exchange.client;version=snapshot,\
org.apache.felix.eventadmin;version='[1.6.4,1.6.5)'
org.apache.felix.eventadmin;version='[1.6.4,1.6.5)'

-runproperties: \
osgi.console.enable.builtin=false,\
osgi.console=,\
console=
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.gecko.playground.model.orders.Side;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
import org.osgi.service.component.annotations.ReferenceCardinality;

@Component (service = Object.class ,
property = { "osgi.command.scope=exchange",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class ExampleResource {
@GET
@Path("example")
public String sayHello() {
return "Hell outthere";
return "Hello out there";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
@Component(service = Task.class)
public class ExampleInitializationTask extends AbstractTask {

@Reference(service = LoggerFactory.class)
private Logger logger;

@Override
public String getName() {
return "EXTERNAL 1 - INITIALIZATION TASK";
Expand All @@ -29,23 +26,23 @@ public String getId() {

@Override
protected void doActivate() {
logger.info("Started activation EXTERNAL 1 ...");
System.out.println("Started activation EXTERNAL 1 ...");
try {
Thread.sleep(8000l);
} catch (InterruptedException e) {
e.printStackTrace();
}
logger.info("Finished initialization EXTERNAL 1");
System.out.println("Finished initialization EXTERNAL 1");
}

@Override
protected void doDeactivate() {
logger.info("Started deactivation EXTERNAL 1 ...");
System.out.println("Started deactivation EXTERNAL 1 ...");
try {
Thread.sleep(3000l);
} catch (InterruptedException e) {
e.printStackTrace();
}
logger.info("Finished deactivation EXTERNAL 1");
System.out.println("Finished deactivation EXTERNAL 1");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,33 @@
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
import org.osgi.service.condition.Condition;
import org.osgi.service.log.Logger;
import org.osgi.service.log.LoggerFactory;


@Component(service = Task.class, reference = {
@Reference(name = "onlineCondition", service = Condition.class, target = Conditions.TARGET_ONLINE)
})
public class OnlineAuthenticatedExampleInitializationTask extends AbstractTask {

@Reference(service = LoggerFactory.class)
private Logger logger;

@Override
public void doActivate() {
logger.info("Started initialization EXTERNAL 3 Workmode ONLINE ...");
System.out.println("Started initialization EXTERNAL 3 Workmode ONLINE ...");
try {
Thread.sleep(5000l);
} catch (InterruptedException e) {
e.printStackTrace();
}
logger.info("Finished initialization EXTERNAL 3 Workmode ONLINE");
System.out.println("Finished initialization EXTERNAL 3 Workmode ONLINE");
}

@Override
public void doDeactivate() {
logger.info("Started deactivation EXTERNAL 3 Workmode ONLINE ...");
System.out.println("Started deactivation EXTERNAL 3 Workmode ONLINE ...");
try {
Thread.sleep(5000l);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
logger.info("Finished deactivation EXTERNAL 3 Workmode ONLINE");
System.out.println("Finished deactivation EXTERNAL 3 Workmode ONLINE");
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions org.gecko.playground.test/bnd.bnd
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ Test-Cases: ${classes;HIERARCHY_INDIRECTLY_ANNOTATED;org.junit.platform.commons.
-buildpath: \
org.osgi.framework;version=latest,\
org.osgi.test.junit5.cm;version=latest,\
org.gecko.playground.ds.config.configadmin;version=latest,\
org.gecko.playground.ds.simple;version=latest
org.gecko.playground.ds.config.configadmin;version=snapshot,\
org.gecko.playground.ds.simple;version=snapshot

Private-Package: org.gecko.playground.test

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ public void testLogService(@InjectService Log log) {
assertNotNull(log);
assertNotNull(mockBar);
}

@Test
public void testLogInfo(@InjectService Log log) {
assertNotNull(log);
assertNotNull(mockBar);
assertEquals("INFO: test", log.info("test"));
}

@Test
public void testBarServicePublished(@InjectService(cardinality = 0) ServiceAware<Bar> barAware,
Expand Down

0 comments on commit f017b14

Please sign in to comment.