use of io.sundr.model.TypeDef in project kubernetes-client by fabric8io.
the class SpecReplicasPathDetectorTest method shoudDetectSpecReplicasPath.
@Test
public void shoudDetectSpecReplicasPath() throws Exception {
TypeDef def = Adapters.adaptType(WebServerWithStatusProperty.class, CONTEXT);
SpecReplicasPathDetector detector = new SpecReplicasPathDetector();
def = new TypeDefBuilder(def).accept(detector).build();
assertTrue(detector.getPath().isPresent());
assertEquals(".replicas", detector.getPath().get());
}
use of io.sundr.model.TypeDef in project kubernetes-client by fabric8io.
the class SpecReplicasPathDetectorTest method shoudDetectNestedSpecReplicasPath.
@Test
public void shoudDetectNestedSpecReplicasPath() throws Exception {
TypeDef def = Adapters.adaptType(WebServerWithSpec.class, CONTEXT);
SpecReplicasPathDetector detector = new SpecReplicasPathDetector();
def = new TypeDefBuilder(def).accept(detector).build();
assertTrue(detector.getPath().isPresent());
assertEquals(".spec.replicas", detector.getPath().get());
}
use of io.sundr.model.TypeDef in project kubernetes-client by fabric8io.
the class TypesTest method shouldHaveAllTheExpectedProperties.
@Test
void shouldHaveAllTheExpectedProperties() {
final TypeDef def = Types.typeDefFrom(Joke.class);
final List<Property> properties = def.getProperties();
assertEquals(7, properties.size());
}
use of io.sundr.model.TypeDef in project kubernetes-client by fabric8io.
the class TypesTest method shouldFindStatusProperty.
@Test
void shouldFindStatusProperty() {
TypeDef def = Types.typeDefFrom(WebServerWithStatusProperty.class);
Optional<Property> p = Types.findStatusProperty(def);
assertTrue(p.isPresent());
def = Types.typeDefFrom(Basic.class);
p = Types.findStatusProperty(def);
assertTrue(p.isPresent());
}
use of io.sundr.model.TypeDef in project kubernetes-client by fabric8io.
the class TypesTest method shouldFindInheritedStatusProperty.
@Test
void shouldFindInheritedStatusProperty() {
final TypeDef def = Types.typeDefFrom(Child.class);
final Optional<Property> p = Types.findStatusProperty(def);
assertTrue(p.isPresent());
final Property property = p.get();
final TypeRef typeRef = property.getTypeRef();
assertTrue(typeRef instanceof ClassRef);
final ClassRef classRef = (ClassRef) typeRef;
final SpecAndStatus specAndStatus = Types.resolveSpecAndStatusTypes(def);
assertEquals(specAndStatus.getStatusClassName(), classRef.getFullyQualifiedName());
}
Aggregations