PGETaskInstance implements WorkflowTaskInstance { protected PgeConfig createPgeConfig() throws Exception { logger.info("Create PgeConfig..."); String pgeConfigBuilderClass = pgeMetadata.getMetadata(PGE_CONFIG_BUILDER); if (pgeConfigBuilderClass != null) { logger.info("Using PgeConfigBuilder: {}", pgeConfigBuilderClass); return createPgeConfigBuilder(pgeConfigBuilderClass, logger).build(pgeMetadata); } else { logger.info("Using default PgeConfigBuilder: {}", XmlFilePgeConfigBuilder.class.getCanonicalName()); return new XmlFilePgeConfigBuilder().build(pgeMetadata); } } protected  PGETaskInstance(); @Override void run(Metadata metadata, WorkflowTaskConfiguration config); String getWorkflowInstId(); void setWorkflowInstId(String workflowInstId); void setWmClient(WorkflowManagerClient wmClient); @Override void finalize();  }
@Test public void testCreatePgeConfig() throws Exception { final String KEY = "TestKey"; final String VALUE = "TestValue"; File pgeConfigFile = new File(createTmpDir(), "pgeConfig.xml"); FileUtils.writeLines(pgeConfigFile, "UTF-8", Lists.newArrayList( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>", "<pgeConfig>", " <customMetadata>", " <metadata key=\"" + KEY + "\" val=\"" + VALUE + "\"/>", " </customMetadata>", "</pgeConfig>")); PGETaskInstance pgeTask = createTestInstance(); pgeTask.pgeMetadata.replaceMetadata(CONFIG_FILE_PATH, pgeConfigFile.getAbsolutePath()); PgeConfig pgeConfig = pgeTask.createPgeConfig(); assertNotNull(pgeConfig); assertEquals(VALUE, pgeTask.pgeMetadata.getMetadata(KEY)); pgeTask = createTestInstance(); pgeTask.pgeMetadata.replaceMetadata(PGE_CONFIG_BUILDER, MockPgeConfigBuilder.class.getCanonicalName()); pgeConfig = pgeTask.createPgeConfig(); assertEquals(MockPgeConfigBuilder.MOCK_EXE_DIR, pgeConfig.getExeDir()); }