use of org.wso2.identity.integration.test.rest.api.server.identity.governance.v1.dto.PropertyRes in project product-is by wso2.
the class IdentityGovernanceSuccessTest method testGetGovernanceConnector.
@Test
public void testGetGovernanceConnector() throws IOException {
for (Map.Entry<String, CategoriesRes> category : categories.entrySet()) {
String expectedResponse = readResource("get-category-" + category.getKey() + "-response.json");
ObjectMapper jsonWriter = new ObjectMapper(new JsonFactory());
List<ConnectorRes> connectorsList = jsonWriter.readValue(expectedResponse, CategoryRes.class).getConnectors();
Map<String, ConnectorRes> connectors = connectorsList.stream().collect(Collectors.toMap(ConnectorRes::getId, c -> c));
for (Map.Entry<String, ConnectorRes> connector : connectors.entrySet()) {
Response response = getResponseOfGet(IDENTITY_GOVERNANCE_ENDPOINT_URI + "/" + category.getKey() + "/connectors/" + connector.getKey());
ValidatableResponse validatableResponse = response.then().log().ifValidationFails().assertThat().statusCode(HttpStatus.SC_OK);
validatableResponse.body("id", equalTo(connector.getKey())).body("name", equalTo(connector.getValue().getName())).body("category", equalTo(connector.getValue().getCategory())).body("friendlyName", equalTo(connector.getValue().getFriendlyName())).body("order", equalTo(connector.getValue().getOrder())).body("subCategory", equalTo(connector.getValue().getSubCategory()));
Map<String, PropertyRes> properties = connector.getValue().getProperties().stream().collect(Collectors.toMap(PropertyRes::getName, c -> c));
for (Map.Entry<String, PropertyRes> property : properties.entrySet()) {
validatableResponse.body("properties.find{it.name == '" + property.getValue().getName() + "' }.displayName", equalTo(property.getValue().getDisplayName())).body("properties.find{it.name == '" + property.getValue().getName() + "' }.description", equalTo(property.getValue().getDescription()));
}
}
}
}
use of org.wso2.identity.integration.test.rest.api.server.identity.governance.v1.dto.PropertyRes in project product-is by wso2.
the class IdentityGovernanceSuccessTest method testGetGovernanceConnectorCategory.
@Test
public void testGetGovernanceConnectorCategory() throws IOException {
for (Map.Entry<String, CategoriesRes> category : categories.entrySet()) {
String expectedResponse = readResource("get-category-" + category.getKey() + "-response.json");
ObjectMapper jsonWriter = new ObjectMapper(new JsonFactory());
List<ConnectorRes> connectorsList = jsonWriter.readValue(expectedResponse, CategoryRes.class).getConnectors();
Map<String, ConnectorRes> connectors = connectorsList.stream().collect(Collectors.toMap(ConnectorRes::getId, c -> c));
Response response = getResponseOfGet(IDENTITY_GOVERNANCE_ENDPOINT_URI + "/" + category.getKey());
ValidatableResponse validatableResponse = response.then().log().ifValidationFails().assertThat().statusCode(HttpStatus.SC_OK);
for (Map.Entry<String, ConnectorRes> connector : connectors.entrySet()) {
validatableResponse.body("connectors.find{ it.id == '" + connector.getKey() + "' }.name", equalTo(connector.getValue().getName())).body("connectors.find{ it.id == '" + connector.getKey() + "' }.category", equalTo(connector.getValue().getCategory())).body("connectors.find{ it.id == '" + connector.getKey() + "' }.friendlyName", equalTo(connector.getValue().getFriendlyName())).body("connectors.find{ it.id == '" + connector.getKey() + "' }.order", equalTo(connector.getValue().getOrder())).body("connectors.find{ it.id == '" + connector.getKey() + "' }.subCategory", equalTo(connector.getValue().getSubCategory()));
Map<String, PropertyRes> properties = connector.getValue().getProperties().stream().collect(Collectors.toMap(PropertyRes::getName, c -> c));
for (Map.Entry<String, PropertyRes> property : properties.entrySet()) {
validatableResponse.body("connectors.find{ it.id == '" + connector.getKey() + "' }.properties.find{it.name " + "== '" + property.getValue().getName() + "' }.displayName", equalTo(property.getValue().getDisplayName())).body("connectors.find{ it.id == '" + connector.getKey() + "' }.properties.find{it.name " + "== '" + property.getValue().getName() + "' }.description", equalTo(property.getValue().getDescription()));
}
}
}
}
use of org.wso2.identity.integration.test.rest.api.server.identity.governance.v1.dto.PropertyRes in project identity-api-server by wso2.
the class ServerIdentityGovernanceService method buildConnectorResDTO.
private ConnectorRes buildConnectorResDTO(ConnectorConfig connectorConfig) {
ConnectorRes connectorsResDTO = new ConnectorRes();
connectorsResDTO.setId(Base64.getUrlEncoder().withoutPadding().encodeToString(connectorConfig.getName().getBytes(StandardCharsets.UTF_8)));
connectorsResDTO.setName(connectorConfig.getName());
connectorsResDTO.setFriendlyName(connectorConfig.getFriendlyName());
connectorsResDTO.setCategory(connectorConfig.getCategory());
connectorsResDTO.setSubCategory(connectorConfig.getSubCategory());
connectorsResDTO.setOrder(connectorConfig.getOrder());
List<PropertyRes> properties = new ArrayList<>();
for (Property property : connectorConfig.getProperties()) {
PropertyRes propertyRes = new PropertyRes();
propertyRes.setName(property.getName());
propertyRes.setValue(property.getValue());
propertyRes.setDisplayName(property.getDisplayName());
propertyRes.setDescription(property.getDescription() != null ? property.getDescription() : "");
MetaRes metaRes = new MetaRes();
metaRes.setType(property.getType());
metaRes.setRegex(property.getRegex());
metaRes.setGroupID(property.getGroupId());
propertyRes.setMeta(metaRes);
properties.add(propertyRes);
}
connectorsResDTO.setProperties(properties);
return connectorsResDTO;
}
Aggregations