Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
ElisKina-dev committed Jan 8, 2025
1 parent e874e75 commit 64bd538
Show file tree
Hide file tree
Showing 2 changed files with 136 additions and 137 deletions.
252 changes: 126 additions & 126 deletions openapi/generated.openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"description" : "the Broker API"
} ],
"paths" : {
"/brokers" : {
"/crud/brokers" : {
"get" : {
"tags" : [ "broker-entity-controller" ],
"description" : "get-broker",
Expand Down Expand Up @@ -102,7 +102,7 @@
}
}
},
"/brokers/search/findByOrgFiscalCode" : {
"/crud/brokers/search/findByOrgFiscalCode" : {
"get" : {
"tags" : [ "broker-search-controller" ],
"operationId" : "executeSearch-broker-get",
Expand Down Expand Up @@ -130,7 +130,7 @@
}
}
},
"/brokers/{id}" : {
"/crud/brokers/{id}" : {
"get" : {
"tags" : [ "broker-entity-controller" ],
"description" : "get-broker",
Expand Down Expand Up @@ -267,7 +267,7 @@
}
}
},
"/organizations" : {
"/crud/organizations" : {
"get" : {
"tags" : [ "organization-entity-controller" ],
"description" : "get-organization",
Expand Down Expand Up @@ -355,7 +355,7 @@
}
}
},
"/organizations/search/findByIpaCode" : {
"/crud/organizations/search/findByIpaCode" : {
"get" : {
"tags" : [ "organization-search-controller" ],
"operationId" : "executeSearch-organization-get",
Expand Down Expand Up @@ -383,7 +383,7 @@
}
}
},
"/organizations/{id}" : {
"/crud/organizations/{id}" : {
"get" : {
"tags" : [ "organization-entity-controller" ],
"description" : "get-organization",
Expand Down Expand Up @@ -520,7 +520,7 @@
}
}
},
"/profile" : {
"/crud/profile" : {
"get" : {
"tags" : [ "profile-controller" ],
"operationId" : "listAllFormsOfMetadata",
Expand All @@ -538,7 +538,7 @@
}
}
},
"/profile/brokers" : {
"/crud/profile/brokers" : {
"get" : {
"tags" : [ "profile-controller" ],
"operationId" : "descriptor",
Expand Down Expand Up @@ -566,7 +566,7 @@
}
}
},
"/profile/organizations" : {
"/crud/profile/organizations" : {
"get" : {
"tags" : [ "profile-controller" ],
"operationId" : "descriptor_1",
Expand Down Expand Up @@ -740,6 +740,122 @@
}
}
},
"PersonalisationFe" : {
"type" : "object",
"properties" : {
"headerAssistanceUrl" : {
"type" : "string"
},
"logoFooterImg" : {
"type" : "string"
},
"footerDescText" : {
"type" : "string"
},
"footerPrivacyInfoUrl" : {
"type" : "string"
},
"footerGDPRUrl" : {
"type" : "string"
},
"footerTermsCondUrl" : {
"type" : "string"
},
"footerAccessibilityUrl" : {
"type" : "string"
}
}
},
"EntityModelBroker" : {
"type" : "object",
"properties" : {
"brokerId" : {
"type" : "integer",
"format" : "int64"
},
"organizationId" : {
"type" : "integer",
"format" : "int64"
},
"brokerFiscalCode" : {
"type" : "string"
},
"brokerName" : {
"type" : "string"
},
"pagoPaInteractionModel" : {
"type" : "string",
"enum" : [ "SYNC", "SYNC_ACA", "SYNC$GPDPRELOAD", "SYNC_ACA$GPDPRELOAD", "ASYNC_GPD" ]
},
"stationId" : {
"type" : "string"
},
"broadcastStationId" : {
"type" : "string"
},
"syncKey" : {
"type" : "string",
"format" : "byte"
},
"gpdKey" : {
"type" : "string",
"format" : "byte"
},
"acaKey" : {
"type" : "string",
"format" : "byte"
},
"personalisationFe" : {
"$ref" : "#/components/schemas/PersonalisationFe"
},
"_links" : {
"$ref" : "#/components/schemas/Links"
}
}
},
"PageMetadata" : {
"type" : "object",
"properties" : {
"size" : {
"type" : "integer",
"format" : "int64"
},
"totalElements" : {
"type" : "integer",
"format" : "int64"
},
"totalPages" : {
"type" : "integer",
"format" : "int64"
},
"number" : {
"type" : "integer",
"format" : "int64"
}
}
},
"PagedModelEntityModelBroker" : {
"type" : "object",
"properties" : {
"_embedded" : {
"type" : "object",
"properties" : {
"brokers" : {
"type" : "array",
"items" : {
"$ref" : "#/components/schemas/EntityModelBroker"
}
}
}
},
"_links" : {
"$ref" : "#/components/schemas/Links"
},
"page" : {
"$ref" : "#/components/schemas/PageMetadata"
}
}
},
"EntityModelOrganization" : {
"type" : "object",
"properties" : {
Expand Down Expand Up @@ -853,34 +969,13 @@
}
}
},
"PageMetadata" : {
"type" : "object",
"properties" : {
"size" : {
"type" : "integer",
"format" : "int64"
},
"totalElements" : {
"type" : "integer",
"format" : "int64"
},
"totalPages" : {
"type" : "integer",
"format" : "int64"
},
"number" : {
"type" : "integer",
"format" : "int64"
}
}
},
"PagedModelEntityModelOrganization" : {
"type" : "object",
"properties" : {
"_embedded" : {
"type" : "object",
"properties" : {
"organization" : {
"organizations" : {
"type" : "array",
"items" : {
"$ref" : "#/components/schemas/EntityModelOrganization"
Expand All @@ -896,101 +991,6 @@
}
}
},
"EntityModelBroker" : {
"type" : "object",
"properties" : {
"brokerId" : {
"type" : "integer",
"format" : "int64"
},
"organizationId" : {
"type" : "integer",
"format" : "int64"
},
"brokerFiscalCode" : {
"type" : "string"
},
"brokerName" : {
"type" : "string"
},
"pagoPaInteractionModel" : {
"type" : "string",
"enum" : [ "SYNC", "SYNC_ACA", "SYNC$GPDPRELOAD", "SYNC_ACA$GPDPRELOAD", "ASYNC_GPD" ]
},
"stationId" : {
"type" : "string"
},
"broadcastStationId" : {
"type" : "string"
},
"syncKey" : {
"type" : "string",
"format" : "byte"
},
"gpdKey" : {
"type" : "string",
"format" : "byte"
},
"acaKey" : {
"type" : "string",
"format" : "byte"
},
"personalisationFe" : {
"$ref" : "#/components/schemas/PersonalisationFe"
},
"_links" : {
"$ref" : "#/components/schemas/Links"
}
}
},
"PagedModelEntityModelBroker" : {
"type" : "object",
"properties" : {
"_embedded" : {
"type" : "object",
"properties" : {
"broker" : {
"type" : "array",
"items" : {
"$ref" : "#/components/schemas/EntityModelBroker"
}
}
}
},
"_links" : {
"$ref" : "#/components/schemas/Links"
},
"page" : {
"$ref" : "#/components/schemas/PageMetadata"
}
}
},
"PersonalisationFe" : {
"type" : "object",
"properties" : {
"headerAssistanceUrl" : {
"type" : "string"
},
"logoFooterImg" : {
"type" : "string"
},
"footerDescText" : {
"type" : "string"
},
"footerPrivacyInfoUrl" : {
"type" : "string"
},
"footerGDPRUrl" : {
"type" : "string"
},
"footerTermsCondUrl" : {
"type" : "string"
},
"footerAccessibilityUrl" : {
"type" : "string"
}
}
},
"BrokerRequestBody" : {
"type" : "object",
"properties" : {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package it.gov.pagopa.pu.organization;

import org.json.JSONException;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down Expand Up @@ -39,27 +38,27 @@ class OpenApiGeneratorTest {
@Test
void generateAndVerifyCommit() throws Exception {
MvcResult result = mockMvc.perform(
get("/v3/api-docs")
.contentType(MediaType.APPLICATION_JSON)
.accept(MediaType.APPLICATION_JSON)
).andExpect(status().isOk())
get("/v3/api-docs")
.contentType(MediaType.APPLICATION_JSON)
.accept(MediaType.APPLICATION_JSON)
).andExpect(status().isOk())
.andReturn();

String openApiResult = result.getResponse().getContentAsString();
String openApiResult = result.getResponse().getContentAsString().replace("\r", "");
Assertions.assertTrue(openApiResult.startsWith("{\n \"openapi\" : \"3.0."));

Path openApiGeneratedPath = Path.of("openapi/generated.openapi.json");
boolean toStore=true;
if(Files.exists(openApiGeneratedPath)){
boolean toStore = true;
if (Files.exists(openApiGeneratedPath)) {
String storedOpenApi = Files.readString(openApiGeneratedPath);
try {
content().json(storedOpenApi, JsonCompareMode.STRICT).match(result);
toStore=false;
} catch (JSONException e){
toStore = false;
} catch (Throwable e) {
//Do Nothing
}
}
if(toStore){
if (toStore) {
Files.writeString(openApiGeneratedPath, openApiResult, StandardOpenOption.TRUNCATE_EXISTING);
}

Expand Down

0 comments on commit 64bd538

Please sign in to comment.