Skip to content

Commit

Permalink
Service inventory implementation (#42)
Browse files Browse the repository at this point in the history
* Base implementation of service-inventory

* Solving erros in Service and adding Event Subscription

* Adding testing and fixed some bugs

* Adding event handler compatibility

* Adding changes to pom

* Changed swagger URL for resource catalog

* testing on github

* Just to make test compile

* solving target commit

* Delete resource-catalog/.DS_Store

unwanted file

* Delete service-catalog/.DS_Store

unwanted file

* Changing pom so it ignore resource catalog

* Restoring pom

* Delete common/.DS_Store

unwanted file

* Removing target files

* Reverting changes to ServiceCategoryRef and commenting resource catalog pom for testing purposes

* Changes to href on ServiceCategoryRef

* Adding micronaut test to ServiceApiIT

* Debuging tests

* Debuging tests 2

* Debuging tests 3

* Debuging tests 4

* Debuging test 5

* Debuging test 6 service-inventory

* Enabling resrouce-catalog api

* Debuging tests resource-catalog 1

* Debuging resource-catalog tests 2

* Debuging test resource catalog 3

* Debuging resource catalog test 4

* solving conflicting elements

* Solving conflicting lanes with main

* Reverting unganted change to the application.yaml on service-catalog

* Changed pom api url and ctk url to new

* Solved problem with api url

* Checking tests on main

* New swagger api urls

* Changes on .github to run test on my repository

* Updating the service api url

* Adding a missing Junit notation

* Extra Junit notation unnintentional pushed in createBillPresentationMedia

* Changes to service inventory rest (unfinished)

* Solving EventHandler and test errors

* Adding Service Inventory to scorpio test workflow

* Debugging ServiceApiIT

* Second debuggin on ServiceApiIT

* Debug 3 ServiceApiIT

* Debug 3 ServiceApiIT

* Debug 4 updating ServiceApiIT, missing on the last commit

* Debug 5 ServiceApiIT
  • Loading branch information
mvazquezficodes authored Feb 7, 2024
1 parent 3499ebe commit dd084e4
Show file tree
Hide file tree
Showing 40 changed files with 2,393 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/test-brokers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:
push:
branches:
- tests
- ServiceInventory-Implementation

concurrency:
# Only cancel jobs for PR updates
Expand All @@ -23,7 +24,7 @@ jobs:
strategy:
fail-fast: false
matrix:
module: [ customer-bill-management, customer-management, party-catalog, party-role, product-catalog, product-inventory, product-ordering-management, resource-catalog, resource-function-activation, resource-inventory, service-catalog ]
module: [ customer-bill-management, customer-management, party-catalog, party-role, product-catalog, product-inventory, product-ordering-management, resource-catalog, resource-function-activation, resource-inventory, service-catalog, service-inventory ]
# only test scorpio for speed up, orion is currently not really used with the tmforum
broker: [ scorpio ]
cache: [ in-memory, redis ]
Expand Down
Empty file.
Empty file added .github/workflows/test.yaml
Empty file.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# FIWARE implementation of the TMFORUM-APIs

## Structure
## Structure


The project is setup as a maven multi-module project, to ease the development of independent implementations for each
API.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ public void listBillPresentationMedia200() throws Exception {
}

@Override
@Test
public void listBillPresentationMedia400() throws Exception {
HttpResponse<List<BillPresentationMediaVO>> badRequestResponse = callAndCatch(
() -> billPresentationMediaApiTestClient.listBillPresentationMedia(null, -1, null));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public class EventConstants {
public static final String DELETE_EVENT_SUFFIX = "DeleteEvent";
public static final String CHANGE_EVENT_SUFFIX = "ChangeEvent";
public static final String INFORMATION_REQUIRED_EVENT_SUFFIX = "InformationRequiredEvent";
public static final String EVENT_GROUP_SERVICE = "Service";

public static final Map<String, List<String>> ALLOWED_EVENT_TYPES = Map.ofEntries(
entry(EVENT_GROUP_PRODUCT, List.of(CREATE_EVENT_SUFFIX, ATTRIBUTE_VALUE_CHANGE_EVENT_SUFFIX,
Expand Down Expand Up @@ -130,6 +131,8 @@ public class EventConstants {
entry(EVENT_GROUP_PARTY_ACCOUNT, List.of(CREATE_EVENT_SUFFIX, CHANGE_EVENT_SUFFIX,
DELETE_EVENT_SUFFIX)),
entry(EVENT_GROUP_SETTLEMENT_ACCOUNT, List.of(CREATE_EVENT_SUFFIX, CHANGE_EVENT_SUFFIX,
DELETE_EVENT_SUFFIX)),
entry(EVENT_GROUP_SERVICE, List.of(CREATE_EVENT_SUFFIX, CHANGE_EVENT_SUFFIX,
DELETE_EVENT_SUFFIX))
);
}
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
<module>agreement</module>
<module>usage-management</module>
<module>account</module>
<module>service-inventory</module>
<module>party-role</module>
</modules>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import java.net.URI;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import java.net.URI;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import java.net.URI;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ private static Stream<ArgumentPair<FeatureSpecificationVO>> provideInvalidFeatur
.featureSpecRelationship(List.of(FeatureSpecificationRelationshipVOTestExample.build()
.featureId(null)
.parentSpecificationId("invalid")))));

invalidFeatureSpecs.add(
new ArgumentPair<>("Feature specification with non-existent resource id on spec rel should fail.",
FeatureSpecificationVOTestExample.build()
Expand Down
273 changes: 273 additions & 0 deletions service-inventory/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,273 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.fiware.tmforum</groupId>
<artifactId>service-inventory</artifactId>
<version>0.1</version>

<parent>
<groupId>org.fiware</groupId>
<artifactId>tmforum</artifactId>
<version>0.1</version>
</parent>

<properties>
<tmforum.api.url>https://tmf-open-api-table-documents.s3.eu-west-1.amazonaws.com/OpenApiTable/4.0.0/swagger/TMF638_Service_Inventory_Management_API_v4.0.0_swagger.json</tmforum.api.url>
<module.ctk.url>https://tmf-open-api-table-documents.s3.eu-west-1.amazonaws.com/OpenApiTable/4.0.0/ctk/TMF638-ServiceInventory_V4-0-0.zip</module.ctk.url>
<module.ctk.script-folder>TMF638-ServiceInventory</module.ctk.script-folder>
<module.ctk.run-script>Mac-Linux-RUNCTK.sh</module.ctk.run-script>
<module.ctk.base-path>/tmf-api/serviceInventoryManagement/v4</module.ctk.base-path>
<module.ctk.additionalCommands>sed -i 's/8633/8632/g' /opt/ctk/TMF638-ServiceInventory/config.json</module.ctk.additionalCommands>
</properties>

<dependencies>
<dependency>
<groupId>org.fiware.tmforum</groupId>
<artifactId>common</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.fiware.tmforum</groupId>
<artifactId>resource-shared-models</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.fiware.tmforum</groupId>
<artifactId>service-shared-models</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>

<!-- lazy dev -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
</dependency>

<!-- micronaut -->
<dependency>
<groupId>io.micronaut</groupId>
<artifactId>micronaut-inject</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.micronaut</groupId>
<artifactId>micronaut-validation</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.micronaut</groupId>
<artifactId>micronaut-runtime</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.micronaut</groupId>
<artifactId>micronaut-management</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.micronaut.cache</groupId>
<artifactId>micronaut-cache-caffeine</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.micronaut</groupId>
<artifactId>micronaut-http-client</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.micronaut</groupId>
<artifactId>micronaut-http-server-netty</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.micronaut</groupId>
<artifactId>micronaut-jackson-databind</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.micronaut</groupId>
<artifactId>micronaut-jackson-core</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.micronaut.reactor</groupId>
<artifactId>micronaut-reactor</artifactId>
<scope>compile</scope>
</dependency>

<!-- javax -->
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
</dependency>
<!-- required for javax.nullable -->
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>annotations</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<scope>compile</scope>
</dependency>

<!-- testing -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.micronaut.test</groupId>
<artifactId>micronaut-test-junit5</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.micronaut.test</groupId>
<artifactId>micronaut-test-core</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<testResources>
<testResource>
<directory>src/test/resources</directory>
<filtering>true</filtering>
</testResource>
</testResources>
<plugins>
<!-- generate api code -->
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>${version.org.openapitools.generator-maven-plugin}</version>
<executions>
<execution>
<id>openapi-service-inventory-api</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${tmforum.api.url}</inputSpec>
<apiPackage>org.fiware.serviceinventory.api</apiPackage>
<strictSpec>true</strictSpec>
<modelPackage>org.fiware.serviceinventory.model</modelPackage>
<generatorName>micronaut</generatorName>
<modelNameSuffix>VO</modelNameSuffix>
<output>${project.build.directory}</output>
<generateSupportingFiles>false</generateSupportingFiles>
<configOptions>
<fullJavaUtil>true</fullJavaUtil>
<useOptional>false</useOptional>
<useGenericResponse>true</useGenericResponse>
<useLombokGenerated>true</useLombokGenerated>
<introspected>true</introspected>
<useBeanValidation>false</useBeanValidation>
<supportAsync>true</supportAsync>
<jacksonDatabindNullable>false</jacksonDatabindNullable>
<generateExamples>true</generateExamples>
</configOptions>
<typeMappings>
<typeMapping>java.util.Date=java.time.Instant</typeMapping>
</typeMappings>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>io.kokuwa.micronaut</groupId>
<artifactId>micronaut-openapi-codegen</artifactId>
<version>${version.io.kokuwa.micronaut.codegen}</version>
</dependency>
</dependencies>
</plugin>
<!-- add generated sources -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
</plugin>

<!-- copy project dependencies -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
</plugin>
<!-- run tests -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
<plugin>
<groupId>io.kokuwa.maven</groupId>
<artifactId>k3s-maven-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
</plugin>

<!-- build image -->
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Loading

0 comments on commit dd084e4

Please sign in to comment.