Search in sources :

Example 1 with PlatformNetworkResponse

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

the class CloudNetworksToPlatformNetworksResponseConverter method convert.

@Override
public PlatformNetworksResponse convert(CloudNetworks source) {
    Map<String, Set<PlatformNetworkResponse>> result = new HashMap<>();
    for (Entry<String, Set<CloudNetwork>> entry : source.getCloudNetworkResponses().entrySet()) {
        Set<PlatformNetworkResponse> networks = new HashSet<>();
        for (CloudNetwork cloudNetwork : entry.getValue()) {
            PlatformNetworkResponse actual = new PlatformNetworkResponse(cloudNetwork.getName(), cloudNetwork.getId(), cloudNetwork.getSubnets(), cloudNetwork.getProperties());
            networks.add(actual);
        }
        result.put(entry.getKey(), networks);
    }
    return new PlatformNetworksResponse(result);
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) HashMap(java.util.HashMap) PlatformNetworkResponse(com.sequenceiq.cloudbreak.api.model.PlatformNetworkResponse) PlatformNetworksResponse(com.sequenceiq.cloudbreak.api.model.PlatformNetworksResponse) CloudNetwork(com.sequenceiq.cloudbreak.cloud.model.CloudNetwork) HashSet(java.util.HashSet)

Example 2 with PlatformNetworkResponse

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

the class Networks method assertNameNotEmpty.

public static Assertion<Networks> assertNameNotEmpty() {
    return assertThis((networks, t) -> {
        for (Map.Entry<String, Set<PlatformNetworkResponse>> elem : networks.getNetworksResponseWithNetworks().entrySet()) {
            for (Object response : elem.getValue()) {
                PlatformNetworkResponse platformNetworksResponse = (PlatformNetworkResponse) response;
                Assert.assertFalse(platformNetworksResponse.getName().isEmpty());
            }
        }
    });
}
Also used : Set(java.util.Set) PlatformNetworkResponse(com.sequenceiq.cloudbreak.api.model.PlatformNetworkResponse) Map(java.util.Map)

Example 3 with PlatformNetworkResponse

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

the class Networks method assertNameEmpty.

public static Assertion<Networks> assertNameEmpty() {
    return assertThis((networks, t) -> {
        for (Map.Entry<String, Set<PlatformNetworkResponse>> elem : networks.getNetworksResponseWithNetworks().entrySet()) {
            for (Object response : elem.getValue()) {
                PlatformNetworkResponse platformNetworksResponse = (PlatformNetworkResponse) response;
                Assert.assertTrue(platformNetworksResponse.getName().isEmpty());
            }
        }
    });
}
Also used : Set(java.util.Set) PlatformNetworkResponse(com.sequenceiq.cloudbreak.api.model.PlatformNetworkResponse) Map(java.util.Map)

Aggregations

PlatformNetworkResponse (com.sequenceiq.cloudbreak.api.model.PlatformNetworkResponse)3 Set (java.util.Set)3 Map (java.util.Map)2 PlatformNetworksResponse (com.sequenceiq.cloudbreak.api.model.PlatformNetworksResponse)1 CloudNetwork (com.sequenceiq.cloudbreak.cloud.model.CloudNetwork)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1