test(automation): Add benchmark tests for automation service

Merge request reports

Loading
+5 −6
Changes for src/automation/src/main/java/eu/teraflow/automation/AutomationGatewayImpl.java: 5 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -76,12 +76,11 @@ public class AutomationGatewayImpl implements AutomationGateway {

    @Override
    public Uni<Automation.DeviceRoleState> ztpDelete(Automation.DeviceRole request) {
        return Uni.createFrom()
                .item(
                        () ->
                                Automation.DeviceRoleState.newBuilder()
                                        .setDevRoleId(request.getDevRoleId())
                                        .build());
        final var devRoleId = request.getDevRoleId().getDevRoleId().getUuid();
        return automationService
                .deleteDevice(devRoleId)
                .onItem()
                .transform(device -> transformToDeviceRoleState(device, devRoleId, DeviceState.DELETED));
    }

    @Override
+2 −2
Changes for src/automation/src/main/java/eu/teraflow/automation/ContextSubscriber.java: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -79,8 +79,8 @@ public class ContextSubscriber {
                                    break;
                                case UPDATE:
                                    LOGGER.warnf(
                                        "Received %s for device [%s]. " +
                                            "No automation action on an already updated device",
                                            "Received %s for device [%s]. "
                                                    + "No automation action on an already updated device",
                                            event, deviceId);
                                    break;
                                case UNDEFINED:
+47 −0
Changes for src/automation/src/test/java/eu/teraflow/automation/AutomationServiceTest.java: 47 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -280,6 +280,53 @@ class AutomationServiceTest {
        final var uuid = serializer.serializeUuid(UUID_VALUE);
        final var deviceRoleId = Automation.DeviceRoleId.newBuilder().setDevRoleId(uuid).build();
        final var deviceRole = Automation.DeviceRole.newBuilder().setDevRoleId(deviceRoleId).build();
        final var DEVICE_ID = "0f14d0ab-9608-7862-a9e4-5ed26688389b";
        final var DEVICE_ROLE_ID = "0f14d0ab-9608-7862-a9e4-5ed26688389a";
        final var DEVICE_TYPE = "ztp";

        final var deviceDrivers = List.of(DeviceDriverEnum.IETF_NETWORK_TOPOLOGY, DeviceDriverEnum.P4);

        final var topologyIdA = new TopologyId("contextIdA", "idA");
        final var deviceIdA = "deviceIdA";
        final var idA = "idA";
        final var endPointIdA = new EndPointId(topologyIdA, deviceIdA, idA);

        final var endPointTypeA = "endPointTypeA";
        final var kpiSampleTypesA =
                List.of(KpiSampleType.BYTES_RECEIVED, KpiSampleType.BYTES_TRANSMITTED);
        final var locationTypeRegionA = new LocationTypeRegion("ATH");
        final var locationA = new Location(locationTypeRegionA);
        final var endPointA =
                new EndPointBuilder(endPointIdA, endPointTypeA, kpiSampleTypesA)
                        .location(locationA)
                        .build();

        final var topologyIdB = new TopologyId("contextIdB", "idB");
        final var deviceIdB = "deviceIdB";
        final var idB = "idB";
        final var endPointIdB = new EndPointId(topologyIdB, deviceIdB, idB);
        final var endPointTypeB = "endPointTypeB";
        final var kpiSampleTypesB =
                List.of(KpiSampleType.BYTES_RECEIVED, KpiSampleType.BYTES_TRANSMITTED);
        final var locationTypeRegionB = new LocationTypeRegion("ATH");
        final var locationB = new Location(locationTypeRegionB);
        final var endPointB =
                new EndPointBuilder(endPointIdB, endPointTypeB, kpiSampleTypesB)
                        .location(locationB)
                        .build();

        final var endPoints = List.of(endPointA, endPointB);

        final var emptyDeviceConfig = new DeviceConfig(List.of());
        final var device =
                new Device(
                        DEVICE_ID,
                        DEVICE_TYPE,
                        emptyDeviceConfig,
                        DeviceOperationalStatus.ENABLED,
                        deviceDrivers,
                        endPoints);
        Mockito.when(contextGateway.getDevice(Mockito.any())).thenReturn(Uni.createFrom().item(device));

        client
                .ztpDelete(deviceRole)
+120 −4

File changed.

Generated files are collapsed by default. To change this behavior, edit the .gitattributes file. Learn more.

+4327 −2236

File changed.

Generated files are collapsed by default. To change this behavior, edit the .gitattributes file. Learn more.

Loading
Loading