Search in sources :

Example 1 with ClassValue

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());
}
Also used : ClassValue(com.sequenceiq.flow.domain.ClassValue) Test(org.junit.jupiter.api.Test)

Example 2 with ClassValue

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());
}
Also used : FlowLog(com.sequenceiq.flow.domain.FlowLog) ClassValue(com.sequenceiq.flow.domain.ClassValue) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 3 with ClassValue

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());
}
Also used : ClassValue(com.sequenceiq.flow.domain.ClassValue) Test(org.junit.jupiter.api.Test)

Aggregations

ClassValue (com.sequenceiq.flow.domain.ClassValue)3 Test (org.junit.jupiter.api.Test)3 FlowLog (com.sequenceiq.flow.domain.FlowLog)1 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)1