Loading src/policy/src/test/java/org/etsi/tfs/policy/PolicyAddDeviceTest.java +0 −30 Original line number Diff line number Diff line Loading @@ -103,36 +103,6 @@ class PolicyAddDeviceTest { .isEqualTo(expectedResult.getPolicyRuleStateMessage().toString()); } @Test void isPolicyRuleBasicValid() throws ExecutionException, InterruptedException, TimeoutException { CompletableFuture<PolicyRuleState> message = new CompletableFuture<>(); PolicyRuleBasic policyRuleBasic = new PolicyRuleBasic( "policyId", new PolicyRuleState(PolicyRuleStateEnum.POLICY_INSERTED, "Failed due to some errors"), 0, new ArrayList<>()); PolicyRuleDevice policyRuleDevice = new PolicyRuleDevice(policyRuleBasic, Arrays.asList("device1", "device2")); PolicyRuleState expectedResult = new PolicyRuleState( PolicyRuleStateEnum.POLICY_FAILED, "Policy rule actions cannot be empty."); policyService .addPolicyDevice(policyRuleDevice) .subscribe() .with( item -> { message.complete(item); }); assertThat(message.get(5, TimeUnit.SECONDS).getPolicyRuleStateMessage()) .isEqualTo(expectedResult.getPolicyRuleStateMessage().toString()); } @Test void isPolicyRuleIdValid() throws ExecutionException, InterruptedException, TimeoutException { CompletableFuture<PolicyRuleState> message = new CompletableFuture<>(); Loading src/policy/src/test/java/org/etsi/tfs/policy/PolicyAddServiceTest.java +0 −36 Original line number Diff line number Diff line Loading @@ -138,42 +138,6 @@ public class PolicyAddServiceTest { .isEqualTo(expectedResult.getPolicyRuleStateMessage().toString()); } @Test void policyRuleIdMustNotBeEmpty() throws ExecutionException, InterruptedException, TimeoutException { CompletableFuture<PolicyRuleState> message = new CompletableFuture<>(); String policyId = ""; PolicyRuleBasic policyRuleBasic = new PolicyRuleBasic( policyId, new PolicyRuleState(PolicyRuleStateEnum.POLICY_INSERTED, "Failed due to some errors"), 1, new ArrayList<>()); ServiceId serviceId = new ServiceId("contextId", "serviceId"); Service service = new Service(serviceId, ServiceTypeEnum.UNKNOWN, null, null, null, null, 0.0); PolicyRuleService policyRuleService = new PolicyRuleService(policyRuleBasic, serviceId, new ArrayList<>()); PolicyRuleState expectedResult = new PolicyRuleState(PolicyRuleStateEnum.POLICY_FAILED, "Policy rule ID must not be empty."); policyService .addPolicyService(policyRuleService) .subscribe() .with( item -> { message.complete(item); }); assertThat(message.get(5, TimeUnit.SECONDS).getPolicyRuleStateMessage()) .isEqualTo(expectedResult.getPolicyRuleStateMessage().toString()); } @Test void checkMessageIfServiceIsNotValid() throws ExecutionException, InterruptedException, TimeoutException { Loading src/policy/src/test/java/org/etsi/tfs/policy/PolicyGrpcServiceTest.java +0 −160 Original line number Diff line number Diff line Loading @@ -108,166 +108,6 @@ class PolicyGrpcServiceTest { .build(); } // @Test // void shouldAddPolicyService() throws ExecutionException, InterruptedException, TimeoutException // { // CompletableFuture<String> message = new CompletableFuture<>(); // final var policyRuleBasic = createPolicyRuleBasic(); // final var expectedPolicyRuleState = policyRuleBasic.getPolicyRuleState(); // final var serviceId = createContextServiceId(); // final var expectedDeviceIdUuid1 = // serializer.serializeUuid("20db867c-772d-4872-9179-244ecafb3257"); // final var expectedDeviceId1 = // // ContextOuterClass.DeviceId.newBuilder().setDeviceUuid(expectedDeviceIdUuid1).build(); // final var deviceIds = List.of(expectedDeviceId1); // final var policyRuleService = // Policy.PolicyRuleService.newBuilder() // .setPolicyRuleBasic(policyRuleBasic) // .setServiceId(serviceId) // .addAllDeviceList(deviceIds) // .build(); // client // .policyAddService(policyRuleService) // .subscribe() // .with(policyRuleState -> // message.complete(policyRuleState.getPolicyRuleState().toString())); // assertThat(message.get(5, TimeUnit.SECONDS)) // .isEqualTo(expectedPolicyRuleState.getPolicyRuleState().toString()); // } // @Test // void shouldAddPolicyDevice() throws ExecutionException, InterruptedException, TimeoutException // { // CompletableFuture<String> message = new CompletableFuture<>(); // final var expectedDeviceIdUuid1 = // serializer.serializeUuid("20db867c-772d-4872-9179-244ecafb3257"); // final var expectedDeviceIdUuid2 = // serializer.serializeUuid("095974ac-d757-412d-b317-bcf355220aa9"); // final var expectedDeviceId1 = // // ContextOuterClass.DeviceId.newBuilder().setDeviceUuid(expectedDeviceIdUuid1).build(); // final var expectedDeviceId2 = // // ContextOuterClass.DeviceId.newBuilder().setDeviceUuid(expectedDeviceIdUuid2).build(); // final var policyRuleBasic = createPolicyRuleBasic(); // final var deviceIds = List.of(expectedDeviceId1, expectedDeviceId2); // final var expectedPolicyRuleState = policyRuleBasic.getPolicyRuleState(); // final var policyRuleDevice = // Policy.PolicyRuleDevice.newBuilder() // .setPolicyRuleBasic(policyRuleBasic) // .addAllDeviceList(deviceIds) // .build(); // client // .policyAddDevice(policyRuleDevice) // .subscribe() // .with(policyRuleState -> // message.complete(policyRuleState.getPolicyRuleState().toString())); // assertThat(message.get(5, TimeUnit.SECONDS)) // .isEqualTo(expectedPolicyRuleState.getPolicyRuleState().toString()); // } @Test void shouldUpdatePolicyServiceReturnFailedState() throws ExecutionException, InterruptedException, TimeoutException { CompletableFuture<String> message = new CompletableFuture<>(); final var expectedPolicyRuleState = Policy.PolicyRuleState.newBuilder() .setPolicyRuleState(PolicyRuleStateEnum.POLICY_FAILED) .build(); final var policyRuleBasic = PolicyRuleBasic.newBuilder().setPolicyRuleState(expectedPolicyRuleState).build(); final var policyRuleService = Policy.PolicyRuleService.newBuilder().setPolicyRuleBasic(policyRuleBasic).build(); client .policyUpdateService(policyRuleService) .subscribe() .with(policyRuleState -> message.complete(policyRuleState.getPolicyRuleState().toString())); assertThat(message.get(5, TimeUnit.SECONDS)) .isEqualTo(expectedPolicyRuleState.getPolicyRuleState().toString()); } @Test void shouldUpdatePolicyDeviceReturnFailedState() throws ExecutionException, InterruptedException, TimeoutException { CompletableFuture<String> message = new CompletableFuture<>(); final var expectedDeviceIdUuid = serializer.serializeUuid("20db867c-772d-4872-9179-244ecafb3257"); final var expectedDeviceId = ContextOuterClass.DeviceId.newBuilder().setDeviceUuid(expectedDeviceIdUuid).build(); final var expectedPolicyRuleState = Policy.PolicyRuleState.newBuilder() .setPolicyRuleState(PolicyRuleStateEnum.POLICY_FAILED) .build(); final var policyRuleBasic = PolicyRuleBasic.newBuilder().setPolicyRuleState(expectedPolicyRuleState).build(); final var deviceIds = List.of(expectedDeviceId); final var policyRuleDevice = Policy.PolicyRuleDevice.newBuilder() .setPolicyRuleBasic(policyRuleBasic) .addAllDeviceList(deviceIds) .build(); client .policyUpdateDevice(policyRuleDevice) .subscribe() .with(policyRuleState -> message.complete(policyRuleState.getPolicyRuleState().toString())); assertThat(message.get(5, TimeUnit.SECONDS)) .isEqualTo(expectedPolicyRuleState.getPolicyRuleState().toString()); } // TODO: Disable shouldDeletePolicy test until mock context service // @Test // void shouldDeletePolicy() throws ExecutionException, InterruptedException, TimeoutException // { // CompletableFuture<String> message = new CompletableFuture<>(); // final var uuid = // ContextOuterClass.Uuid.newBuilder() // // .setUuid(UUID.fromString("0f14d0ab-9608-7862-a9e4-5ed26688389b").toString()) // .build(); // final var policyRuleId = Policy.PolicyRuleId.newBuilder().setUuid(uuid).build(); // final var expectedPolicyRuleState = // Policy.PolicyRuleState.newBuilder() // .setPolicyRuleState(PolicyRuleStateEnum.POLICY_REMOVED) // .build(); // client // .policyDelete(policyRuleId) // .subscribe() // .with(policyRuleState -> // message.complete(policyRuleState.getPolicyRuleState().toString())); // assertThat(message.get(5, TimeUnit.SECONDS)) // .isEqualTo(expectedPolicyRuleState.getPolicyRuleState().toString()); // } @Test void shouldGetPolicyService() throws ExecutionException, InterruptedException, TimeoutException { CompletableFuture<String> message = new CompletableFuture<>(); Loading src/policy/target/kubernetes/kubernetes.yml +8 −8 Original line number Diff line number Diff line Loading @@ -3,8 +3,8 @@ apiVersion: v1 kind: Service metadata: annotations: app.quarkus.io/commit-id: eb5af5697ca52e97a05476854dd7effb3bfa2d6b app.quarkus.io/build-timestamp: 2026-02-18 - 12:55:59 +0000 app.quarkus.io/commit-id: 155740d65d2f670ef76fe6219bbd3ca6422db18a app.quarkus.io/build-timestamp: 2026-02-18 - 13:48:37 +0000 prometheus.io/scrape: "true" prometheus.io/path: /q/metrics prometheus.io/port: "8080" Loading Loading @@ -33,8 +33,8 @@ apiVersion: apps/v1 kind: Deployment metadata: annotations: app.quarkus.io/commit-id: eb5af5697ca52e97a05476854dd7effb3bfa2d6b app.quarkus.io/build-timestamp: 2026-02-18 - 12:55:59 +0000 app.quarkus.io/commit-id: 155740d65d2f670ef76fe6219bbd3ca6422db18a app.quarkus.io/build-timestamp: 2026-02-18 - 13:48:37 +0000 prometheus.io/scrape: "true" prometheus.io/path: /q/metrics prometheus.io/port: "8080" Loading @@ -53,8 +53,8 @@ spec: template: metadata: annotations: app.quarkus.io/commit-id: eb5af5697ca52e97a05476854dd7effb3bfa2d6b app.quarkus.io/build-timestamp: 2026-02-18 - 12:55:59 +0000 app.quarkus.io/commit-id: 155740d65d2f670ef76fe6219bbd3ca6422db18a app.quarkus.io/build-timestamp: 2026-02-18 - 13:48:37 +0000 prometheus.io/scrape: "true" prometheus.io/path: /q/metrics prometheus.io/port: "8080" Loading @@ -71,12 +71,12 @@ spec: valueFrom: fieldRef: fieldPath: metadata.namespace - name: CONTEXT_SERVICE_HOST value: contextservice - name: SERVICE_SERVICE_HOST value: serviceservice - name: MONITORING_SERVICE_HOST value: monitoringservice - name: CONTEXT_SERVICE_HOST value: contextservice - name: KAFKA_BROKER_HOST value: kafka-service.kafka.svc.cluster.local image: labs.etsi.org:5050/tfs/controller/policy:0.1.0 Loading Loading
src/policy/src/test/java/org/etsi/tfs/policy/PolicyAddDeviceTest.java +0 −30 Original line number Diff line number Diff line Loading @@ -103,36 +103,6 @@ class PolicyAddDeviceTest { .isEqualTo(expectedResult.getPolicyRuleStateMessage().toString()); } @Test void isPolicyRuleBasicValid() throws ExecutionException, InterruptedException, TimeoutException { CompletableFuture<PolicyRuleState> message = new CompletableFuture<>(); PolicyRuleBasic policyRuleBasic = new PolicyRuleBasic( "policyId", new PolicyRuleState(PolicyRuleStateEnum.POLICY_INSERTED, "Failed due to some errors"), 0, new ArrayList<>()); PolicyRuleDevice policyRuleDevice = new PolicyRuleDevice(policyRuleBasic, Arrays.asList("device1", "device2")); PolicyRuleState expectedResult = new PolicyRuleState( PolicyRuleStateEnum.POLICY_FAILED, "Policy rule actions cannot be empty."); policyService .addPolicyDevice(policyRuleDevice) .subscribe() .with( item -> { message.complete(item); }); assertThat(message.get(5, TimeUnit.SECONDS).getPolicyRuleStateMessage()) .isEqualTo(expectedResult.getPolicyRuleStateMessage().toString()); } @Test void isPolicyRuleIdValid() throws ExecutionException, InterruptedException, TimeoutException { CompletableFuture<PolicyRuleState> message = new CompletableFuture<>(); Loading
src/policy/src/test/java/org/etsi/tfs/policy/PolicyAddServiceTest.java +0 −36 Original line number Diff line number Diff line Loading @@ -138,42 +138,6 @@ public class PolicyAddServiceTest { .isEqualTo(expectedResult.getPolicyRuleStateMessage().toString()); } @Test void policyRuleIdMustNotBeEmpty() throws ExecutionException, InterruptedException, TimeoutException { CompletableFuture<PolicyRuleState> message = new CompletableFuture<>(); String policyId = ""; PolicyRuleBasic policyRuleBasic = new PolicyRuleBasic( policyId, new PolicyRuleState(PolicyRuleStateEnum.POLICY_INSERTED, "Failed due to some errors"), 1, new ArrayList<>()); ServiceId serviceId = new ServiceId("contextId", "serviceId"); Service service = new Service(serviceId, ServiceTypeEnum.UNKNOWN, null, null, null, null, 0.0); PolicyRuleService policyRuleService = new PolicyRuleService(policyRuleBasic, serviceId, new ArrayList<>()); PolicyRuleState expectedResult = new PolicyRuleState(PolicyRuleStateEnum.POLICY_FAILED, "Policy rule ID must not be empty."); policyService .addPolicyService(policyRuleService) .subscribe() .with( item -> { message.complete(item); }); assertThat(message.get(5, TimeUnit.SECONDS).getPolicyRuleStateMessage()) .isEqualTo(expectedResult.getPolicyRuleStateMessage().toString()); } @Test void checkMessageIfServiceIsNotValid() throws ExecutionException, InterruptedException, TimeoutException { Loading
src/policy/src/test/java/org/etsi/tfs/policy/PolicyGrpcServiceTest.java +0 −160 Original line number Diff line number Diff line Loading @@ -108,166 +108,6 @@ class PolicyGrpcServiceTest { .build(); } // @Test // void shouldAddPolicyService() throws ExecutionException, InterruptedException, TimeoutException // { // CompletableFuture<String> message = new CompletableFuture<>(); // final var policyRuleBasic = createPolicyRuleBasic(); // final var expectedPolicyRuleState = policyRuleBasic.getPolicyRuleState(); // final var serviceId = createContextServiceId(); // final var expectedDeviceIdUuid1 = // serializer.serializeUuid("20db867c-772d-4872-9179-244ecafb3257"); // final var expectedDeviceId1 = // // ContextOuterClass.DeviceId.newBuilder().setDeviceUuid(expectedDeviceIdUuid1).build(); // final var deviceIds = List.of(expectedDeviceId1); // final var policyRuleService = // Policy.PolicyRuleService.newBuilder() // .setPolicyRuleBasic(policyRuleBasic) // .setServiceId(serviceId) // .addAllDeviceList(deviceIds) // .build(); // client // .policyAddService(policyRuleService) // .subscribe() // .with(policyRuleState -> // message.complete(policyRuleState.getPolicyRuleState().toString())); // assertThat(message.get(5, TimeUnit.SECONDS)) // .isEqualTo(expectedPolicyRuleState.getPolicyRuleState().toString()); // } // @Test // void shouldAddPolicyDevice() throws ExecutionException, InterruptedException, TimeoutException // { // CompletableFuture<String> message = new CompletableFuture<>(); // final var expectedDeviceIdUuid1 = // serializer.serializeUuid("20db867c-772d-4872-9179-244ecafb3257"); // final var expectedDeviceIdUuid2 = // serializer.serializeUuid("095974ac-d757-412d-b317-bcf355220aa9"); // final var expectedDeviceId1 = // // ContextOuterClass.DeviceId.newBuilder().setDeviceUuid(expectedDeviceIdUuid1).build(); // final var expectedDeviceId2 = // // ContextOuterClass.DeviceId.newBuilder().setDeviceUuid(expectedDeviceIdUuid2).build(); // final var policyRuleBasic = createPolicyRuleBasic(); // final var deviceIds = List.of(expectedDeviceId1, expectedDeviceId2); // final var expectedPolicyRuleState = policyRuleBasic.getPolicyRuleState(); // final var policyRuleDevice = // Policy.PolicyRuleDevice.newBuilder() // .setPolicyRuleBasic(policyRuleBasic) // .addAllDeviceList(deviceIds) // .build(); // client // .policyAddDevice(policyRuleDevice) // .subscribe() // .with(policyRuleState -> // message.complete(policyRuleState.getPolicyRuleState().toString())); // assertThat(message.get(5, TimeUnit.SECONDS)) // .isEqualTo(expectedPolicyRuleState.getPolicyRuleState().toString()); // } @Test void shouldUpdatePolicyServiceReturnFailedState() throws ExecutionException, InterruptedException, TimeoutException { CompletableFuture<String> message = new CompletableFuture<>(); final var expectedPolicyRuleState = Policy.PolicyRuleState.newBuilder() .setPolicyRuleState(PolicyRuleStateEnum.POLICY_FAILED) .build(); final var policyRuleBasic = PolicyRuleBasic.newBuilder().setPolicyRuleState(expectedPolicyRuleState).build(); final var policyRuleService = Policy.PolicyRuleService.newBuilder().setPolicyRuleBasic(policyRuleBasic).build(); client .policyUpdateService(policyRuleService) .subscribe() .with(policyRuleState -> message.complete(policyRuleState.getPolicyRuleState().toString())); assertThat(message.get(5, TimeUnit.SECONDS)) .isEqualTo(expectedPolicyRuleState.getPolicyRuleState().toString()); } @Test void shouldUpdatePolicyDeviceReturnFailedState() throws ExecutionException, InterruptedException, TimeoutException { CompletableFuture<String> message = new CompletableFuture<>(); final var expectedDeviceIdUuid = serializer.serializeUuid("20db867c-772d-4872-9179-244ecafb3257"); final var expectedDeviceId = ContextOuterClass.DeviceId.newBuilder().setDeviceUuid(expectedDeviceIdUuid).build(); final var expectedPolicyRuleState = Policy.PolicyRuleState.newBuilder() .setPolicyRuleState(PolicyRuleStateEnum.POLICY_FAILED) .build(); final var policyRuleBasic = PolicyRuleBasic.newBuilder().setPolicyRuleState(expectedPolicyRuleState).build(); final var deviceIds = List.of(expectedDeviceId); final var policyRuleDevice = Policy.PolicyRuleDevice.newBuilder() .setPolicyRuleBasic(policyRuleBasic) .addAllDeviceList(deviceIds) .build(); client .policyUpdateDevice(policyRuleDevice) .subscribe() .with(policyRuleState -> message.complete(policyRuleState.getPolicyRuleState().toString())); assertThat(message.get(5, TimeUnit.SECONDS)) .isEqualTo(expectedPolicyRuleState.getPolicyRuleState().toString()); } // TODO: Disable shouldDeletePolicy test until mock context service // @Test // void shouldDeletePolicy() throws ExecutionException, InterruptedException, TimeoutException // { // CompletableFuture<String> message = new CompletableFuture<>(); // final var uuid = // ContextOuterClass.Uuid.newBuilder() // // .setUuid(UUID.fromString("0f14d0ab-9608-7862-a9e4-5ed26688389b").toString()) // .build(); // final var policyRuleId = Policy.PolicyRuleId.newBuilder().setUuid(uuid).build(); // final var expectedPolicyRuleState = // Policy.PolicyRuleState.newBuilder() // .setPolicyRuleState(PolicyRuleStateEnum.POLICY_REMOVED) // .build(); // client // .policyDelete(policyRuleId) // .subscribe() // .with(policyRuleState -> // message.complete(policyRuleState.getPolicyRuleState().toString())); // assertThat(message.get(5, TimeUnit.SECONDS)) // .isEqualTo(expectedPolicyRuleState.getPolicyRuleState().toString()); // } @Test void shouldGetPolicyService() throws ExecutionException, InterruptedException, TimeoutException { CompletableFuture<String> message = new CompletableFuture<>(); Loading
src/policy/target/kubernetes/kubernetes.yml +8 −8 Original line number Diff line number Diff line Loading @@ -3,8 +3,8 @@ apiVersion: v1 kind: Service metadata: annotations: app.quarkus.io/commit-id: eb5af5697ca52e97a05476854dd7effb3bfa2d6b app.quarkus.io/build-timestamp: 2026-02-18 - 12:55:59 +0000 app.quarkus.io/commit-id: 155740d65d2f670ef76fe6219bbd3ca6422db18a app.quarkus.io/build-timestamp: 2026-02-18 - 13:48:37 +0000 prometheus.io/scrape: "true" prometheus.io/path: /q/metrics prometheus.io/port: "8080" Loading Loading @@ -33,8 +33,8 @@ apiVersion: apps/v1 kind: Deployment metadata: annotations: app.quarkus.io/commit-id: eb5af5697ca52e97a05476854dd7effb3bfa2d6b app.quarkus.io/build-timestamp: 2026-02-18 - 12:55:59 +0000 app.quarkus.io/commit-id: 155740d65d2f670ef76fe6219bbd3ca6422db18a app.quarkus.io/build-timestamp: 2026-02-18 - 13:48:37 +0000 prometheus.io/scrape: "true" prometheus.io/path: /q/metrics prometheus.io/port: "8080" Loading @@ -53,8 +53,8 @@ spec: template: metadata: annotations: app.quarkus.io/commit-id: eb5af5697ca52e97a05476854dd7effb3bfa2d6b app.quarkus.io/build-timestamp: 2026-02-18 - 12:55:59 +0000 app.quarkus.io/commit-id: 155740d65d2f670ef76fe6219bbd3ca6422db18a app.quarkus.io/build-timestamp: 2026-02-18 - 13:48:37 +0000 prometheus.io/scrape: "true" prometheus.io/path: /q/metrics prometheus.io/port: "8080" Loading @@ -71,12 +71,12 @@ spec: valueFrom: fieldRef: fieldPath: metadata.namespace - name: CONTEXT_SERVICE_HOST value: contextservice - name: SERVICE_SERVICE_HOST value: serviceservice - name: MONITORING_SERVICE_HOST value: monitoringservice - name: CONTEXT_SERVICE_HOST value: contextservice - name: KAFKA_BROKER_HOST value: kafka-service.kafka.svc.cluster.local image: labs.etsi.org:5050/tfs/controller/policy:0.1.0 Loading