@Test public void should_configure_arquillian_using_properties_if_it_is_not_configured_as_such() throws IOException, TransformerException { final ArquillianChameleonConfigurator arquillianChameleonConfigurator = new ArquillianChameleonConfigurator(); when(classLoader.getResourceAsStream(ArquillianChameleonConfigurationGenerator.ARQUILLIAN_PROPERTIES)) .thenReturn(null); final Path setup = arquillianChameleonConfigurator.setup(GenericTest.class, classLoader); assertThat(setup) .hasFileName(ArquillianChameleonConfigurationGenerator.ARQUILLIAN_PROPERTIES) .exists(); }
public Path setup(Class<?> testClass, ClassLoader parent) throws IOException, TransformerException { final InputStream configurationProperties = parent.getResourceAsStream(ArquillianChameleonConfigurationGenerator.ARQUILLIAN_PROPERTIES); ArquillianChameleonConfigurationGenerator arquillianChameleonConfigurationGenerator = new ArquillianChameleonConfigurationGenerator(); Path arquillianChameleonConfiguration; if (isArquillianConfiguredWithProperties(configurationProperties)) { configurationProperties.close(); final InputStream configurationXml = getArquillianXmlConfiguration(parent); if (isArquillianConfiguredWithXml(configurationXml)) { arquillianChameleonConfiguration = arquillianChameleonConfigurationGenerator.generateAppendedArquillianXml(testClass, configurationXml); System.setProperty(ARQUILLIAN_XML_SYS_PROPERTY, arquillianChameleonConfiguration.getFileName().toString()); log.warning("Current project is configured with arquillian.properties and arquillian.xml. So we have created a custom arquillian filename and set it using a JVM System property." + " If you are planning to run tests in parallel in same JVM, this might cause some problems. We recommend to configure Arquillian either with .proeprties or .xml file approach but not both."); } else { arquillianChameleonConfiguration = arquillianChameleonConfigurationGenerator.generateNewArquillianXml(testClass); } } else { arquillianChameleonConfiguration = arquillianChameleonConfigurationGenerator.generateNewArquillianProperties(testClass); } return arquillianChameleonConfiguration; }
ArquillianChameleonConfigurator { public Path setup(Class<?> testClass, ClassLoader parent) throws IOException, TransformerException { final InputStream configurationProperties = parent.getResourceAsStream(ArquillianChameleonConfigurationGenerator.ARQUILLIAN_PROPERTIES); ArquillianChameleonConfigurationGenerator arquillianChameleonConfigurationGenerator = new ArquillianChameleonConfigurationGenerator(); Path arquillianChameleonConfiguration; if (isArquillianConfiguredWithProperties(configurationProperties)) { configurationProperties.close(); final InputStream configurationXml = getArquillianXmlConfiguration(parent); if (isArquillianConfiguredWithXml(configurationXml)) { arquillianChameleonConfiguration = arquillianChameleonConfigurationGenerator.generateAppendedArquillianXml(testClass, configurationXml); System.setProperty(ARQUILLIAN_XML_SYS_PROPERTY, arquillianChameleonConfiguration.getFileName().toString()); log.warning("Current project is configured with arquillian.properties and arquillian.xml. So we have created a custom arquillian filename and set it using a JVM System property." + " If you are planning to run tests in parallel in same JVM, this might cause some problems. We recommend to configure Arquillian either with .proeprties or .xml file approach but not both."); } else { arquillianChameleonConfiguration = arquillianChameleonConfigurationGenerator.generateNewArquillianXml(testClass); } } else { arquillianChameleonConfiguration = arquillianChameleonConfigurationGenerator.generateNewArquillianProperties(testClass); } return arquillianChameleonConfiguration; } }
ArquillianChameleonConfigurator { public Path setup(Class<?> testClass, ClassLoader parent) throws IOException, TransformerException { final InputStream configurationProperties = parent.getResourceAsStream(ArquillianChameleonConfigurationGenerator.ARQUILLIAN_PROPERTIES); ArquillianChameleonConfigurationGenerator arquillianChameleonConfigurationGenerator = new ArquillianChameleonConfigurationGenerator(); Path arquillianChameleonConfiguration; if (isArquillianConfiguredWithProperties(configurationProperties)) { configurationProperties.close(); final InputStream configurationXml = getArquillianXmlConfiguration(parent); if (isArquillianConfiguredWithXml(configurationXml)) { arquillianChameleonConfiguration = arquillianChameleonConfigurationGenerator.generateAppendedArquillianXml(testClass, configurationXml); System.setProperty(ARQUILLIAN_XML_SYS_PROPERTY, arquillianChameleonConfiguration.getFileName().toString()); log.warning("Current project is configured with arquillian.properties and arquillian.xml. So we have created a custom arquillian filename and set it using a JVM System property." + " If you are planning to run tests in parallel in same JVM, this might cause some problems. We recommend to configure Arquillian either with .proeprties or .xml file approach but not both."); } else { arquillianChameleonConfiguration = arquillianChameleonConfigurationGenerator.generateNewArquillianXml(testClass); } } else { arquillianChameleonConfiguration = arquillianChameleonConfigurationGenerator.generateNewArquillianProperties(testClass); } return arquillianChameleonConfiguration; }  }
ArquillianChameleonConfigurator { public Path setup(Class<?> testClass, ClassLoader parent) throws IOException, TransformerException { final InputStream configurationProperties = parent.getResourceAsStream(ArquillianChameleonConfigurationGenerator.ARQUILLIAN_PROPERTIES); ArquillianChameleonConfigurationGenerator arquillianChameleonConfigurationGenerator = new ArquillianChameleonConfigurationGenerator(); Path arquillianChameleonConfiguration; if (isArquillianConfiguredWithProperties(configurationProperties)) { configurationProperties.close(); final InputStream configurationXml = getArquillianXmlConfiguration(parent); if (isArquillianConfiguredWithXml(configurationXml)) { arquillianChameleonConfiguration = arquillianChameleonConfigurationGenerator.generateAppendedArquillianXml(testClass, configurationXml); System.setProperty(ARQUILLIAN_XML_SYS_PROPERTY, arquillianChameleonConfiguration.getFileName().toString()); log.warning("Current project is configured with arquillian.properties and arquillian.xml. So we have created a custom arquillian filename and set it using a JVM System property." + " If you are planning to run tests in parallel in same JVM, this might cause some problems. We recommend to configure Arquillian either with .proeprties or .xml file approach but not both."); } else { arquillianChameleonConfiguration = arquillianChameleonConfigurationGenerator.generateNewArquillianXml(testClass); } } else { arquillianChameleonConfiguration = arquillianChameleonConfigurationGenerator.generateNewArquillianProperties(testClass); } return arquillianChameleonConfiguration; }  Path setup(Class<?> testClass, ClassLoader parent); }
ArquillianChameleonConfigurator { public Path setup(Class<?> testClass, ClassLoader parent) throws IOException, TransformerException { final InputStream configurationProperties = parent.getResourceAsStream(ArquillianChameleonConfigurationGenerator.ARQUILLIAN_PROPERTIES); ArquillianChameleonConfigurationGenerator arquillianChameleonConfigurationGenerator = new ArquillianChameleonConfigurationGenerator(); Path arquillianChameleonConfiguration; if (isArquillianConfiguredWithProperties(configurationProperties)) { configurationProperties.close(); final InputStream configurationXml = getArquillianXmlConfiguration(parent); if (isArquillianConfiguredWithXml(configurationXml)) { arquillianChameleonConfiguration = arquillianChameleonConfigurationGenerator.generateAppendedArquillianXml(testClass, configurationXml); System.setProperty(ARQUILLIAN_XML_SYS_PROPERTY, arquillianChameleonConfiguration.getFileName().toString()); log.warning("Current project is configured with arquillian.properties and arquillian.xml. So we have created a custom arquillian filename and set it using a JVM System property." + " If you are planning to run tests in parallel in same JVM, this might cause some problems. We recommend to configure Arquillian either with .proeprties or .xml file approach but not both."); } else { arquillianChameleonConfiguration = arquillianChameleonConfigurationGenerator.generateNewArquillianXml(testClass); } } else { arquillianChameleonConfiguration = arquillianChameleonConfigurationGenerator.generateNewArquillianProperties(testClass); } return arquillianChameleonConfiguration; }  Path setup(Class<?> testClass, ClassLoader parent); static final String ARQUILLIAN_XML_SYS_PROPERTY; }