use of com.sequenceiq.flow.domain.ClassValue in project cloudbreak by hortonworks.
the class ClassValueConverterTest method testFromDatabaseWithKnownClass.
@Test
public void testFromDatabaseWithKnownClass() {
ClassValue classValue = underTest.convertToEntityAttribute("java.lang.String");
assertTrue(classValue.isOnClassPath());
assertEquals("java.lang.String", classValue.getName());
assertEquals(String.class, classValue.getClassValue());
}
use of com.sequenceiq.flow.domain.ClassValue in project cloudbreak by hortonworks.
the class FlowComponentTest method shouldTolerateWhenFlowLogTypeOrPayloadTypeClassIsNotOnClassPath.
@Test
public void shouldTolerateWhenFlowLogTypeOrPayloadTypeClassIsNotOnClassPath() {
long resourceId = RESOURCE_ID_SEC.incrementAndGet();
FlowLog flowLog = new FlowLog(resourceId, "test-flow-id", null, "userCrn", "NEXT_EVENT", "payload", ClassValue.ofUnknown("nope.NopePayload"), "variables", ClassValue.ofUnknown("nope.NopeFlowType"), "CURRENT_STATE");
flowLog.setFinalized(true);
flowLogRepository.save(flowLog);
List<FlowLog> flowLogs = flowLogRepository.findAllByResourceIdOrderByCreatedDesc(resourceId);
assertEquals(1, flowLogs.size());
ClassValue flowType = flowLogs.get(0).getFlowType();
ClassValue payloadType = flowLogs.get(0).getPayloadType();
assertFalse(flowType.isOnClassPath());
assertFalse(payloadType.isOnClassPath());
}
use of com.sequenceiq.flow.domain.ClassValue in project cloudbreak by hortonworks.
the class ClassValueConverterTest method testFromDatabaseWithUnknownClass.
@Test
public void testFromDatabaseWithUnknownClass() {
ClassValue classValue = underTest.convertToEntityAttribute("nope.Nope");
assertFalse(classValue.isOnClassPath());
assertEquals("nope.Nope", classValue.getName());
IllegalStateException exception = assertThrows(IllegalStateException.class, classValue::getClassValue);
assertEquals("nope.Nope is not a known class.", exception.getMessage());
}
Aggregations