Search in sources :

Example 1 with EntandoCustomResource

use of org.entando.kubernetes.model.common.EntandoCustomResource in project entando-k8s-controller-coordinator by entando-k8s.

the class CoordinatorTestUtils method toSerializedResource.

@SuppressWarnings("unchecked")
public static SerializedEntandoResource toSerializedResource(EntandoCustomResource entandoCustomResource) {
    try {
        final ObjectMapper objectMapper = new ObjectMapper();
        final SerializedEntandoResource result = objectMapper.readValue(objectMapper.writeValueAsString(entandoCustomResource), SerializedEntandoResource.class);
        result.setDefinition(CustomResourceDefinitionContext.fromCustomResourceType((Class<? extends CustomResource<?, ?>>) entandoCustomResource.getClass()));
        return result;
    } catch (IOException e) {
        throw new IllegalStateException(e);
    }
}
Also used : EntandoCustomResource(org.entando.kubernetes.model.common.EntandoCustomResource) CustomResource(io.fabric8.kubernetes.client.CustomResource) SerializedEntandoResource(org.entando.kubernetes.controller.spi.client.SerializedEntandoResource) IOException(java.io.IOException) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Aggregations

ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 CustomResource (io.fabric8.kubernetes.client.CustomResource)1 IOException (java.io.IOException)1 SerializedEntandoResource (org.entando.kubernetes.controller.spi.client.SerializedEntandoResource)1 EntandoCustomResource (org.entando.kubernetes.model.common.EntandoCustomResource)1