diff --git a/co-simulation/fed/mosaic-infrastructure/src/main/java/org/eclipse/mosaic/fed/infrastructure/ambassador/InfrastructureInstance.java b/co-simulation/fed/mosaic-infrastructure/src/main/java/org/eclipse/mosaic/fed/infrastructure/ambassador/InfrastructureInstance.java index 76464396..ac36145c 100644 --- a/co-simulation/fed/mosaic-infrastructure/src/main/java/org/eclipse/mosaic/fed/infrastructure/ambassador/InfrastructureInstance.java +++ b/co-simulation/fed/mosaic-infrastructure/src/main/java/org/eclipse/mosaic/fed/infrastructure/ambassador/InfrastructureInstance.java @@ -157,6 +157,31 @@ public int getTimeSyncPort() { public void setTimeSyncPort(int timeSyncPort) { this.timeSyncPort = timeSyncPort; } + + + public int getSimulatedInteractionPort() { + return simulatedInteractionPort; + } + + + + public void setSimulatedInteractionPort(int simulatedInteractionPort) { + this.simulatedInteractionPort = simulatedInteractionPort; + } + + + + public List getSensors() { + return sensors; + } + + + + public void setSensors(List sensors) { + this.sensors = sensors; + } + + public boolean containsSensor(String sensorId) { for (Detector sensor : sensors) { diff --git a/co-simulation/fed/mosaic-infrastructure/src/test/java/org/eclipse/mosaic/fed/infrastructure/ambassador/InfrastructureInstanceTest.java b/co-simulation/fed/mosaic-infrastructure/src/test/java/org/eclipse/mosaic/fed/infrastructure/ambassador/InfrastructureInstanceTest.java index 6314cb2d..eac72736 100644 --- a/co-simulation/fed/mosaic-infrastructure/src/test/java/org/eclipse/mosaic/fed/infrastructure/ambassador/InfrastructureInstanceTest.java +++ b/co-simulation/fed/mosaic-infrastructure/src/test/java/org/eclipse/mosaic/fed/infrastructure/ambassador/InfrastructureInstanceTest.java @@ -81,5 +81,35 @@ public void testGetterSetterConstructor() { assertEquals(CartesianPoint.ORIGO, instance.getLocation()); assertEquals(3456, instance.getRxMessagePort()); assertEquals(5667, instance.getTimeSyncPort()); + // Test Setter + instance.setInfrastructureId("DifferentID"); + assertEquals("DifferentID", instance.getInfrastructureId()); + instance.setLocation(CartesianPoint.xy(40, 50)); + assertEquals(CartesianPoint.xy(40, 50), instance.getLocation()); + instance.setTimeSyncPort(4321); + assertEquals(4321, instance.getTimeSyncPort()); + instance.setRxMessagePort(5678); + assertEquals(5678, instance.getRxMessagePort()); + instance.setSimulatedInteractionPort(9999); + assertEquals(9999, instance.getSimulatedInteractionPort()); + ArrayList sensors = new ArrayList<>(); + sensors.add( + new Detector( + "sensor1", + DetectorType.SEMANTIC_LIDAR, + new Orientation( 1.0,2.0,3.0), + CartesianPoint.ORIGO)); + sensors.add( + new Detector( + "NewSensor", + DetectorType.SEMANTIC_LIDAR, + new Orientation( 24.0,25.0,6.0), + CartesianPoint.ORIGO)); + instance.setSensors(sensors); + assertEquals(sensors, instance.getSensors()); + instance.setTargetAddress(address); + assertEquals(address, instance.getTargetAddress()); + + } }