@Test public void should_append_configured_container_into_existing_arquillian_with_extensions_and_containers() throws IOException, TransformerException { final InputStream arquillianXml = Thread.currentThread().getContextClassLoader() .getResourceAsStream("arquillian_xml_container_extension.xml"); ArquillianChameleonConfigurationGenerator arquillianChameleonConfigurationGenerator = new ArquillianChameleonConfigurationGenerator(); final Path generatedConfigurationFile = arquillianChameleonConfigurationGenerator.generateAppendedArquillianXml(GenericTest.class, arquillianXml); assertThat(generatedConfigurationFile) .exists(); final XmlPath xmlPath = new XmlPath(generatedConfigurationFile.toUri()) .setRoot("arquillian"); final String target = xmlPath .getString("container.configuration.property.find{it.@name == 'chameleonTarget'}"); assertThat(target) .isNotNull() .isEqualTo("tomcat:7.0.0:managed"); final String extension = xmlPath .getString("extension.@qualifier"); assertThat(extension) .isEqualTo("docker"); final String propertyOfOldContainer = xmlPath .getString("container.configuration.property.find{it.@name == 'host'}"); assertThat(propertyOfOldContainer) .isEqualTo("localhost"); }
public Path generateAppendedArquillianXml(Class<?> testClass, InputStream originalArquillianXml) throws IOException, TransformerException { final ChameleonTargetConfiguration chameleonTargetConfiguration = findChameleonTargetConfiguration(testClass); if (chameleonTargetConfiguration != null) { final Node containerDefinition = chameleonTargetConfiguration.getContainerDefinitionAsXml(); Document arquillianConfigurationDocument = DomManipulation.createDocumentFromInputStream(originalArquillianXml); return generate(arquillianConfigurationDocument, containerDefinition, ARQUILLIAN_CHAMELEON_XML); } return null; }
ArquillianChameleonConfigurationGenerator { public Path generateAppendedArquillianXml(Class<?> testClass, InputStream originalArquillianXml) throws IOException, TransformerException { final ChameleonTargetConfiguration chameleonTargetConfiguration = findChameleonTargetConfiguration(testClass); if (chameleonTargetConfiguration != null) { final Node containerDefinition = chameleonTargetConfiguration.getContainerDefinitionAsXml(); Document arquillianConfigurationDocument = DomManipulation.createDocumentFromInputStream(originalArquillianXml); return generate(arquillianConfigurationDocument, containerDefinition, ARQUILLIAN_CHAMELEON_XML); } return null; } }
ArquillianChameleonConfigurationGenerator { public Path generateAppendedArquillianXml(Class<?> testClass, InputStream originalArquillianXml) throws IOException, TransformerException { final ChameleonTargetConfiguration chameleonTargetConfiguration = findChameleonTargetConfiguration(testClass); if (chameleonTargetConfiguration != null) { final Node containerDefinition = chameleonTargetConfiguration.getContainerDefinitionAsXml(); Document arquillianConfigurationDocument = DomManipulation.createDocumentFromInputStream(originalArquillianXml); return generate(arquillianConfigurationDocument, containerDefinition, ARQUILLIAN_CHAMELEON_XML); } return null; }  }
ArquillianChameleonConfigurationGenerator { public Path generateAppendedArquillianXml(Class<?> testClass, InputStream originalArquillianXml) throws IOException, TransformerException { final ChameleonTargetConfiguration chameleonTargetConfiguration = findChameleonTargetConfiguration(testClass); if (chameleonTargetConfiguration != null) { final Node containerDefinition = chameleonTargetConfiguration.getContainerDefinitionAsXml(); Document arquillianConfigurationDocument = DomManipulation.createDocumentFromInputStream(originalArquillianXml); return generate(arquillianConfigurationDocument, containerDefinition, ARQUILLIAN_CHAMELEON_XML); } return null; }  Path generateNewArquillianProperties(Class<?> testClass); Path generateNewArquillianXml(Class<?> testClass); Path generateAppendedArquillianXml(Class<?> testClass, InputStream originalArquillianXml); }
ArquillianChameleonConfigurationGenerator { public Path generateAppendedArquillianXml(Class<?> testClass, InputStream originalArquillianXml) throws IOException, TransformerException { final ChameleonTargetConfiguration chameleonTargetConfiguration = findChameleonTargetConfiguration(testClass); if (chameleonTargetConfiguration != null) { final Node containerDefinition = chameleonTargetConfiguration.getContainerDefinitionAsXml(); Document arquillianConfigurationDocument = DomManipulation.createDocumentFromInputStream(originalArquillianXml); return generate(arquillianConfigurationDocument, containerDefinition, ARQUILLIAN_CHAMELEON_XML); } return null; }  Path generateNewArquillianProperties(Class<?> testClass); Path generateNewArquillianXml(Class<?> testClass); Path generateAppendedArquillianXml(Class<?> testClass, InputStream originalArquillianXml);  }