private boolean shouldRestart() { ArquillianDescriptor descriptor = configuration.get(); Integer maxTestClasses = descriptor.engine().getMaxTestClassesBeforeRestart(); if (maxTestClasses == null) { return false; } if (maxTestClasses > 0) { if (maxTestClasses == testClassesCount) { testClassesCount = 1; return true; } } testClassesCount++; return false; } }
private boolean shouldRestart() { ArquillianDescriptor descriptor = configuration.get(); Integer maxTestClasses = descriptor.engine().getMaxTestClassesBeforeRestart(); if (maxTestClasses == null) { return false; } if (maxTestClasses > 0) { if (maxTestClasses == testClassesCount) { testClassesCount = 1; return true; } } testClassesCount++; return false; } }
@Override public String get() { return String.valueOf(desc.engine().getMaxTestClassesBeforeRestart()); } });
@Test public void shouldReturnNullOnEnginePropertiesIfNotSet() throws Exception { // add multiple times to see only one property added desc = create() .engine() .exportAsString(); ArquillianDescriptor descriptor = create(desc); Assert.assertNull(descriptor.engine().getDeploymentExportPath()); Assert.assertNull(descriptor.engine().getMaxTestClassesBeforeRestart()); }
@Test public void shouldReturnNullOnEnginePropertiesIfNotSet() throws Exception { // add multiple times to see only one property added desc = create() .engine(); desc = new SystemPropertiesConfigurationPlaceholderResolver().resolve(desc); final String descString = desc.exportAsString(); ArquillianDescriptor descriptor = create(descString); Assert.assertNull(descriptor.engine().getDeploymentExportPath()); Assert.assertNull(descriptor.engine().getMaxTestClassesBeforeRestart()); }
@Test public void shouldBeAbleToSetEngineProperties() throws Exception { System.setProperty(KEY_PROPERTY_VALUE_1, PROPERTY_VALUE_1); // add multiple times to see only one property added desc = create() .engine() .deploymentExportPath(setPropKey(KEY_PROPERTY_VALUE_1)) .deploymentExportPath(setPropKey(KEY_PROPERTY_VALUE_1)) .maxTestClassesBeforeRestart(PROPERTY_INT_VALUE_1) .maxTestClassesBeforeRestart(PROPERTY_INT_VALUE_1); desc = new SystemPropertiesConfigurationPlaceholderResolver().resolve(desc); final String descString = desc.exportAsString(); assertXPath(descString, "/arquillian/engine/property[@name='deploymentExportPath']/text()", PROPERTY_VALUE_1); assertXPath(descString, "/arquillian/engine/property[@name='maxTestClassesBeforeRestart']/text()", PROPERTY_INT_VALUE_1); ArquillianDescriptor descriptor = create(descString); Assert.assertEquals(PROPERTY_VALUE_1, descriptor.engine().getDeploymentExportPath()); Assert.assertEquals(PROPERTY_INT_VALUE_1, descriptor.engine().getMaxTestClassesBeforeRestart()); }
@Test public void shouldBeAbleToSetEngineProperties() throws Exception { // add multiple times to see only one property added desc = create() .engine() .deploymentExportPath(PROPERTY_VALUE_1) .deploymentExportPath(PROPERTY_VALUE_1) .maxTestClassesBeforeRestart(PROPERTY_INT_VALUE_1) .maxTestClassesBeforeRestart(PROPERTY_INT_VALUE_1) .exportAsString(); assertXPath(desc, "/arquillian/engine/property[@name='deploymentExportPath']/text()", PROPERTY_VALUE_1); assertXPath(desc, "/arquillian/engine/property[@name='maxTestClassesBeforeRestart']/text()", PROPERTY_INT_VALUE_1); ArquillianDescriptor descriptor = create(desc); Assert.assertEquals(PROPERTY_VALUE_1, descriptor.engine().getDeploymentExportPath()); Assert.assertEquals(PROPERTY_INT_VALUE_1, descriptor.engine().getMaxTestClassesBeforeRestart()); }