diff --git a/core/src/it/java/org/pentaho/metaverse/MetaverseValidationDedupIT.java b/core/src/it/java/org/pentaho/metaverse/MetaverseValidationDedupIT.java index 7a4d8f730..7fdadc52b 100644 --- a/core/src/it/java/org/pentaho/metaverse/MetaverseValidationDedupIT.java +++ b/core/src/it/java/org/pentaho/metaverse/MetaverseValidationDedupIT.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2018-2021 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2018-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -26,13 +26,11 @@ import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; +import org.mockito.MockedStatic; import org.mockito.Mockito; +import org.mockito.junit.MockitoJUnitRunner; import org.pentaho.metaverse.frames.FramedMetaverseNode; import org.pentaho.metaverse.impl.MetaverseConfig; -import org.powermock.api.mockito.PowerMockito; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; -import org.powermock.core.classloader.annotations.PowerMockIgnore; import java.util.ArrayList; import java.util.List; @@ -42,44 +40,53 @@ * Runs the integration test with the {@link MetaverseConfig} mocked to have * the {@code deduplicateTransformationFields} graph dedupping turned on. */ -@RunWith( PowerMockRunner.class ) -@PowerMockIgnore( "jdk.internal.reflect.*" ) -@PrepareForTest( MetaverseConfig.class ) +@RunWith( MockitoJUnitRunner.class ) public class MetaverseValidationDedupIT extends MetaverseValidationIT { @BeforeClass public static void init() throws Exception { - - PowerMockito.mockStatic( MetaverseConfig.class ); - Mockito.when( MetaverseConfig.adjustExternalResourceFields() ).thenReturn( true ); - Mockito.when( MetaverseConfig.deduplicateTransformationFields() ).thenReturn( true ); - Mockito.when( MetaverseConfig.consolidateSubGraphs() ).thenReturn( true ); - Mockito.when( MetaverseConfig.generateSubGraphs() ).thenReturn( true ); - MetaverseValidationIT.init(); } @Test public void testSelectValuesStep() throws Exception { - testSelectValuesStep( 8 ); + try ( MockedStatic metaverseConfigMockedStatic = Mockito.mockStatic( MetaverseConfig.class ) ) { + metaverseConfigMockedStatic.when( MetaverseConfig::adjustExternalResourceFields ).thenReturn( true ); + metaverseConfigMockedStatic.when( MetaverseConfig::deduplicateTransformationFields ).thenReturn( true ); + metaverseConfigMockedStatic.when( MetaverseConfig::consolidateSubGraphs ).thenReturn( true ); + metaverseConfigMockedStatic.when( MetaverseConfig::generateSubGraphs ).thenReturn( true ); + testSelectValuesStep( 8 ); + } } @Test public void testTextFileInputNode() throws Exception { - List containedNodes = testTextFileInputNodeImpl( 3 ); - // get field names - List nodeNames = new ArrayList(); - for ( final FramedMetaverseNode node : containedNodes ) { - nodeNames.add( node.getName() ); + try ( MockedStatic metaverseConfigMockedStatic = Mockito.mockStatic( MetaverseConfig.class ) ) { + metaverseConfigMockedStatic.when( MetaverseConfig::adjustExternalResourceFields ).thenReturn( true ); + metaverseConfigMockedStatic.when( MetaverseConfig::deduplicateTransformationFields ).thenReturn( true ); + metaverseConfigMockedStatic.when( MetaverseConfig::consolidateSubGraphs ).thenReturn( true ); + metaverseConfigMockedStatic.when( MetaverseConfig::generateSubGraphs ).thenReturn( true ); + List containedNodes = testTextFileInputNodeImpl( 3 ); + // get field names + List nodeNames = new ArrayList(); + for ( final FramedMetaverseNode node : containedNodes ) { + nodeNames.add( node.getName() ); + } + Assert.assertTrue( nodeNames.contains( "longitude" ) ); + Assert.assertTrue( nodeNames.contains( "latitude" ) ); + Assert.assertTrue( nodeNames.contains( "address" ) ); } - Assert.assertTrue( nodeNames.contains( "longitude" ) ); - Assert.assertTrue( nodeNames.contains( "latitude" ) ); - Assert.assertTrue( nodeNames.contains( "address" ) ); } @Test @Override public void testTransformationStepNodes() throws Exception { - super.testTransformationStepNodes(); + try ( MockedStatic metaverseConfigMockedStatic = Mockito.mockStatic( MetaverseConfig.class ) ) { + metaverseConfigMockedStatic.when( MetaverseConfig::adjustExternalResourceFields ).thenReturn( true ); + metaverseConfigMockedStatic.when( MetaverseConfig::deduplicateTransformationFields ).thenReturn( true ); + metaverseConfigMockedStatic.when( MetaverseConfig::consolidateSubGraphs ).thenReturn( true ); + metaverseConfigMockedStatic.when( MetaverseConfig::generateSubGraphs ).thenReturn( true ); + super.testTransformationStepNodes(); + } } } diff --git a/core/src/it/java/org/pentaho/metaverse/MetaverseValidationSkipDedupIT.java b/core/src/it/java/org/pentaho/metaverse/MetaverseValidationSkipDedupIT.java index 0a8334863..e41b16bb2 100644 --- a/core/src/it/java/org/pentaho/metaverse/MetaverseValidationSkipDedupIT.java +++ b/core/src/it/java/org/pentaho/metaverse/MetaverseValidationSkipDedupIT.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2018-2021 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2018-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -25,42 +25,42 @@ import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; +import org.mockito.MockedStatic; import org.mockito.Mockito; +import org.mockito.junit.MockitoJUnitRunner; import org.pentaho.metaverse.impl.MetaverseConfig; -import org.powermock.api.mockito.PowerMockito; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.core.classloader.annotations.PowerMockIgnore; -import org.powermock.modules.junit4.PowerMockRunner; /** * Runs the integration test with the {@link MetaverseConfig} mocked to have * the {@code deduplicateTransformationFields} graph dedupping turned off. */ -@RunWith( PowerMockRunner.class ) -@PowerMockIgnore( "jdk.internal.reflect.*" ) -@PrepareForTest( MetaverseConfig.class ) +@RunWith( MockitoJUnitRunner.class ) public class MetaverseValidationSkipDedupIT extends MetaverseValidationIT { @BeforeClass public static void init() throws Exception { - - PowerMockito.mockStatic( MetaverseConfig.class ); - // expecting to deduplicate by default - need to mock to return false - Mockito.when( MetaverseConfig.adjustExternalResourceFields() ).thenReturn( false ); - Mockito.when( MetaverseConfig.deduplicateTransformationFields() ).thenReturn( false ); - Mockito.when( MetaverseConfig.consolidateSubGraphs() ).thenReturn( true ); - Mockito.when( MetaverseConfig.generateSubGraphs() ).thenReturn( true ); - MetaverseValidationIT.init(); } @Test public void testSelectValuesStep() throws Exception { - testSelectValuesStep( 16 ); + try ( MockedStatic metaverseConfigMockedStatic = Mockito.mockStatic( MetaverseConfig.class ) ) { + metaverseConfigMockedStatic.when( MetaverseConfig::adjustExternalResourceFields ).thenReturn( false ); + metaverseConfigMockedStatic.when( MetaverseConfig::deduplicateTransformationFields ).thenReturn( false ); + metaverseConfigMockedStatic.when( MetaverseConfig::consolidateSubGraphs ).thenReturn( true ); + metaverseConfigMockedStatic.when( MetaverseConfig::generateSubGraphs ).thenReturn( true ); + testSelectValuesStep( 16 ); + } } @Test public void testTextFileInputNode() throws Exception { - testTextFileInputNodeImpl( 0 ); + try ( MockedStatic metaverseConfigMockedStatic = Mockito.mockStatic( MetaverseConfig.class ) ) { + metaverseConfigMockedStatic.when( MetaverseConfig::adjustExternalResourceFields ).thenReturn( false ); + metaverseConfigMockedStatic.when( MetaverseConfig::deduplicateTransformationFields ).thenReturn( false ); + metaverseConfigMockedStatic.when( MetaverseConfig::consolidateSubGraphs ).thenReturn( true ); + metaverseConfigMockedStatic.when( MetaverseConfig::generateSubGraphs ).thenReturn( true ); + testTextFileInputNodeImpl( 0 ); + } } } diff --git a/core/src/it/java/org/pentaho/metaverse/graph/GraphCatalogWriterIT.java b/core/src/it/java/org/pentaho/metaverse/graph/GraphCatalogWriterIT.java index c7505dbb4..ffd219969 100644 --- a/core/src/it/java/org/pentaho/metaverse/graph/GraphCatalogWriterIT.java +++ b/core/src/it/java/org/pentaho/metaverse/graph/GraphCatalogWriterIT.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2021 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2021-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -40,7 +40,7 @@ import java.util.Arrays; import java.util.List; -import static org.mockito.Matchers.anyString; +import static org.mockito.ArgumentMatchers.nullable; public class GraphCatalogWriterIT extends StepAnalyzerValidationIT { @Mock ICatalogLineageClient mockCatalogLineageClient; @@ -50,7 +50,7 @@ public class GraphCatalogWriterIT extends StepAnalyzerValidationIT { @Before public void setup() { - Mockito.when( mockCatalogLineageClientProvider.getCatalogLineageClient( anyString(), anyString(), anyString(), anyString(), anyString(), anyString() ) ) + Mockito.when( mockCatalogLineageClientProvider.getCatalogLineageClient( nullable( String.class ), nullable( String.class ), nullable( String.class ), nullable( String.class ), nullable( String.class ), nullable( String.class ) ) ) .thenReturn( mockCatalogLineageClient ); } diff --git a/core/src/it/java/org/pentaho/metaverse/step/MappingAnalyzerValidationIT.java b/core/src/it/java/org/pentaho/metaverse/step/MappingAnalyzerValidationIT.java index b61b0d7f9..0c18b67fa 100644 --- a/core/src/it/java/org/pentaho/metaverse/step/MappingAnalyzerValidationIT.java +++ b/core/src/it/java/org/pentaho/metaverse/step/MappingAnalyzerValidationIT.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2018-2021 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2018-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -26,13 +26,10 @@ import org.apache.commons.collections.IteratorUtils; import org.junit.Test; import org.junit.runner.RunWith; +import org.mockito.junit.MockitoJUnitRunner; import org.pentaho.metaverse.frames.FramedMetaverseNode; import org.pentaho.metaverse.frames.TransformationNode; import org.pentaho.metaverse.frames.TransformationStepNode; -import org.pentaho.metaverse.impl.MetaverseConfig; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.core.classloader.annotations.PowerMockIgnore; -import org.powermock.modules.junit4.PowerMockRunner; import java.util.Arrays; import java.util.List; @@ -40,11 +37,29 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import static org.pentaho.dictionary.DictionaryConst.*; - -@RunWith( PowerMockRunner.class ) -@PowerMockIgnore( "jdk.internal.reflect.*" ) -@PrepareForTest( MetaverseConfig.class ) +import static org.pentaho.dictionary.DictionaryConst.LINK_CONTAINS; +import static org.pentaho.dictionary.DictionaryConst.LINK_DERIVES; +import static org.pentaho.dictionary.DictionaryConst.LINK_EXECUTES; +import static org.pentaho.dictionary.DictionaryConst.LINK_HOPSTO; +import static org.pentaho.dictionary.DictionaryConst.LINK_INPUTS; +import static org.pentaho.dictionary.DictionaryConst.LINK_OUTPUTS; +import static org.pentaho.dictionary.DictionaryConst.LINK_TYPE_CONCEPT; +import static org.pentaho.dictionary.DictionaryConst.NODE_TYPE_TRANS; +import static org.pentaho.dictionary.DictionaryConst.NODE_TYPE_TRANS_FIELD; +import static org.pentaho.dictionary.DictionaryConst.NODE_VIRTUAL; +import static org.pentaho.dictionary.DictionaryConst.PROPERTY_ANALYZER; +import static org.pentaho.dictionary.DictionaryConst.PROPERTY_CATEGORY; +import static org.pentaho.dictionary.DictionaryConst.PROPERTY_COPIES; +import static org.pentaho.dictionary.DictionaryConst.PROPERTY_LOGICAL_ID; +import static org.pentaho.dictionary.DictionaryConst.PROPERTY_NAME; +import static org.pentaho.dictionary.DictionaryConst.PROPERTY_NAMESPACE; +import static org.pentaho.dictionary.DictionaryConst.PROPERTY_PATH; +import static org.pentaho.dictionary.DictionaryConst.PROPERTY_PLUGIN_ID; +import static org.pentaho.dictionary.DictionaryConst.PROPERTY_STEP_TYPE; +import static org.pentaho.dictionary.DictionaryConst.PROPERTY_TYPE; +import static org.pentaho.dictionary.DictionaryConst.PROPERTY_VERBOSE_DETAILS; + +@RunWith( MockitoJUnitRunner.class ) public class MappingAnalyzerValidationIT extends StepAnalyzerValidationIT { private static final String VALUE = "value"; diff --git a/core/src/it/java/org/pentaho/metaverse/step/MdiValidationIT.java b/core/src/it/java/org/pentaho/metaverse/step/MdiValidationIT.java index f9a66c15f..147254dc5 100644 --- a/core/src/it/java/org/pentaho/metaverse/step/MdiValidationIT.java +++ b/core/src/it/java/org/pentaho/metaverse/step/MdiValidationIT.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2018-2021 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2018-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -28,28 +28,46 @@ import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; +import org.mockito.junit.MockitoJUnitRunner; import org.pentaho.metaverse.frames.FileNode; import org.pentaho.metaverse.frames.FramedMetaverseNode; import org.pentaho.metaverse.frames.StreamFieldNode; import org.pentaho.metaverse.frames.TransformationNode; import org.pentaho.metaverse.frames.TransformationStepNode; -import org.pentaho.metaverse.impl.MetaverseConfig; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.core.classloader.annotations.PowerMockIgnore; -import org.powermock.modules.junit4.PowerMockRunner; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; -import static org.junit.Assert.*; -import static org.pentaho.dictionary.DictionaryConst.*; - -@RunWith( PowerMockRunner.class ) -@PowerMockIgnore( "jdk.internal.reflect.*" ) -@PrepareForTest( MetaverseConfig.class ) -// TODO: Ignored for now, remove the @Ignore annotation once https://jira.pentaho.com/browse/ENGOPS-4612 is resolved +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.pentaho.dictionary.DictionaryConst.LINK_CONTAINS; +import static org.pentaho.dictionary.DictionaryConst.LINK_DERIVES; +import static org.pentaho.dictionary.DictionaryConst.LINK_EXECUTES; +import static org.pentaho.dictionary.DictionaryConst.LINK_HOPSTO; +import static org.pentaho.dictionary.DictionaryConst.LINK_INPUTS; +import static org.pentaho.dictionary.DictionaryConst.LINK_OUTPUTS; +import static org.pentaho.dictionary.DictionaryConst.LINK_POPULATES; +import static org.pentaho.dictionary.DictionaryConst.LINK_TYPE_CONCEPT; +import static org.pentaho.dictionary.DictionaryConst.NODE_TYPE_STEP_PROPERTY; +import static org.pentaho.dictionary.DictionaryConst.NODE_TYPE_TRANS; +import static org.pentaho.dictionary.DictionaryConst.NODE_TYPE_TRANS_FIELD; +import static org.pentaho.dictionary.DictionaryConst.NODE_VIRTUAL; +import static org.pentaho.dictionary.DictionaryConst.PROPERTY_ANALYZER; +import static org.pentaho.dictionary.DictionaryConst.PROPERTY_CATEGORY; +import static org.pentaho.dictionary.DictionaryConst.PROPERTY_COPIES; +import static org.pentaho.dictionary.DictionaryConst.PROPERTY_LOGICAL_ID; +import static org.pentaho.dictionary.DictionaryConst.PROPERTY_NAME; +import static org.pentaho.dictionary.DictionaryConst.PROPERTY_NAMESPACE; +import static org.pentaho.dictionary.DictionaryConst.PROPERTY_PLUGIN_ID; +import static org.pentaho.dictionary.DictionaryConst.PROPERTY_STEP_TYPE; +import static org.pentaho.dictionary.DictionaryConst.PROPERTY_TYPE; +import static org.pentaho.dictionary.DictionaryConst.PROPERTY_VERBOSE_DETAILS; + +@RunWith( MockitoJUnitRunner.class ) + // TODO: Ignored for now, remove the @Ignore annotation once https://jira.pentaho.com/browse/ENGOPS-4612 is resolved @Ignore public class MdiValidationIT extends StepAnalyzerValidationIT { diff --git a/core/src/it/java/org/pentaho/metaverse/step/SimpleMappingAnalyzerValidationIT.java b/core/src/it/java/org/pentaho/metaverse/step/SimpleMappingAnalyzerValidationIT.java index 18cc855b9..8efa6bd39 100644 --- a/core/src/it/java/org/pentaho/metaverse/step/SimpleMappingAnalyzerValidationIT.java +++ b/core/src/it/java/org/pentaho/metaverse/step/SimpleMappingAnalyzerValidationIT.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2018-2021 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2018-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -26,23 +26,37 @@ import org.apache.commons.collections.IteratorUtils; import org.junit.Test; import org.junit.runner.RunWith; +import org.mockito.junit.MockitoJUnitRunner; import org.pentaho.metaverse.frames.FramedMetaverseNode; import org.pentaho.metaverse.frames.TransformationNode; import org.pentaho.metaverse.frames.TransformationStepNode; -import org.pentaho.metaverse.impl.MetaverseConfig; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.core.classloader.annotations.PowerMockIgnore; -import org.powermock.modules.junit4.PowerMockRunner; import java.util.Arrays; import java.util.Map; import static org.junit.Assert.assertEquals; -import static org.pentaho.dictionary.DictionaryConst.*; - -@RunWith( PowerMockRunner.class ) -@PowerMockIgnore( "jdk.internal.reflect.*" ) -@PrepareForTest( MetaverseConfig.class ) +import static org.pentaho.dictionary.DictionaryConst.LINK_CONTAINS; +import static org.pentaho.dictionary.DictionaryConst.LINK_DERIVES; +import static org.pentaho.dictionary.DictionaryConst.LINK_EXECUTES; +import static org.pentaho.dictionary.DictionaryConst.LINK_INPUTS; +import static org.pentaho.dictionary.DictionaryConst.LINK_OUTPUTS; +import static org.pentaho.dictionary.DictionaryConst.LINK_TYPE_CONCEPT; +import static org.pentaho.dictionary.DictionaryConst.NODE_TYPE_TRANS; +import static org.pentaho.dictionary.DictionaryConst.NODE_TYPE_TRANS_FIELD; +import static org.pentaho.dictionary.DictionaryConst.NODE_VIRTUAL; +import static org.pentaho.dictionary.DictionaryConst.PROPERTY_ANALYZER; +import static org.pentaho.dictionary.DictionaryConst.PROPERTY_CATEGORY; +import static org.pentaho.dictionary.DictionaryConst.PROPERTY_COPIES; +import static org.pentaho.dictionary.DictionaryConst.PROPERTY_LOGICAL_ID; +import static org.pentaho.dictionary.DictionaryConst.PROPERTY_NAME; +import static org.pentaho.dictionary.DictionaryConst.PROPERTY_NAMESPACE; +import static org.pentaho.dictionary.DictionaryConst.PROPERTY_PATH; +import static org.pentaho.dictionary.DictionaryConst.PROPERTY_PLUGIN_ID; +import static org.pentaho.dictionary.DictionaryConst.PROPERTY_STEP_TYPE; +import static org.pentaho.dictionary.DictionaryConst.PROPERTY_TYPE; +import static org.pentaho.dictionary.DictionaryConst.PROPERTY_VERBOSE_DETAILS; + +@RunWith( MockitoJUnitRunner.class ) public class SimpleMappingAnalyzerValidationIT extends StepAnalyzerValidationIT { private static final String VALUE = "value"; diff --git a/core/src/it/java/org/pentaho/metaverse/step/StepAnalyzerValidationIT.java b/core/src/it/java/org/pentaho/metaverse/step/StepAnalyzerValidationIT.java index ddec8d945..289010f0a 100644 --- a/core/src/it/java/org/pentaho/metaverse/step/StepAnalyzerValidationIT.java +++ b/core/src/it/java/org/pentaho/metaverse/step/StepAnalyzerValidationIT.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2018-2021 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2018-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -22,31 +22,34 @@ package org.pentaho.metaverse.step; +import org.junit.After; import org.junit.Before; import org.junit.runner.RunWith; +import org.mockito.MockedStatic; import org.mockito.Mockito; - +import org.mockito.junit.MockitoJUnitRunner; import org.pentaho.metaverse.BaseMetaverseValidationIT; import org.pentaho.metaverse.impl.MetaverseConfig; -import org.powermock.api.mockito.PowerMockito; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.core.classloader.annotations.PowerMockIgnore; -import org.powermock.modules.junit4.PowerMockRunner; -@RunWith( PowerMockRunner.class ) -@PowerMockIgnore( "jdk.internal.reflect.*" ) -@PrepareForTest( MetaverseConfig.class ) +@RunWith( MockitoJUnitRunner.class ) public abstract class StepAnalyzerValidationIT extends BaseMetaverseValidationIT { + MockedStatic metaverseConfigMockedStatic; + @Before public void init() throws Exception { - PowerMockito.mockStatic( MetaverseConfig.class ); - Mockito.when( MetaverseConfig.adjustExternalResourceFields() ).thenReturn( true ); - Mockito.when( MetaverseConfig.deduplicateTransformationFields() ).thenReturn( true ); - Mockito.when( MetaverseConfig.consolidateSubGraphs() ).thenReturn( true ); - Mockito.when( MetaverseConfig.generateSubGraphs() ).thenReturn( true ); + metaverseConfigMockedStatic = Mockito.mockStatic( MetaverseConfig.class ); + MockedStatic metaverseConfigMockedStatic = Mockito.mockStatic( MetaverseConfig.class ); + metaverseConfigMockedStatic.when( MetaverseConfig::adjustExternalResourceFields ).thenReturn( true ); + metaverseConfigMockedStatic.when( MetaverseConfig::deduplicateTransformationFields ).thenReturn( true ); + metaverseConfigMockedStatic.when( MetaverseConfig::consolidateSubGraphs ).thenReturn( true ); + metaverseConfigMockedStatic.when( MetaverseConfig::generateSubGraphs ).thenReturn( true ); + } + @After + public void cleanup() { + metaverseConfigMockedStatic.close(); } @Override diff --git a/core/src/it/java/org/pentaho/metaverse/step/TableOutputValidationIT.java b/core/src/it/java/org/pentaho/metaverse/step/TableOutputValidationIT.java index a33ebf48d..4bc41cb24 100644 --- a/core/src/it/java/org/pentaho/metaverse/step/TableOutputValidationIT.java +++ b/core/src/it/java/org/pentaho/metaverse/step/TableOutputValidationIT.java @@ -2,7 +2,7 @@ * * Pentaho Data Integration * - * Copyright (C) 2018-2021 by Hitachi Vantara : http://www.pentaho.com + * Copyright (C) 2018-2024 by Hitachi Vantara : http://www.pentaho.com * ******************************************************************************* * @@ -27,14 +27,11 @@ import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; +import org.mockito.junit.MockitoJUnitRunner; import org.pentaho.metaverse.frames.DatasourceNode; import org.pentaho.metaverse.frames.FramedMetaverseNode; import org.pentaho.metaverse.frames.TransformationNode; import org.pentaho.metaverse.frames.TransformationStepNode; -import org.pentaho.metaverse.impl.MetaverseConfig; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.core.classloader.annotations.PowerMockIgnore; -import org.powermock.modules.junit4.PowerMockRunner; import java.util.Arrays; import java.util.List; @@ -42,11 +39,15 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; -import static org.pentaho.dictionary.DictionaryConst.*; - -@RunWith( PowerMockRunner.class ) -@PowerMockIgnore( "jdk.internal.reflect.*" ) -@PrepareForTest( MetaverseConfig.class ) +import static org.pentaho.dictionary.DictionaryConst.LINK_DERIVES; +import static org.pentaho.dictionary.DictionaryConst.LINK_POPULATES; +import static org.pentaho.dictionary.DictionaryConst.NODE_TYPE_DATASOURCE; +import static org.pentaho.dictionary.DictionaryConst.NODE_TYPE_DATA_COLUMN; +import static org.pentaho.dictionary.DictionaryConst.NODE_TYPE_DATA_TABLE; +import static org.pentaho.dictionary.DictionaryConst.NODE_TYPE_TRANS; +import static org.pentaho.dictionary.DictionaryConst.NODE_TYPE_TRANS_FIELD; + +@RunWith( MockitoJUnitRunner.class ) // TODO: Ignore the test for now, as it will not run succesfully on a node that does not have the required DB configured @Ignore public class TableOutputValidationIT extends StepAnalyzerValidationIT {