From f2ec090ab0dcf94b4de42740c88d1334daa4bcbd Mon Sep 17 00:00:00 2001 From: Aboubakar Date: Tue, 24 Sep 2024 09:39:27 +0200 Subject: [PATCH 1/7] Replace @NotBlank by @NotNull for diagram in AIConversationRecord.java --- .../ditrit/letomodelizerapi/model/ai/AIConversationRecord.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/ditrit/letomodelizerapi/model/ai/AIConversationRecord.java b/src/main/java/com/ditrit/letomodelizerapi/model/ai/AIConversationRecord.java index 8e09e466..9e104e94 100644 --- a/src/main/java/com/ditrit/letomodelizerapi/model/ai/AIConversationRecord.java +++ b/src/main/java/com/ditrit/letomodelizerapi/model/ai/AIConversationRecord.java @@ -17,7 +17,7 @@ */ public record AIConversationRecord( @NotBlank String project, - @NotBlank String diagram, + @NotNull String diagram, @NotBlank String plugin, String checksum, @NotNull List files From 2a166348d5db56b75c96653f632acc1342ccc288 Mon Sep 17 00:00:00 2001 From: Aboubakar Date: Tue, 24 Sep 2024 09:40:39 +0200 Subject: [PATCH 2/7] Create AIMessageRecord --- .../model/ai/AIMessageRecord.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/main/java/com/ditrit/letomodelizerapi/model/ai/AIMessageRecord.java diff --git a/src/main/java/com/ditrit/letomodelizerapi/model/ai/AIMessageRecord.java b/src/main/java/com/ditrit/letomodelizerapi/model/ai/AIMessageRecord.java new file mode 100644 index 00000000..0de30056 --- /dev/null +++ b/src/main/java/com/ditrit/letomodelizerapi/model/ai/AIMessageRecord.java @@ -0,0 +1,15 @@ +package com.ditrit.letomodelizerapi.model.ai; + +import jakarta.validation.constraints.NotBlank; + +/** + * A record representing the data required to create a new conversation with AI. + * + * @param message Message to send to AI. Cannot be blank. + * @param plugin The name of the plugin involved in the conversation. Cannot be blank. + */ +public record AIMessageRecord( + @NotBlank String message, + @NotBlank String plugin +) { +} From c384d6e34382b4302a67249249465bca71f417be Mon Sep 17 00:00:00 2001 From: Aboubakar Date: Tue, 24 Sep 2024 09:42:27 +0200 Subject: [PATCH 3/7] Fix bugs in AiServiceImpl and use AiMessageRecord Bugs fixed: - Fixed URI endpoint /api/api to /api in sendRequest() - Fixed endpoint from /chat to /message - Add missing "pluginName" param in body for in sendFiles() - By adding AiMessageRecord, fix missing param in sendMessage() --- README.md | 2 +- .../letomodelizerapi/config/Constants.java | 10 ++++++ .../letomodelizerapi/service/AIService.java | 5 +-- .../service/AIServiceImpl.java | 35 ++++++++++--------- .../service/AIServiceImplTest.java | 5 +-- src/test/resources/ai/index.php | 2 +- src/test/resources/features/AI.feature | 7 ++-- 7 files changed, 40 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index e1d3f516..adc5eebb 100644 --- a/README.md +++ b/README.md @@ -275,7 +275,7 @@ LETO_ADMIN_URL=http://localhost:9000/ LIBRARY_HOST_WHITELIST=https://github.com/ditrit/ CSRF_TOKEN_TIMEOUT=3600 USER_SESSION_TIMEOUT=3600 -AI_HOST=http://locahost:8585/api/ +AI_HOST=http://locahost:8585/ ``` See Configuration section for more details. diff --git a/src/main/java/com/ditrit/letomodelizerapi/config/Constants.java b/src/main/java/com/ditrit/letomodelizerapi/config/Constants.java index f657c909..c457b772 100644 --- a/src/main/java/com/ditrit/letomodelizerapi/config/Constants.java +++ b/src/main/java/com/ditrit/letomodelizerapi/config/Constants.java @@ -36,6 +36,16 @@ public final class Constants { */ public static final String DEFAULT_UPDATE_DATE_PROPERTY = "updateDate"; + /** + * The constant representing the default message property. + */ + public static final String DEFAULT_MESSAGE_PROPERTY = "message"; + + /** + * The constant representing the default plugin name property. + */ + public static final String DEFAULT_PLUGIN_NAME_PROPERTY = "pluginName"; + /** * Private constructor. */ diff --git a/src/main/java/com/ditrit/letomodelizerapi/service/AIService.java b/src/main/java/com/ditrit/letomodelizerapi/service/AIService.java index 7f3cf416..1067b37f 100644 --- a/src/main/java/com/ditrit/letomodelizerapi/service/AIService.java +++ b/src/main/java/com/ditrit/letomodelizerapi/service/AIService.java @@ -2,6 +2,7 @@ import com.ditrit.letomodelizerapi.model.ai.AIConversationRecord; import com.ditrit.letomodelizerapi.model.ai.AICreateFileRecord; +import com.ditrit.letomodelizerapi.model.ai.AIMessageRecord; import com.ditrit.letomodelizerapi.persistence.model.AIConversation; import com.ditrit.letomodelizerapi.persistence.model.AIMessage; import com.ditrit.letomodelizerapi.persistence.model.User; @@ -80,11 +81,11 @@ AIConversation updateConversationById(User user, UUID id, AIConversationRecord a * * @param user the user sending the message. * @param id the ID of the conversation to which the message is sent. - * @param message the content of the message to be sent. + * @param aiMessage the record that contains the message to be sent. * @return the AI's response to the message. * @throws JsonProcessingException if there is an error processing the JSON data. */ - AIMessage sendMessage(User user, UUID id, String message) throws IOException; + AIMessage sendMessage(User user, UUID id, AIMessageRecord aiMessage) throws IOException; /** * Finds all AI conversations for a user with optional filtering and pagination. diff --git a/src/main/java/com/ditrit/letomodelizerapi/service/AIServiceImpl.java b/src/main/java/com/ditrit/letomodelizerapi/service/AIServiceImpl.java index adc96810..70a0f3ee 100644 --- a/src/main/java/com/ditrit/letomodelizerapi/service/AIServiceImpl.java +++ b/src/main/java/com/ditrit/letomodelizerapi/service/AIServiceImpl.java @@ -3,6 +3,7 @@ import com.ditrit.letomodelizerapi.config.Constants; import com.ditrit.letomodelizerapi.model.ai.AIConversationRecord; import com.ditrit.letomodelizerapi.model.ai.AICreateFileRecord; +import com.ditrit.letomodelizerapi.model.ai.AIMessageRecord; import com.ditrit.letomodelizerapi.model.error.ApiException; import com.ditrit.letomodelizerapi.model.error.ErrorType; import com.ditrit.letomodelizerapi.model.file.FileRecord; @@ -109,7 +110,6 @@ public String sendRequest(final String endpoint, final String body) { .uri(uri) .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .headers(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON) - .version(HttpClient.Version.HTTP_1_1) .POST(HttpRequest.BodyPublishers.ofString(body)) .build(); @@ -158,11 +158,10 @@ public String sendFiles(final AIConversation conversation, final List new ApiException(ErrorType.ENTITY_NOT_FOUND, "id", id.toString())); - byte[] compressedMessage = compress(message); - Long size = conversation.getSize() + compressedMessage.length; + byte[] compressedMessage = compress(aiMessage.message()); + long size = conversation.getSize() + compressedMessage.length; AIMessage userMessage = new AIMessage(); userMessage.setAiConversation(conversation.getId()); @@ -267,24 +266,26 @@ public AIMessage sendMessage(final User user, final UUID id, final String messag ObjectNode json = JsonNodeFactory.instance.objectNode(); json.put(Constants.DEFAULT_CONTEXT_PROPERTY, conversation.getContext()); - json.put("message", message); + json.put(Constants.DEFAULT_MESSAGE_PROPERTY, aiMessage.message()); + json.put(Constants.DEFAULT_PLUGIN_NAME_PROPERTY, aiMessage.plugin()); - JsonNode response = new ObjectMapper().readTree(sendRequest("chat", json.toString())); + JsonNode response = new ObjectMapper() + .readTree(sendRequest(Constants.DEFAULT_MESSAGE_PROPERTY, json.toString())); - compressedMessage = compress(response.get("message").asText()); + compressedMessage = compress(response.get(Constants.DEFAULT_MESSAGE_PROPERTY).asText()); size += compressedMessage.length; - AIMessage aiMessage = new AIMessage(); - aiMessage.setAiConversation(conversation.getId()); - aiMessage.setIsUser(false); - aiMessage.setMessage(compressedMessage); - aiMessage = aiMessageRepository.save((aiMessage)); + AIMessage aiMessageResponse = new AIMessage(); + aiMessageResponse.setAiConversation(conversation.getId()); + aiMessageResponse.setIsUser(false); + aiMessageResponse.setMessage(compressedMessage); + aiMessageResponse = aiMessageRepository.save((aiMessageResponse)); conversation.setContext(response.get(Constants.DEFAULT_CONTEXT_PROPERTY).asText()); conversation.setSize(size); aiConversationRepository.save(conversation); - return aiMessage; + return aiMessageResponse; } @Override diff --git a/src/test/java/com/ditrit/letomodelizerapi/service/AIServiceImplTest.java b/src/test/java/com/ditrit/letomodelizerapi/service/AIServiceImplTest.java index 81ea02c2..1263e69c 100644 --- a/src/test/java/com/ditrit/letomodelizerapi/service/AIServiceImplTest.java +++ b/src/test/java/com/ditrit/letomodelizerapi/service/AIServiceImplTest.java @@ -2,6 +2,7 @@ import com.ditrit.letomodelizerapi.model.ai.AIConversationRecord; import com.ditrit.letomodelizerapi.model.ai.AICreateFileRecord; +import com.ditrit.letomodelizerapi.model.ai.AIMessageRecord; import com.ditrit.letomodelizerapi.model.error.ApiException; import com.ditrit.letomodelizerapi.model.error.ErrorType; import com.ditrit.letomodelizerapi.persistence.model.AIConversation; @@ -365,7 +366,7 @@ void testSendMessage() throws IOException, InterruptedException { User user = new User(); user.setId(UUID.randomUUID()); - AIMessage message = service.sendMessage(user, UUID.randomUUID(), "ok"); + AIMessage message = service.sendMessage(user, UUID.randomUUID(), new AIMessageRecord("ok", "plugin")); assertEquals(message, expectedMessage); @@ -384,7 +385,7 @@ void testSendMessageThrowException() throws IOException { ApiException exception = null; try { - service.sendMessage(user, UUID.randomUUID(), "test"); + service.sendMessage(user, UUID.randomUUID(), new AIMessageRecord("test", "plugin")); } catch (ApiException e) { exception = e; } diff --git a/src/test/resources/ai/index.php b/src/test/resources/ai/index.php index 2c8c2a82..47fdd2fd 100644 --- a/src/test/resources/ai/index.php +++ b/src/test/resources/ai/index.php @@ -11,7 +11,7 @@ error_log($type); error_log(file_get_contents('php://input')); -if ($type == "chat") { +if ($type == "message") { $contextValue = isset($requestBody["context"]) ? (int) $requestBody["context"] : 0; $data = [ "context" =>1 + $contextValue, diff --git a/src/test/resources/features/AI.feature b/src/test/resources/features/AI.feature index 257b8517..fae4e26e 100644 --- a/src/test/resources/features/AI.feature +++ b/src/test/resources/features/AI.feature @@ -45,9 +45,10 @@ Feature: ai feature And I extract resources from response And I expect one resource contains "id" equals to "[conversation_id]" - When I request "/ai/conversations/[conversation_id]/messages" with method "POST" with body - | body | type | - | test | String | + When I request "/ai/conversations/[conversation_id]/messages" with method "POST" with json + | key | value | type | + | message | TEST | string | + | plugin | @ditrit/terrator-plugin | string | Then I expect "201" as status code And I expect response fields length is "5" And I expect response field "id" is "NOT_NULL" From 69ae88b112bcd7f455553b118acdb71517037b51 Mon Sep 17 00:00:00 2001 From: Aboubakar Date: Tue, 24 Sep 2024 09:51:30 +0200 Subject: [PATCH 4/7] Update createConversationMessage() with AiMessageRecord in AiController --- .../ditrit/letomodelizerapi/controller/AIController.java | 7 ++++--- .../letomodelizerapi/controller/AIControllerTest.java | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/ditrit/letomodelizerapi/controller/AIController.java b/src/main/java/com/ditrit/letomodelizerapi/controller/AIController.java index 698acbf3..3091d0a2 100644 --- a/src/main/java/com/ditrit/letomodelizerapi/controller/AIController.java +++ b/src/main/java/com/ditrit/letomodelizerapi/controller/AIController.java @@ -7,6 +7,7 @@ import com.ditrit.letomodelizerapi.model.ai.AIConversationRecord; import com.ditrit.letomodelizerapi.model.ai.AICreateFileRecord; import com.ditrit.letomodelizerapi.model.ai.AIMessageDTO; +import com.ditrit.letomodelizerapi.model.ai.AIMessageRecord; import com.ditrit.letomodelizerapi.model.mapper.ai.AIMessageToDTOMapper; import com.ditrit.letomodelizerapi.model.permission.ActionPermission; import com.ditrit.letomodelizerapi.model.permission.EntityPermission; @@ -237,7 +238,7 @@ public Response deleteConversationById(final @Context HttpServletRequest request * * @param request the HttpServletRequest used to access the user's session. * @param id the ID of the AI conversation to which the message is sent. - * @param message the content of the message to send to the AI. + * @param aiMessage the record that contains the message to send to the AI. * @return a Response object containing the AI's reply in plain text with a status of CREATED (201). * @throws JsonProcessingException if there is an error processing the request data. */ @@ -245,14 +246,14 @@ public Response deleteConversationById(final @Context HttpServletRequest request @Path("/conversations/{id}/messages") public Response createConversationMessage(final @Context HttpServletRequest request, final @PathParam("id") @Valid @NotNull UUID id, - final @Valid @NotNull String message) throws IOException { + final @Valid AIMessageRecord aiMessage) throws IOException { HttpSession session = request.getSession(); User user = userService.getFromSession(session); log.info("[{}] Received POST request to send message to conversation id {}", user.getLogin(), id.toString()); - AIMessageDTO aiMessageDTO = new AIMessageToDTOMapper().apply(aiService.sendMessage(user, id, message)); + AIMessageDTO aiMessageDTO = new AIMessageToDTOMapper().apply(aiService.sendMessage(user, id, aiMessage)); return Response.status(HttpStatus.CREATED.value()).entity(aiMessageDTO).build(); } diff --git a/src/test/java/com/ditrit/letomodelizerapi/controller/AIControllerTest.java b/src/test/java/com/ditrit/letomodelizerapi/controller/AIControllerTest.java index 43d877af..b73e408d 100644 --- a/src/test/java/com/ditrit/letomodelizerapi/controller/AIControllerTest.java +++ b/src/test/java/com/ditrit/letomodelizerapi/controller/AIControllerTest.java @@ -4,6 +4,7 @@ import com.ditrit.letomodelizerapi.helper.MockHelper; import com.ditrit.letomodelizerapi.model.ai.AIConversationRecord; import com.ditrit.letomodelizerapi.model.ai.AICreateFileRecord; +import com.ditrit.letomodelizerapi.model.ai.AIMessageRecord; import com.ditrit.letomodelizerapi.persistence.model.AIConversation; import com.ditrit.letomodelizerapi.persistence.model.AIMessage; import com.ditrit.letomodelizerapi.persistence.model.User; @@ -217,7 +218,7 @@ void testCreateConversationMessage() throws IOException { Mockito.when(userService.getFromSession(Mockito.any())).thenReturn(user); Mockito.when(aiService.sendMessage(Mockito.any(), Mockito.any(), Mockito.any())).thenReturn(message); - Response response = this.controller.createConversationMessage(request, UUID.randomUUID(), "ok"); + Response response = this.controller.createConversationMessage(request, UUID.randomUUID(), new AIMessageRecord("ok", "plugin")); assertNotNull(response); assertEquals(HttpStatus.CREATED.value(), response.getStatus()); From 0d9fec25efcc4dadf5567436c9e4b0ec940f001d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vincent=20Moitti=C3=A9?= Date: Thu, 26 Sep 2024 10:18:49 +0200 Subject: [PATCH 5/7] Add missing sort options in LibraryService --- .../ditrit/letomodelizerapi/service/LibraryServiceImpl.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/ditrit/letomodelizerapi/service/LibraryServiceImpl.java b/src/main/java/com/ditrit/letomodelizerapi/service/LibraryServiceImpl.java index cf69e8c7..e5be10cf 100644 --- a/src/main/java/com/ditrit/letomodelizerapi/service/LibraryServiceImpl.java +++ b/src/main/java/com/ditrit/letomodelizerapi/service/LibraryServiceImpl.java @@ -353,7 +353,7 @@ public Page findAll(final User user, final Map immutabl return userLibraryViewRepository.findAll( new SpecificationHelper<>(UserLibraryView.class, filters), - PageRequest.of(pageable.getPageNumber(), pageable.getPageSize()) + PageRequest.of(pageable.getPageNumber(), pageable.getPageSize(), pageable.getSort()) ).map(new UserLibraryViewToLibraryFunction()); } @@ -361,7 +361,7 @@ public Page findAll(final User user, final Map immutabl public Page findAllTemplates(final Map filters, final Pageable pageable) { return libraryTemplateRepository.findAll( new SpecificationHelper<>(LibraryTemplate.class, filters), - PageRequest.of(pageable.getPageNumber(), pageable.getPageSize()) + PageRequest.of(pageable.getPageNumber(), pageable.getPageSize(), pageable.getSort()) ); } @@ -372,7 +372,7 @@ public Page findAllTemplates(final User user, return userLibraryTemplateViewRepository.findAllByUserId( user.getId(), new SpecificationHelper<>(UserLibraryTemplateView.class, filters), - PageRequest.of(pageable.getPageNumber(), pageable.getPageSize()) + PageRequest.of(pageable.getPageNumber(), pageable.getPageSize(), pageable.getSort()) ).map(new UserLibraryTemplateViewToLibraryTemplateFunction()); } From 54429316689b126683e8321f3a1456983d651056 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vincent=20Moitti=C3=A9?= Date: Thu, 26 Sep 2024 10:20:41 +0200 Subject: [PATCH 6/7] Update default testing library files --- src/test/resources/features/Library.feature | 4 +- .../libraries/valid/simple/index.json | 396 +++++++++++++++++- .../libraries/valid/simple/infra/diagram.svg | 1 + .../libraries/valid/simple/infra/main.tf | 2 +- 4 files changed, 394 insertions(+), 9 deletions(-) create mode 100644 src/test/resources/libraries/valid/simple/infra/diagram.svg diff --git a/src/test/resources/features/Library.feature b/src/test/resources/features/Library.feature index ccc37367..7beb44c9 100644 --- a/src/test/resources/features/Library.feature +++ b/src/test/resources/features/Library.feature @@ -130,8 +130,8 @@ Feature: Library feature # Check if library templates are created When I request "/libraries/templates" with method "GET" - Then I expect "200" as status code - And I expect response field "totalElements" is "3" as "number" + Then I expect "206" as status code + And I expect response field "totalElements" is "33" as "number" # Delete library When I request "/libraries/[libraryId]" with method "DELETE" diff --git a/src/test/resources/libraries/valid/simple/index.json b/src/test/resources/libraries/valid/simple/index.json index 0ae26d85..cf4b7a49 100644 --- a/src/test/resources/libraries/valid/simple/index.json +++ b/src/test/resources/libraries/valid/simple/index.json @@ -6,12 +6,12 @@ "icon": "icon.svg", "templates": [ { - "name": "Template of project", + "name": "Template of project 01", "type": "PROJECT", "description": "Project template example.", "documentationUrl": "doc url", "basePath": "", - "plugins": ["terrator-plugin", "githubator-plugin"], + "plugins": ["@ditrit/terrator-plugin", "@ditrit/githubator-plugin"], "icon": "project.svg", "schemas": [ ".github/workflows/schema.svg", @@ -23,23 +23,407 @@ ] }, { - "name": "Template of diagram", + "name": "Template of project 02", + "type": "PROJECT", + "description": "Project template example.", + "documentationUrl": "doc url", + "basePath": "", + "plugins": ["@ditrit/terrator-plugin", "@ditrit/githubator-plugin"], + "icon": "project.svg", + "schemas": [ + ".github/workflows/schema.svg", + "infra/schema.svg" + ], + "files": [ + ".github/workflows/CI.yml", + "infra/main.tf" + ] + }, + { + "name": "Template of project 03", + "type": "PROJECT", + "description": "Project template example.", + "documentationUrl": "doc url", + "basePath": "", + "plugins": ["@ditrit/terrator-plugin", "@ditrit/githubator-plugin"], + "icon": "project.svg", + "schemas": [ + ".github/workflows/schema.svg", + "infra/schema.svg" + ], + "files": [ + ".github/workflows/CI.yml", + "infra/main.tf" + ] + }, + { + "name": "Template of project 04", + "type": "PROJECT", + "description": "Project template example.", + "documentationUrl": "doc url", + "basePath": "", + "plugins": ["@ditrit/terrator-plugin", "@ditrit/githubator-plugin"], + "icon": "project.svg", + "schemas": [ + ".github/workflows/schema.svg", + "infra/schema.svg" + ], + "files": [ + ".github/workflows/CI.yml", + "infra/main.tf" + ] + }, + { + "name": "Template of project 05", + "type": "PROJECT", + "description": "Project template example.", + "documentationUrl": "doc url", + "basePath": "", + "plugins": ["@ditrit/terrator-plugin", "@ditrit/githubator-plugin"], + "icon": "project.svg", + "schemas": [ + ".github/workflows/schema.svg", + "infra/schema.svg" + ], + "files": [ + ".github/workflows/CI.yml", + "infra/main.tf" + ] + }, + { + "name": "Template of project 06", + "type": "PROJECT", + "description": "Project template example.", + "documentationUrl": "doc url", + "basePath": "", + "plugins": ["@ditrit/terrator-plugin", "@ditrit/githubator-plugin"], + "icon": "project.svg", + "schemas": [ + ".github/workflows/schema.svg", + "infra/schema.svg" + ], + "files": [ + ".github/workflows/CI.yml", + "infra/main.tf" + ] + }, + { + "name": "Template of project 07", + "type": "PROJECT", + "description": "Project template example.", + "documentationUrl": "doc url", + "basePath": "", + "plugins": ["@ditrit/terrator-plugin", "@ditrit/githubator-plugin"], + "icon": "project.svg", + "schemas": [ + ".github/workflows/schema.svg", + "infra/schema.svg" + ], + "files": [ + ".github/workflows/CI.yml", + "infra/main.tf" + ] + }, + { + "name": "Template of project 08", + "type": "PROJECT", + "description": "Project template example.", + "documentationUrl": "doc url", + "basePath": "", + "plugins": ["@ditrit/terrator-plugin", "@ditrit/githubator-plugin"], + "icon": "project.svg", + "schemas": [ + ".github/workflows/schema.svg", + "infra/schema.svg" + ], + "files": [ + ".github/workflows/CI.yml", + "infra/main.tf" + ] + }, + { + "name": "Template of project 09", + "type": "PROJECT", + "description": "Project template example.", + "documentationUrl": "doc url", + "basePath": "", + "plugins": ["@ditrit/terrator-plugin", "@ditrit/githubator-plugin"], + "icon": "project.svg", + "schemas": [ + ".github/workflows/schema.svg", + "infra/schema.svg" + ], + "files": [ + ".github/workflows/CI.yml", + "infra/main.tf" + ] + }, + { + "name": "Template of project 10", + "type": "PROJECT", + "description": "Project template example.", + "documentationUrl": "doc url", + "basePath": "", + "plugins": ["@ditrit/terrator-plugin", "@ditrit/githubator-plugin"], + "icon": "project.svg", + "schemas": [ + ".github/workflows/schema.svg", + "infra/schema.svg" + ], + "files": [ + ".github/workflows/CI.yml", + "infra/main.tf" + ] + }, + { + "name": "Template of diagram 1", "type": "DIAGRAM", "description": "Diagram template example.", "documentationUrl": "doc url", "basePath": ".github/workflows/", - "plugin": "githubator-plugin", + "plugin": "@ditrit/githubator-plugin", "icon": "diagram.svg", "schemas": ["schema.svg"], "files": ["CI.yml"] }, { - "name": "Template of component", + "name": "Template of diagram 2", + "type": "DIAGRAM", + "description": "Diagram template example.", + "documentationUrl": "doc url", + "basePath": "infra/", + "plugin": "@ditrit/terrator-plugin", + "icon": "diagram.svg", + "schemas": ["schema.svg"], + "files": ["main.tf", "schema.svg"] + }, + { + "name": "Template of component 01", + "type": "COMPONENT", + "description": "Component template example.", + "documentationUrl": "doc url", + "basePath": "infra/", + "plugin": "@ditrit/terrator-plugin", + "icon": "component.svg", + "schemas": ["schema.svg"], + "files": ["main.tf"] + }, + { + "name": "Template of component 02", + "type": "COMPONENT", + "description": "Component template example.", + "documentationUrl": "doc url", + "basePath": "infra/", + "plugin": "@ditrit/terrator-plugin", + "icon": "component.svg", + "schemas": ["schema.svg"], + "files": ["main.tf"] + }, + { + "name": "Template of component 03", + "type": "COMPONENT", + "description": "Component template example.", + "documentationUrl": "doc url", + "basePath": "infra/", + "plugin": "@ditrit/terrator-plugin", + "icon": "component.svg", + "schemas": ["schema.svg"], + "files": ["main.tf"] + }, + { + "name": "Template of component 04", + "type": "COMPONENT", + "description": "Component template example.", + "documentationUrl": "doc url", + "basePath": "infra/", + "plugin": "@ditrit/terrator-plugin", + "icon": "component.svg", + "schemas": ["schema.svg"], + "files": ["main.tf"] + }, + { + "name": "Template of component 05", + "type": "COMPONENT", + "description": "Component template example.", + "documentationUrl": "doc url", + "basePath": "infra/", + "plugin": "@ditrit/terrator-plugin", + "icon": "component.svg", + "schemas": ["schema.svg"], + "files": ["main.tf"] + }, + { + "name": "Template of component 06", + "type": "COMPONENT", + "description": "Component template example.", + "documentationUrl": "doc url", + "basePath": "infra/", + "plugin": "@ditrit/terrator-plugin", + "icon": "component.svg", + "schemas": ["schema.svg"], + "files": ["main.tf"] + }, + { + "name": "Template of component 07", + "type": "COMPONENT", + "description": "Component template example.", + "documentationUrl": "doc url", + "basePath": "infra/", + "plugin": "@ditrit/terrator-plugin", + "icon": "component.svg", + "schemas": ["schema.svg"], + "files": ["main.tf"] + }, + { + "name": "Template of component 08", + "type": "COMPONENT", + "description": "Component template example.", + "documentationUrl": "doc url", + "basePath": "infra/", + "plugin": "@ditrit/terrator-plugin", + "icon": "component.svg", + "schemas": ["schema.svg"], + "files": ["main.tf"] + }, + { + "name": "Template of component 09", + "type": "COMPONENT", + "description": "Component template example.", + "documentationUrl": "doc url", + "basePath": "infra/", + "plugin": "@ditrit/terrator-plugin", + "icon": "component.svg", + "schemas": ["schema.svg"], + "files": ["main.tf"] + }, + { + "name": "Template of component 10", + "type": "COMPONENT", + "description": "Component template example.", + "documentationUrl": "doc url", + "basePath": "infra/", + "plugin": "@ditrit/terrator-plugin", + "icon": "component.svg", + "schemas": ["schema.svg"], + "files": ["main.tf"] + }, + { + "name": "Template of component 11", + "type": "COMPONENT", + "description": "Component template example.", + "documentationUrl": "doc url", + "basePath": "infra/", + "plugin": "@ditrit/terrator-plugin", + "icon": "component.svg", + "schemas": ["schema.svg"], + "files": ["main.tf"] + }, + { + "name": "Template of component 12", + "type": "COMPONENT", + "description": "Component template example.", + "documentationUrl": "doc url", + "basePath": "infra/", + "plugin": "@ditrit/terrator-plugin", + "icon": "component.svg", + "schemas": ["schema.svg"], + "files": ["main.tf"] + }, + { + "name": "Template of component 13", + "type": "COMPONENT", + "description": "Component template example.", + "documentationUrl": "doc url", + "basePath": "infra/", + "plugin": "@ditrit/terrator-plugin", + "icon": "component.svg", + "schemas": ["schema.svg"], + "files": ["main.tf"] + }, + { + "name": "Template of component 14", + "type": "COMPONENT", + "description": "Component template example.", + "documentationUrl": "doc url", + "basePath": "infra/", + "plugin": "@ditrit/terrator-plugin", + "icon": "component.svg", + "schemas": ["schema.svg"], + "files": ["main.tf"] + }, + { + "name": "Template of component 15", + "type": "COMPONENT", + "description": "Component template example.", + "documentationUrl": "doc url", + "basePath": "infra/", + "plugin": "@ditrit/terrator-plugin", + "icon": "component.svg", + "schemas": ["schema.svg"], + "files": ["main.tf"] + }, + { + "name": "Template of component 16", + "type": "COMPONENT", + "description": "Component template example.", + "documentationUrl": "doc url", + "basePath": "infra/", + "plugin": "@ditrit/terrator-plugin", + "icon": "component.svg", + "schemas": ["schema.svg"], + "files": ["main.tf"] + }, + { + "name": "Template of component 17", + "type": "COMPONENT", + "description": "Component template example.", + "documentationUrl": "doc url", + "basePath": "infra/", + "plugin": "@ditrit/terrator-plugin", + "icon": "component.svg", + "schemas": ["schema.svg"], + "files": ["main.tf"] + }, + { + "name": "Template of component 18", + "type": "COMPONENT", + "description": "Component template example.", + "documentationUrl": "doc url", + "basePath": "infra/", + "plugin": "@ditrit/terrator-plugin", + "icon": "component.svg", + "schemas": ["schema.svg"], + "files": ["main.tf"] + }, + { + "name": "Template of component 19", + "type": "COMPONENT", + "description": "Component template example.", + "documentationUrl": "doc url", + "basePath": "infra/", + "plugin": "@ditrit/terrator-plugin", + "icon": "component.svg", + "schemas": ["schema.svg"], + "files": ["main.tf"] + }, + { + "name": "Template of component 20", + "type": "COMPONENT", + "description": "Component template example.", + "documentationUrl": "doc url", + "basePath": "infra/", + "plugin": "@ditrit/terrator-plugin", + "icon": "component.svg", + "schemas": ["schema.svg"], + "files": ["main.tf"] + }, + { + "name": "Template of component 21", "type": "COMPONENT", "description": "Component template example.", "documentationUrl": "doc url", "basePath": "infra/", - "plugin": "terrator-plugin", + "plugin": "@ditrit/terrator-plugin", "icon": "component.svg", "schemas": ["schema.svg"], "files": ["main.tf"] diff --git a/src/test/resources/libraries/valid/simple/infra/diagram.svg b/src/test/resources/libraries/valid/simple/infra/diagram.svg new file mode 100644 index 00000000..b57e42e8 --- /dev/null +++ b/src/test/resources/libraries/valid/simple/infra/diagram.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/test/resources/libraries/valid/simple/infra/main.tf b/src/test/resources/libraries/valid/simple/infra/main.tf index 403158d7..77dc6f4d 100644 --- a/src/test/resources/libraries/valid/simple/infra/main.tf +++ b/src/test/resources/libraries/valid/simple/infra/main.tf @@ -1 +1 @@ -resource "aws_instance" "nginx" {} +resource "aws_instance" "{{ generateId('nginx_')}}" {} From 81d0409dc6ebb8d6c98e6a453338013daef16d02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vincent=20Moitti=C3=A9?= Date: Thu, 26 Sep 2024 11:56:31 +0200 Subject: [PATCH 7/7] Update dependencies --- build.gradle | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/build.gradle b/build.gradle index fb6b4a72..f7fdc44a 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,6 @@ plugins { id 'java' - id 'org.springframework.boot' version '3.3.3' + id 'org.springframework.boot' version '3.3.4' id 'io.spring.dependency-management' version '1.1.6' id 'checkstyle' id 'com.github.ben-manes.versions' version '0.51.0' @@ -45,18 +45,18 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter-security' implementation 'org.springframework.boot:spring-boot-starter-oauth2-client' implementation 'org.springframework.session:spring-session-jdbc:3.3.2' - implementation 'org.flywaydb:flyway-core:10.17.3' - implementation "org.flywaydb:flyway-database-postgresql:10.17.3" + implementation 'org.flywaydb:flyway-core:10.18.1' + implementation "org.flywaydb:flyway-database-postgresql:10.18.1" implementation 'commons-lang:commons-lang:2.6' implementation 'commons-beanutils:commons-beanutils:1.9.4' - implementation 'com.github.erosb:json-sKema:0.16.0' + implementation 'com.github.erosb:json-sKema:0.18.0' compileOnly 'org.projectlombok:lombok' runtimeOnly 'org.postgresql:postgresql:42.7.4' annotationProcessor 'org.projectlombok:lombok' testImplementation 'org.springframework.boot:spring-boot-starter-test' - testImplementation 'io.cucumber:cucumber-java:7.18.1' - testImplementation 'io.cucumber:cucumber-junit:7.18.1' - testImplementation 'org.junit.vintage:junit-vintage-engine:5.11.0' + testImplementation 'io.cucumber:cucumber-java:7.19.0' + testImplementation 'io.cucumber:cucumber-junit:7.19.0' + testImplementation 'org.junit.vintage:junit-vintage-engine:5.11.1' } tasks.named('test') {