Search in sources :

Example 1 with CloudGatewayJson

use of com.sequenceiq.cloudbreak.api.model.CloudGatewayJson in project cloudbreak by hortonworks.

the class Gateway method assertValidGateways.

public static Assertion<Gateway> assertValidGateways() {
    return assertThis((gateway, t) -> {
        if (gateway.getResponse().isEmpty()) {
            LOGGER.info("No gateways for given provider");
        } else {
            for (Map.Entry<String, Set<CloudGatewayJson>> elem : gateway.getResponse().entrySet()) {
                for (Object response : elem.getValue()) {
                    CloudGatewayJson gatewayJson = (CloudGatewayJson) response;
                    Assert.assertFalse(gatewayJson.getName().isEmpty());
                }
            }
        }
    });
}
Also used : Set(java.util.Set) CloudGatewayJson(com.sequenceiq.cloudbreak.api.model.CloudGatewayJson) Map(java.util.Map)

Example 2 with CloudGatewayJson

use of com.sequenceiq.cloudbreak.api.model.CloudGatewayJson in project cloudbreak by hortonworks.

the class CloudGatewayssToPlatformGatewaysResponseConverter method convert.

@Override
public PlatformGatewaysResponse convert(CloudGateWays source) {
    Map<String, Set<CloudGatewayJson>> result = new HashMap<>();
    for (Entry<String, Set<CloudGateWay>> entry : source.getCloudGateWayResponses().entrySet()) {
        Set<CloudGatewayJson> cloudGatewayJsons = new HashSet<>();
        for (CloudGateWay gateway : entry.getValue()) {
            CloudGatewayJson actual = new CloudGatewayJson(gateway.getName(), gateway.getId(), gateway.getProperties());
            cloudGatewayJsons.add(actual);
        }
        result.put(entry.getKey(), cloudGatewayJsons);
    }
    return new PlatformGatewaysResponse(result);
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) HashMap(java.util.HashMap) CloudGatewayJson(com.sequenceiq.cloudbreak.api.model.CloudGatewayJson) PlatformGatewaysResponse(com.sequenceiq.cloudbreak.api.model.PlatformGatewaysResponse) HashSet(java.util.HashSet) CloudGateWay(com.sequenceiq.cloudbreak.cloud.model.CloudGateWay)

Aggregations

CloudGatewayJson (com.sequenceiq.cloudbreak.api.model.CloudGatewayJson)2 Set (java.util.Set)2 PlatformGatewaysResponse (com.sequenceiq.cloudbreak.api.model.PlatformGatewaysResponse)1 CloudGateWay (com.sequenceiq.cloudbreak.cloud.model.CloudGateWay)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1