@Override public ReproduceErrorMessageBuilder appendAllOpts(Description description) { super.appendAllOpts(description); if (description.getMethodName() != null) { //prints out the raw method description instead of methodName(description) which filters out the parameters super.appendOpt(SYSPROP_TESTMETHOD(), "\"" + description.getMethodName() + "\""); } List<String> properties = new ArrayList<>(); scanProperties(description.getTestClass(), properties); appendProperties(properties.toArray(new String[properties.size()])); return appendESProperties(); }
/** * Append a single VM option. */ @Override public ReproduceErrorMessageBuilder appendOpt(String sysPropName, String value) { if (sysPropName.equals(SYSPROP_ITERATIONS())) { // we don't want the iters to be in there! return this; } if (sysPropName.equals(SYSPROP_TESTMETHOD())) { //don't print out the test method, we print it ourselves in appendAllOpts //without filtering out the parameters (needed for REST tests) return this; } if (sysPropName.equals(SYSPROP_PREFIX())) { // we always use the default prefix return this; } if (!Strings.isBlank(value)) { if (value.indexOf(' ') >= 0) { return super.appendOpt(sysPropName, '"' + value + '"'); } return super.appendOpt(sysPropName, value); } return this; }
/** * Append all JVM options that may help in reproducing the error. Options are * appended to the provided StringBuilder in the "command-line" syntax of: * <pre> * -Doption="value" * </pre> * * @param description Suite or test description. */ public ReproduceErrorMessageBuilder appendAllOpts(Description description) { RandomizedContext ctx = null; try { ctx = RandomizedContext.current(); appendOpt(SYSPROP_RANDOM_SEED(), ctx.getRunnerSeedAsString()); } catch (IllegalStateException e) { logger.warning("No context available when dumping reproduce options?"); } if (description.getClassName() != null) { appendOpt(SYSPROP_TESTCLASS(), description.getClassName()); } if (description.getMethodName() != null) { appendOpt(SYSPROP_TESTMETHOD(), methodName(description)); } appendRunnerProperties(); appendTestGroupOptions(ctx); appendEnvironmentSettings(); return this; }
@Override @SuppressForbidden("Legitimate use of syserr.") public void testFailure(Failure failure) throws Exception { // Ignore assumptions. if (failure.getException() instanceof AssumptionViolatedException) { return; } final Description d = failure.getDescription(); final StringBuilder b = new StringBuilder(); b.append("FAILURE : ").append(d.getDisplayName()).append("\n"); b.append("Message : " + failure.getMessage() + "\n"); b.append("Reproduce: "); new ReproduceErrorMessageBuilder(b).appendAllOpts(failure.getDescription()); b.append("\n"); b.append("Throwable:\n"); if (failure.getException() != null) { TraceFormatting traces = new TraceFormatting(); try { traces = RandomizedContext.current().getRunner().getTraceFormatting(); } catch (IllegalStateException e) { // Ignore if no context. } traces.formatThrowable(b, failure.getException()); } System.err.println(b.toString()); } }
public ReproduceErrorMessageBuilder appendEnvironmentSettings() { for (String sysPropName : Arrays.asList( "file.encoding", "user.timezone")) { if (emptyToNull(System.getProperty(sysPropName)) != null) { appendOpt(sysPropName, System.getProperty(sysPropName)); } } return this; }
/** * Append all JVM options that may help in reproducing the error. Options are * appended to the provided StringBuilder in the "command-line" syntax of: * <pre> * -Doption="value" * </pre> * * @param description Suite or test description. */ public ReproduceErrorMessageBuilder appendAllOpts(Description description) { RandomizedContext ctx = null; try { ctx = RandomizedContext.current(); appendOpt(SYSPROP_RANDOM_SEED(), ctx.getRunnerSeedAsString()); } catch (IllegalStateException e) { logger.warning("No context available when dumping reproduce options?"); } if (description.getClassName() != null) { appendOpt(SYSPROP_TESTCLASS(), description.getClassName()); } if (description.getMethodName() != null) { appendOpt(SYSPROP_TESTMETHOD(), methodName(description)); } appendRunnerProperties(); appendTestGroupOptions(ctx); appendEnvironmentSettings(); return this; }
@Override @SuppressForbidden("Legitimate use of syserr.") public void testFailure(Failure failure) throws Exception { // Ignore assumptions. if (failure.getException() instanceof AssumptionViolatedException) { return; } final Description d = failure.getDescription(); final StringBuilder b = new StringBuilder(); b.append("FAILURE : ").append(d.getDisplayName()).append("\n"); b.append("Message : " + failure.getMessage() + "\n"); b.append("Reproduce: "); new ReproduceErrorMessageBuilder(b).appendAllOpts(failure.getDescription()); b.append("\n"); b.append("Throwable:\n"); if (failure.getException() != null) { TraceFormatting traces = new TraceFormatting(); try { traces = RandomizedContext.current().getRunner().getTraceFormatting(); } catch (IllegalStateException e) { // Ignore if no context. } traces.formatThrowable(b, failure.getException()); } System.err.println(b.toString()); } }
@Override public ReproduceErrorMessageBuilder appendAllOpts(Description description) { super.appendAllOpts(description); if (description.getMethodName() != null) { //prints out the raw method description instead of methodName(description) which filters out the parameters super.appendOpt(SYSPROP_TESTMETHOD(), "\"" + description.getMethodName() + "\""); } return appendESProperties(); }
void appendGroupFilteringOptions(ReproduceErrorMessageBuilder builder) { for (TestGroupInfo info : testGroups.values()) { if (System.getProperty(info.sysProperty) != null) { builder.appendOpt(info.sysProperty, System.getProperty(info.sysProperty)); } } if (hasFilteringExpression()) { builder.appendOpt(SysGlobals.SYSPROP_TESTFILTER(), filterExpression); } }
@Override public ReproduceErrorMessageBuilder appendAllOpts(Description description) { super.appendAllOpts(description); if (description.getMethodName() != null) { //prints out the raw method description instead of methodName(description) which filters out the parameters super.appendOpt(SYSPROP_TESTMETHOD(), "\"" + description.getMethodName() + "\""); } List<String> properties = new ArrayList<>(); scanProperties(description.getTestClass(), properties); appendProperties(properties.toArray(new String[properties.size()])); return appendESProperties(); }
void appendGroupFilteringOptions(ReproduceErrorMessageBuilder builder) { for (TestGroupInfo info : testGroups.values()) { if (System.getProperty(info.sysProperty) != null) { builder.appendOpt(info.sysProperty, System.getProperty(info.sysProperty)); } } if (hasFilteringExpression()) { builder.appendOpt(SysGlobals.SYSPROP_TESTFILTER(), filterExpression); } }
public ReproduceErrorMessageBuilder appendEnvironmentSettings() { for (String sysPropName : Arrays.asList( "file.encoding", "user.timezone")) { if (emptyToNull(System.getProperty(sysPropName)) != null) { appendOpt(sysPropName, System.getProperty(sysPropName)); } } return this; }
public ReproduceErrorMessageBuilder appendRunnerProperties() { appendOpt(SYSPROP_PREFIX(), CURRENT_PREFIX()); for (String sysPropName : Arrays.asList( SYSPROP_STACKFILTERING(), SYSPROP_ITERATIONS(), SYSPROP_KILLATTEMPTS(), SYSPROP_KILLWAIT(), SYSPROP_TIMEOUT())) { if (System.getProperty(sysPropName) != null) { appendOpt(sysPropName, System.getProperty(sysPropName)); } } return this; }
/** * Append a single VM option. */ @Override public ReproduceErrorMessageBuilder appendOpt(String sysPropName, String value) { if (sysPropName.equals(SYSPROP_ITERATIONS())) { // we don't want the iters to be in there! return this; } if (sysPropName.equals(SYSPROP_TESTMETHOD())) { //don't print out the test method, we print it ourselves in appendAllOpts //without filtering out the parameters (needed for REST tests) return this; } if (sysPropName.equals(SYSPROP_PREFIX())) { // we always use the default prefix return this; } if (!Strings.isBlank(value)) { if (value.indexOf(' ') >= 0) { return super.appendOpt(sysPropName, '"' + value + '"'); } return super.appendOpt(sysPropName, value); } return this; }
public ReproduceErrorMessageBuilder appendRunnerProperties() { appendOpt(SYSPROP_PREFIX(), CURRENT_PREFIX()); for (String sysPropName : Arrays.asList( SYSPROP_STACKFILTERING(), SYSPROP_ITERATIONS(), SYSPROP_KILLATTEMPTS(), SYSPROP_KILLWAIT(), SYSPROP_TIMEOUT())) { if (System.getProperty(sysPropName) != null) { appendOpt(sysPropName, System.getProperty(sysPropName)); } } return this; }
/** * Append a single VM option. */ @Override public ReproduceErrorMessageBuilder appendOpt(String sysPropName, String value) { if (sysPropName.equals(SYSPROP_ITERATIONS())) { // we don't want the iters to be in there! return this; } if (sysPropName.equals(SYSPROP_TESTMETHOD())) { //don't print out the test method, we print it ourselves in appendAllOpts //without filtering out the parameters (needed for REST tests) return this; } if (sysPropName.equals(SYSPROP_PREFIX())) { // we always use the default prefix return this; } if (Strings.hasLength(value)) { return super.appendOpt(sysPropName, value); } return this; }