use of org.opensmartgridplatform.adapter.domain.publiclighting.application.valueobjects.CdmaBatchDevice in project open-smart-grid-platform by OSGP.
the class CdmaMastSegmentTest method newBatchNumberNull.
@Test
public void newBatchNumberNull() {
final CdmaMastSegment mastSegment = new CdmaMastSegment("200/1");
final CdmaBatchDevice cd1 = new CdmaBatchDevice("cd1", this.loopbackAddress);
mastSegment.addCdmaBatchDevice(null, cd1);
final CdmaBatch cdmaBatch = mastSegment.popCdmaBatch();
assertThat(cdmaBatch.getBatchNumber()).withFailMessage("Batch should get maximum batch number").isEqualTo(CdmaBatch.MAX_BATCH_NUMBER);
}
use of org.opensmartgridplatform.adapter.domain.publiclighting.application.valueobjects.CdmaBatchDevice in project open-smart-grid-platform by OSGP.
the class CdmaMastSegmentTest method testPopBatches.
@Test
public void testPopBatches() {
final CdmaMastSegment mastSegment = new CdmaMastSegment("200/55");
for (short i = 0; i < 10; i++) {
// Each device has a different batch
mastSegment.addCdmaBatchDevice(i, new CdmaBatchDevice("cd" + i, this.loopbackAddress));
}
for (int batchNo = 0; batchNo < 10; batchNo++) {
assertThat(mastSegment.empty()).withFailMessage("There should be at least one CdmaBatch left").isFalse();
mastSegment.popCdmaBatch();
}
assertThat(mastSegment.empty()).withFailMessage("All CdmaBatches should have been removed by now").isTrue();
}
use of org.opensmartgridplatform.adapter.domain.publiclighting.application.valueobjects.CdmaBatchDevice in project open-smart-grid-platform by OSGP.
the class CdmaMastSegmentTest method popCdmaBatch.
@Test
public void popCdmaBatch() {
final CdmaMastSegment mastSegment = new CdmaMastSegment("200/1");
final CdmaBatchDevice cd1 = new CdmaBatchDevice("cd1", this.loopbackAddress);
mastSegment.addCdmaBatchDevice((short) 1, cd1);
final CdmaBatchDevice cd2 = new CdmaBatchDevice("cd2", this.loopbackAddress);
mastSegment.addCdmaBatchDevice((short) 1, cd2);
final CdmaBatch batch = mastSegment.popCdmaBatch();
assertThat(batch.getCdmaBatchDevices().size()).isEqualTo(2);
// popCdmaBatch should remove the batch from the mast segment,
// there should be no more batch left in the mast segment.
assertThat(mastSegment.empty()).withFailMessage("MastSegment should not contain any devices").isTrue();
}
use of org.opensmartgridplatform.adapter.domain.publiclighting.application.valueobjects.CdmaBatchDevice in project open-smart-grid-platform by OSGP.
the class CdmaMastSegmentTest method newCdmaMastSegment.
@Test
public void newCdmaMastSegment() {
final CdmaMastSegment mastSegment = new CdmaMastSegment("200/1");
final CdmaBatchDevice cd1 = new CdmaBatchDevice("cd1", this.loopbackAddress);
mastSegment.addCdmaBatchDevice((short) 1, cd1);
assertThat(mastSegment.getMastSegment()).isEqualTo("200/1");
assertThat(mastSegment.empty()).withFailMessage("MastSegment should contain 1 device").isFalse();
}
use of org.opensmartgridplatform.adapter.domain.publiclighting.application.valueobjects.CdmaBatchDevice in project open-smart-grid-platform by OSGP.
the class CdmaBatchTest method newCdmaBatch.
@Test
public void newCdmaBatch() {
final CdmaBatch batch = new CdmaBatch((short) 1);
final CdmaBatchDevice cd1 = new CdmaBatchDevice("cd1", this.loopbackAddress);
batch.addCdmaBatchDevice(cd1);
final CdmaBatchDevice cd2 = new CdmaBatchDevice("cd2", this.loopbackAddress);
batch.addCdmaBatchDevice(cd2);
assertThat(batch.getBatchNumber()).isEqualTo(Short.valueOf((short) 1));
assertThat(batch.getCdmaBatchDevices().size()).withFailMessage("Batch should contain 2 devices").isEqualTo(2);
}
Aggregations