|
13 | 13 |
|
14 | 14 | package org.openmetadata.service.governance.workflows; |
15 | 15 |
|
| 16 | +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; |
16 | 17 | import static org.junit.jupiter.api.Assertions.assertInstanceOf; |
17 | 18 | import static org.junit.jupiter.api.Assertions.assertThrows; |
18 | 19 | import static org.junit.jupiter.api.Assertions.assertTrue; |
@@ -86,6 +87,31 @@ void runtimeModeWrapsFlowableWrongDbExceptionWithActionableMessage() { |
86 | 87 | } |
87 | 88 | } |
88 | 89 |
|
| 90 | + @Test |
| 91 | + void migrationModeDoesNotLoadPipelineServiceClient() { |
| 92 | + ProcessEngine mockEngine = mock(ProcessEngine.class, RETURNS_DEEP_STUBS); |
| 93 | + |
| 94 | + try (MockedConstruction<StandaloneProcessEngineConfiguration> ignored = |
| 95 | + mockConstruction( |
| 96 | + StandaloneProcessEngineConfiguration.class, |
| 97 | + (mock, ctx) -> when(mock.buildProcessEngine()).thenReturn(mockEngine)); |
| 98 | + MockedStatic<ProcessEngines> ignoredEngines = mockStatic(ProcessEngines.class); |
| 99 | + MockedStatic<Entity> entityMock = mockStatic(Entity.class); |
| 100 | + MockedStatic<PipelineServiceClientFactory> pscMock = |
| 101 | + mockStatic(PipelineServiceClientFactory.class)) { |
| 102 | + |
| 103 | + setupEntityMock(entityMock); |
| 104 | + pscMock |
| 105 | + .when(() -> PipelineServiceClientFactory.createPipelineServiceClient(any())) |
| 106 | + .thenThrow(new RuntimeException("pipeline client class not on classpath")); |
| 107 | + |
| 108 | + assertDoesNotThrow(() -> WorkflowHandler.initialize(buildMockConfig(), true)); |
| 109 | + pscMock.verify( |
| 110 | + () -> PipelineServiceClientFactory.createPipelineServiceClient(any()), |
| 111 | + org.mockito.Mockito.never()); |
| 112 | + } |
| 113 | + } |
| 114 | + |
89 | 115 | @Test |
90 | 116 | void migrationModeSetsDbSchemaUpdateTrue() { |
91 | 117 | ProcessEngine mockEngine = mock(ProcessEngine.class, RETURNS_DEEP_STUBS); |
|
0 commit comments