Search in sources :

Example 1 with CdmaDevice

use of org.opensmartgridplatform.domain.core.valueobjects.CdmaDevice in project open-smart-grid-platform by OSGP.

the class CdmaRunTest method tenDevices.

@Test
public void tenDevices() {
    final CdmaRun run = new CdmaRun();
    for (int i = 0; i < 10; i++) {
        run.add(new CdmaDevice("cd" + i, this.loopbackAddress, "200/1", (short) 1));
    }
    this.service.setTransitionForCdmaRun(run, "LianderNetManagement", "ten-devices-cdma-run-test", TransitionType.DAY_NIGHT);
    this.verifySentMessages(10);
}
Also used : CdmaRun(org.opensmartgridplatform.adapter.domain.publiclighting.application.valueobjects.CdmaRun) CdmaDevice(org.opensmartgridplatform.domain.core.valueobjects.CdmaDevice) Test(org.junit.jupiter.api.Test)

Example 2 with CdmaDevice

use of org.opensmartgridplatform.domain.core.valueobjects.CdmaDevice in project open-smart-grid-platform by OSGP.

the class CdmaRunTest method threeBatchesNoDelay.

@Test
public void threeBatchesNoDelay() {
    // Set a delay of 0 seconds for this scenario
    this.service = new SetTransitionService(Executors.newScheduledThreadPool(1), 0);
    MockitoAnnotations.initMocks(this);
    final CdmaRun run = new CdmaRun();
    for (short i = 0; i < 3; i++) {
        run.add(new CdmaDevice("cd" + i, this.loopbackAddress, "200/1", i));
    }
    this.service.setTransitionForCdmaRun(run, "LianderNetManagement", "ten-batches-cdma-run-test", TransitionType.DAY_NIGHT);
    this.verifySentMessages(3);
}
Also used : CdmaRun(org.opensmartgridplatform.adapter.domain.publiclighting.application.valueobjects.CdmaRun) CdmaDevice(org.opensmartgridplatform.domain.core.valueobjects.CdmaDevice) Test(org.junit.jupiter.api.Test)

Example 3 with CdmaDevice

use of org.opensmartgridplatform.domain.core.valueobjects.CdmaDevice in project open-smart-grid-platform by OSGP.

the class CdmaRunTest method oneDevice.

@Test
public void oneDevice() {
    final CdmaRun run = new CdmaRun();
    run.add(new CdmaDevice("cd1", this.loopbackAddress, "200/1", (short) 1));
    this.service.setTransitionForCdmaRun(run, "LianderNetManagement", "one-device-cdma-run-test", TransitionType.NIGHT_DAY);
    this.verifySentMessages(1);
}
Also used : CdmaRun(org.opensmartgridplatform.adapter.domain.publiclighting.application.valueobjects.CdmaRun) CdmaDevice(org.opensmartgridplatform.domain.core.valueobjects.CdmaDevice) Test(org.junit.jupiter.api.Test)

Example 4 with CdmaDevice

use of org.opensmartgridplatform.domain.core.valueobjects.CdmaDevice in project open-smart-grid-platform by OSGP.

the class CdmaRunTest method itemPerMastSegment.

@Test
public void itemPerMastSegment() {
    final CdmaRun run = new CdmaRun();
    for (int i = 0; i < 5; i++) {
        run.add(new CdmaDevice("cd" + i, this.loopbackAddress, "200/" + i, (short) 1));
    }
    final Iterator<CdmaMastSegment> iterator = run.getMastSegmentIterator();
    for (int i = 0; i < 5; i++) {
        iterator.next();
    }
    assertThat(iterator.hasNext()).withFailMessage("Iterator should not have any items left").isFalse();
}
Also used : CdmaMastSegment(org.opensmartgridplatform.adapter.domain.publiclighting.application.valueobjects.CdmaMastSegment) CdmaRun(org.opensmartgridplatform.adapter.domain.publiclighting.application.valueobjects.CdmaRun) CdmaDevice(org.opensmartgridplatform.domain.core.valueobjects.CdmaDevice) Test(org.junit.jupiter.api.Test)

Example 5 with CdmaDevice

use of org.opensmartgridplatform.domain.core.valueobjects.CdmaDevice in project open-smart-grid-platform by OSGP.

the class AdHocManagementService method getCdmaDevicesPerMastSegment.

private CdmaRun getCdmaDevicesPerMastSegment(final LightMeasurementDevice lmd) {
    // Find all SSLDs which need to receive a SET_TRANSITION message.
    final List<CdmaDevice> devicesForLmd = this.ssldRepository.findCdmaBatchDevicesInUseForLmd(lmd, DeviceLifecycleStatus.IN_USE);
    final CdmaRun cdmaRun = new CdmaRun();
    devicesForLmd.forEach(cdmaRun::add);
    return cdmaRun;
}
Also used : CdmaRun(org.opensmartgridplatform.adapter.domain.publiclighting.application.valueobjects.CdmaRun) CdmaDevice(org.opensmartgridplatform.domain.core.valueobjects.CdmaDevice)

Aggregations

CdmaRun (org.opensmartgridplatform.adapter.domain.publiclighting.application.valueobjects.CdmaRun)6 CdmaDevice (org.opensmartgridplatform.domain.core.valueobjects.CdmaDevice)6 Test (org.junit.jupiter.api.Test)5 CdmaMastSegment (org.opensmartgridplatform.adapter.domain.publiclighting.application.valueobjects.CdmaMastSegment)1