Skip to content
Snippets Groups Projects
Commit c203c52e authored by Carsten Stocklöw's avatar Carsten Stocklöw
Browse files

removed the dependency to ont.lighting (was used for tests)

parent a4dae0d1
No related branches found
No related tags found
No related merge requests found
...@@ -52,12 +52,12 @@ ...@@ -52,12 +52,12 @@
<artifactId>mw.bus.junit</artifactId> <artifactId>mw.bus.junit</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <!-- <dependency>
<groupId>org.universAAL.ontology</groupId> <groupId>org.universAAL.ontology</groupId>
<artifactId>ont.lighting</artifactId> <artifactId>ont.lighting</artifactId>
<version>3.3.1-SNAPSHOT</version> <version>3.3.1-SNAPSHOT</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency> -->
</dependencies> </dependencies>
<build> <build>
......
...@@ -22,14 +22,14 @@ import org.universAAL.middleware.owl.OntologyManagement; ...@@ -22,14 +22,14 @@ import org.universAAL.middleware.owl.OntologyManagement;
import org.universAAL.middleware.owl.TypeURI; import org.universAAL.middleware.owl.TypeURI;
import org.universAAL.middleware.service.DefaultServiceCaller; import org.universAAL.middleware.service.DefaultServiceCaller;
import org.universAAL.middleware.tracker.IBusMemberRegistry; import org.universAAL.middleware.tracker.IBusMemberRegistry;
import org.universAAL.ontology.lighting.ElectricLight; //import org.universAAL.ontology.lighting.ElectricLight;
import org.universAAL.ontology.lighting.LightSource; //import org.universAAL.ontology.lighting.LightSource;
import org.universAAL.ontology.lighting.Lighting; //import org.universAAL.ontology.lighting.Lighting;
import org.universAAL.ontology.lighting.LightingOntology; //import org.universAAL.ontology.lighting.LightingOntology;
import org.universAAL.ontology.location.LocationOntology; //import org.universAAL.ontology.location.LocationOntology;
import org.universAAL.ontology.location.indoor.Room; //import org.universAAL.ontology.location.indoor.Room;
import org.universAAL.ontology.phThing.PhThingOntology; //import org.universAAL.ontology.phThing.PhThingOntology;
import org.universAAL.ontology.shape.ShapeOntology; //import org.universAAL.ontology.shape.ShapeOntology;
import org.universAAL.tools.logmonitor.Activator; import org.universAAL.tools.logmonitor.Activator;
import org.universAAL.tools.logmonitor.bus_member.BusMemberListener; import org.universAAL.tools.logmonitor.bus_member.BusMemberListener;
import org.universAAL.container.JUnit.JUnitContainer; import org.universAAL.container.JUnit.JUnitContainer;
...@@ -70,10 +70,10 @@ public class Test extends BusTestCase { ...@@ -70,10 +70,10 @@ public class Test extends BusTestCase {
super.setUp(); super.setUp();
isSetUp = true; isSetUp = true;
OntologyManagement.getInstance().register(mc, new LocationOntology()); // OntologyManagement.getInstance().register(mc, new LocationOntology());
OntologyManagement.getInstance().register(mc, new ShapeOntology()); // OntologyManagement.getInstance().register(mc, new ShapeOntology());
OntologyManagement.getInstance().register(mc, new PhThingOntology()); // OntologyManagement.getInstance().register(mc, new PhThingOntology());
OntologyManagement.getInstance().register(mc, new LightingOntology()); // OntologyManagement.getInstance().register(mc, new LightingOntology());
mc.setAttribute(AccessControl.PROP_MODE, "none"); mc.setAttribute(AccessControl.PROP_MODE, "none");
mc.setAttribute(AccessControl.PROP_MODE_UPDATE, "always"); mc.setAttribute(AccessControl.PROP_MODE_UPDATE, "always");
...@@ -104,67 +104,67 @@ public class Test extends BusTestCase { ...@@ -104,67 +104,67 @@ public class Test extends BusTestCase {
((JUnitContainer) mc.getContainer()).registerLogListeners(a.lm); ((JUnitContainer) mc.getContainer()).registerLogListeners(a.lm);
} }
public static ContextEventPattern[] providedEvents(Lighting theServer) { // public static ContextEventPattern[] providedEvents(Lighting theServer) {
MergedRestriction predicateRestriction = MergedRestriction // MergedRestriction predicateRestriction = MergedRestriction
.getFixedValueRestriction(ContextEvent.PROP_RDF_PREDICATE, // .getFixedValueRestriction(ContextEvent.PROP_RDF_PREDICATE,
LightSource.PROP_SOURCE_BRIGHTNESS); // LightSource.PROP_SOURCE_BRIGHTNESS);
MergedRestriction objectRestriction = MergedRestriction // MergedRestriction objectRestriction = MergedRestriction
.getAllValuesRestrictionWithCardinality( // .getAllValuesRestrictionWithCardinality(
ContextEvent.PROP_RDF_OBJECT, new Enumeration( // ContextEvent.PROP_RDF_OBJECT, new Enumeration(
new Integer[] { new Integer(0), // new Integer[] { new Integer(0),
new Integer(100) }), 1, 1); // new Integer(100) }), 1, 1);
LightSource[] myLights = new LightSource[] { // LightSource[] myLights = new LightSource[] {
new LightSource("lamp1", ElectricLight.lightBulb, new Room( // new LightSource("lamp1", ElectricLight.lightBulb, new Room(
"room1")), // "room1")),
new LightSource("lamp2", ElectricLight.ledLamp, new Room( // new LightSource("lamp2", ElectricLight.ledLamp, new Room(
"room2")) }; // "room2")) };
//
MergedRestriction subjectRestriction = MergedRestriction // MergedRestriction subjectRestriction = MergedRestriction
.getAllValuesRestrictionWithCardinality( // .getAllValuesRestrictionWithCardinality(
ContextEvent.PROP_RDF_SUBJECT, // ContextEvent.PROP_RDF_SUBJECT,
new Enumeration(myLights), 1, 1); // new Enumeration(myLights), 1, 1);
ContextEventPattern cep1 = new ContextEventPattern(); // ContextEventPattern cep1 = new ContextEventPattern();
cep1.addRestriction(subjectRestriction); // cep1.addRestriction(subjectRestriction);
cep1.addRestriction(predicateRestriction); // cep1.addRestriction(predicateRestriction);
cep1.addRestriction(objectRestriction); // cep1.addRestriction(objectRestriction);
Intersection xsection = new Intersection(); // Intersection xsection = new Intersection();
xsection.addType(new TypeURI(LightSource.MY_URI, false)); // xsection.addType(new TypeURI(LightSource.MY_URI, false));
xsection.addType(MergedRestriction.getFixedValueRestriction( // xsection.addType(MergedRestriction.getFixedValueRestriction(
LightSource.PROP_HAS_TYPE, ElectricLight.lightBulb)); // LightSource.PROP_HAS_TYPE, ElectricLight.lightBulb));
xsection.addType(MergedRestriction // xsection.addType(MergedRestriction
.getAllValuesRestrictionWithCardinality( // .getAllValuesRestrictionWithCardinality(
LightSource.PROP_PHYSICAL_LOCATION, Room.MY_URI, 1, 1)); // LightSource.PROP_PHYSICAL_LOCATION, Room.MY_URI, 1, 1));
subjectRestriction = MergedRestriction // subjectRestriction = MergedRestriction
.getAllValuesRestrictionWithCardinality( // .getAllValuesRestrictionWithCardinality(
ContextEvent.PROP_RDF_SUBJECT, xsection, 1, 1); // ContextEvent.PROP_RDF_SUBJECT, xsection, 1, 1);
ContextEventPattern cep2 = new ContextEventPattern(); // ContextEventPattern cep2 = new ContextEventPattern();
cep2.addRestriction(subjectRestriction); // cep2.addRestriction(subjectRestriction);
cep2.addRestriction(predicateRestriction); // cep2.addRestriction(predicateRestriction);
cep2.addRestriction(objectRestriction); // cep2.addRestriction(objectRestriction);
//
return new ContextEventPattern[] { cep1, cep2 }; // return new ContextEventPattern[] { cep1, cep2 };
} // }
public void testAddScript() { public void testAddScript() {
LogUtils.logDebug(mc, this.getClass(), "method", "msg"); LogUtils.logDebug(mc, this.getClass(), "method", "msg");
caller = new DefaultServiceCaller(mc); caller = new DefaultServiceCaller(mc);
Lighting theServer = new Lighting(); // Lighting theServer = new Lighting();
ContextEventPattern[] cep = providedEvents(theServer); // ContextEventPattern[] cep = providedEvents(theServer);
ContextProvider info = new ContextProvider("TestContextProvider"); // ContextProvider info = new ContextProvider("TestContextProvider");
info.setType(ContextProviderType.controller); // info.setType(ContextProviderType.controller);
info.setProvidedEvents(cep); // info.setProvidedEvents(cep);
ContextPublisher cp = new DefaultContextPublisher(mc, info); // ContextPublisher cp = new DefaultContextPublisher(mc, info);
//
ContextSubscriber cs = new ContextSubscriber(mc, cep) { // ContextSubscriber cs = new ContextSubscriber(mc, cep) {
@Override // @Override
public void handleContextEvent(ContextEvent event) { // public void handleContextEvent(ContextEvent event) {
} // }
//
@Override // @Override
public void communicationChannelBroken() { // public void communicationChannelBroken() {
} // }
}; // };
// BusMemberListener l = // BusMemberListener l =
// org.universAAL.tools.logmonitor.bus_member.LogMonitor.busMemberListener; // org.universAAL.tools.logmonitor.bus_member.LogMonitor.busMemberListener;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment