Remove System.err.println from tests

This commit is contained in:
Mahmoud Ben Hassine
2023-06-07 15:45:51 +02:00
parent 27e2ab02c0
commit 7f80b7230b
25 changed files with 30 additions and 66 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2022 the original author or authors.
* Copyright 2006-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,6 +30,7 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
/**
* @author Dave Syer
* @author Mahmoud Ben Hassine
*
*/
class JobRegistryBeanPostProcessorTests {
@@ -103,7 +104,6 @@ class JobRegistryBeanPostProcessorTests {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("test-context.xml", getClass());
MapJobRegistry registry = (MapJobRegistry) context.getBean("registry");
Collection<String> configurations = registry.getJobNames();
// System.err.println(configurations);
String[] names = context.getBeanNamesForType(JobSupport.class);
int count = names.length;
// Each concrete bean of type JobConfiguration is registered...

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -169,7 +169,6 @@ class ChunkElementParserTests {
@Test
void testRetryable() throws Exception {
Map<Class<? extends Throwable>, Boolean> retryable = getRetryableExceptionClasses("s1", getContext());
System.err.println(retryable);
assertEquals(3, retryable.size());
containsClassified(retryable, PessimisticLockingFailureException.class, true);
containsClassified(retryable, CannotSerializeTransactionException.class, false);
@@ -178,7 +177,6 @@ class ChunkElementParserTests {
@Test
void testRetryableInherited() throws Exception {
Map<Class<? extends Throwable>, Boolean> retryable = getRetryableExceptionClasses("s3", getContext());
System.err.println(retryable);
assertEquals(2, retryable.size());
containsClassified(retryable, IOException.class, true);
}
@@ -186,7 +184,6 @@ class ChunkElementParserTests {
@Test
void testRetryableInheritedMerge() throws Exception {
Map<Class<? extends Throwable>, Boolean> retryable = getRetryableExceptionClasses("s4", getContext());
System.err.println(retryable);
assertEquals(3, retryable.size());
containsClassified(retryable, IOException.class, true);
}
@@ -194,7 +191,6 @@ class ChunkElementParserTests {
@Test
void testInheritSkippable() throws Exception {
Map<Class<? extends Throwable>, Boolean> skippable = getSkippableExceptionClasses("s1", getContext());
System.err.println(skippable);
assertEquals(5, skippable.size());
containsClassified(skippable, NullPointerException.class, true);
containsClassified(skippable, ArithmeticException.class, true);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2022 the original author or authors.
* Copyright 2006-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,6 +36,7 @@ import org.springframework.test.util.ReflectionTestUtils;
/**
* @author Thomas Risberg
* @author Mahmoud Ben Hassine
*/
@SpringJUnitConfig
class StepWithSimpleTaskJobParserTests {
@@ -74,7 +75,6 @@ class StepWithSimpleTaskJobParserTests {
}
private TestTasklet assertTasklet(Job job, String stepName, String taskletName) {
System.err.println(((FlowJob) job).getStepNames());
Step step = ((FlowJob) job).getStep(stepName);
assertTrue(step instanceof TaskletStep, "Wrong type for step name=" + stepName + ": " + step);
Object tasklet = ReflectionTestUtils.getField(step, "tasklet");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2022 the original author or authors.
* Copyright 2006-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,6 +36,7 @@ import org.junit.jupiter.params.provider.MethodSource;
* use in the ExecutionContext around daylight savings.
*
* @author Dave Syer
* @author Mahmoud Ben Hassine
*
*/
class DateFormatTests {
@@ -55,7 +56,6 @@ class DateFormatTests {
GregorianCalendar calendar = new GregorianCalendar(TimeZone.getTimeZone("GMT"), Locale.UK);
calendar.setTime(date);
// System.err.println(format.toPattern() + " + " + input + " --> " +
// calendar.getTime());
// This assertion is true...

View File

@@ -536,7 +536,6 @@ class FaultTolerantStepFactoryBeanRetryTests {
assertEquals(7, provided.size());
// [a, b, c, a, b, c, a, b, c, a, b, c, a, b, c, a, b, c, d, e, f, d,
// e, f, d, e, f, d, e, f, d, e, f, d, e, f]
// System.err.println(processed);
assertEquals(36, processed.size());
// [b, d]
assertEquals(2, recovered.size());

View File

@@ -134,8 +134,6 @@ class AsyncTaskletStepTests {
assertTrue(stepExecution.getReadCount() >= 25);
assertTrue(processed.size() >= 25);
// System.err.println(stepExecution.getCommitCount());
// System.err.println(processed);
// Check commit count didn't spin out of control waiting for other
// threads to finish...
assertTrue(stepExecution.getCommitCount() > processed.size() / 2,

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2022 the original author or authors.
* Copyright 2006-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -34,7 +34,6 @@ class DatasourceTests {
@Transactional
@Test
void testTemplate() {
System.err.println(System.getProperty("java.class.path"));
JdbcTestUtils.deleteFromTables(jdbcTemplate, "T_BARS");
int count = JdbcTestUtils.countRowsInTable(jdbcTemplate, "T_BARS");
assertEquals(0, count);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2022 the original author or authors.
* Copyright 2006-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -45,7 +45,6 @@ class MessagingTests {
@Test
void testMessaging() {
List<String> list = getMessages();
System.err.println(list);
assertEquals(2, list.size());
assertTrue(list.contains("foo"));
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2022 the original author or authors.
* Copyright 2006-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -63,7 +63,6 @@ class TransactionAwareListItemReaderTests {
taken.add(next);
next = reader.read();
}
// System.err.println(taken);
assertFalse(taken.contains("a"));
}
@@ -104,7 +103,6 @@ class TransactionAwareListItemReaderTests {
taken.add(next);
next = reader.read();
}
System.err.println(taken);
assertTrue(taken.contains("a"));
}

View File

@@ -181,15 +181,10 @@ class ExternalRetryInBatchTests {
}
}
finally {
System.err.println(i + ": " + recovered);
}
}
List<String> msgs = getMessages();
System.err.println(msgs);
assertEquals(2, recovered.size());
// The database portion committed once...

View File

@@ -113,8 +113,6 @@ class AsynchronousTests {
// Need to sleep for at least a second here...
waitFor(list, 2, 2000);
System.err.println(jdbcTemplate.queryForList("select * from T_BARS"));
assertEquals(2, list.size());
String foo = (String) jmsTemplate.receiveAndConvert("queue");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2022 the original author or authors.
* Copyright 2006-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -262,7 +262,6 @@ class RepeatListenerTests {
}));
assertEquals("Bogus", exception.getMessage());
assertEquals(0, count);
System.err.println(calls);
// The after is not executed on error...
assertEquals("2", calls.get(0));
assertEquals("2", calls.get(calls.size() - 1));

View File

@@ -366,8 +366,6 @@ class SimpleRepeatTemplateTests extends AbstractTradeBatchTests {
// 2 items were processed before completion signalled
assertEquals(2, processor.count);
System.err.println(result);
// An exception was thrown by the template so result is still false
assertFalse(result.isContinuable());

View File

@@ -205,7 +205,6 @@ class TaskExecutorRepeatTemplateAsynchronousTests extends AbstractTradeBatchTest
assertEquals(NUMBER_OF_ITEMS, processor.count);
assertTrue(threadNames.size() > 1);
int frequency = Collections.frequency(items, "null");
// System.err.println("Frequency: "+frequency);
assertTrue(frequency <= throttleLimit);
}
@@ -251,7 +250,6 @@ class TaskExecutorRepeatTemplateAsynchronousTests extends AbstractTradeBatchTest
// Because of the throttling and queueing internally to a TaskExecutor,
// more than one thread will be used - the number used is the
// concurrency limit in the task executor, plus 1.
// System.err.println(threadNames);
assertTrue(threadNames.size() >= 1);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2022 the original author or authors.
* Copyright 2006-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -45,6 +45,7 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
* though.
*
* @author Dave Syer
* @author Mahmoud Ben Hassine
*
*/
class TaskExecutorRepeatTemplateBulkAsynchronousTests {
@@ -121,8 +122,6 @@ class TaskExecutorRepeatTemplateBulkAsynchronousTests {
template.iterate(callback);
int frequency = Collections.frequency(items, "null");
// System.err.println(items);
// System.err.println("Frequency: " + frequency);
assertEquals(total, items.size() - frequency);
assertTrue(frequency > 1);
assertTrue(frequency <= throttleLimit + 1);
@@ -136,8 +135,6 @@ class TaskExecutorRepeatTemplateBulkAsynchronousTests {
template.iterate(callback);
int frequency = Collections.frequency(items, "null");
// System.err.println("Frequency: " + frequency);
// System.err.println("Items: " + items);
assertEquals(total, items.size() - frequency);
assertTrue(frequency > 1);
assertTrue(frequency <= throttleLimit + 1);
@@ -162,8 +159,6 @@ class TaskExecutorRepeatTemplateBulkAsynchronousTests {
template.iterate(callback);
int frequency = Collections.frequency(items, "null");
// System.err.println("Frequency: " + frequency);
// System.err.println("Items: " + items);
// Extra tasks will be submitted before the termination is detected
assertEquals(total, items.size() - frequency);
assertTrue(frequency <= throttleLimit + 1);
@@ -188,8 +183,6 @@ class TaskExecutorRepeatTemplateBulkAsynchronousTests {
template.iterate(callback);
int frequency = Collections.frequency(items, "null");
// System.err.println("Frequency: " + frequency);
// System.err.println("Items: " + items);
assertEquals(total, items.size() - frequency);
assertTrue(frequency <= throttleLimit + 1);
@@ -204,7 +197,6 @@ class TaskExecutorRepeatTemplateBulkAsynchronousTests {
template.iterate(callback);
int frequency = Collections.frequency(items, "null");
assertEquals(10, items.size() - frequency);
// System.err.println("Frequency: " + frequency);
assertEquals(0, frequency);
}

View File

@@ -120,7 +120,6 @@ public class SynchronousTests {
public String doInTransaction(TransactionStatus status) {
list.add(text);
System.err.println("Inserting: [" + list.size() + "," + text + "]");
jdbcTemplate.update("INSERT into T_BARS (id,name,foo_date) values (?,?,null)", list.size(),
text);
if (list.size() == 1) {
@@ -174,7 +173,6 @@ public class SynchronousTests {
public String doInTransaction(TransactionStatus status) {
list.add(item);
System.err.println("Inserting: [" + list.size() + "," + item + "]");
jdbcTemplate.update("INSERT into T_BARS (id,name,foo_date) values (?,?,null)", list.size(),
item);
if (list.size() == 1) {
@@ -239,7 +237,6 @@ public class SynchronousTests {
public String doInTransaction(TransactionStatus nestedStatus) {
list.add(text);
System.err.println("Inserting: [" + list.size() + "," + text + "]");
jdbcTemplate.update("INSERT into T_BARS (id,name,foo_date) values (?,?,null)",
list.size(), text);
return text;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2022 the original author or authors.
* Copyright 2014-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,6 +28,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* @author Michael Minella
* @author Mahmoud Ben Hassine
* @since 2.2.6
*/
class ReflectionUtilsTests {
@@ -79,7 +80,6 @@ class ReflectionUtilsTests {
public static class AnnotatedClass {
public void methodOne() {
System.err.println("This is method 1");
}
@Transactional
@@ -93,7 +93,6 @@ class ReflectionUtilsTests {
@Transactional
public void methodOne() {
System.err.println("This is method 1 in the sub class");
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2021-2022 the original author or authors.
* Copyright 2021-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -105,7 +105,6 @@ class ChunkMessageItemWriterIntegrationTests {
// Drain queues
Message<?> message = replies.receive(10);
while (message != null) {
System.err.println(message);
message = replies.receive(10);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2022 the original author or authors.
* Copyright 2006-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -51,7 +51,9 @@ class ChunkRequestTests {
@Test
void testToString() {
System.err.println(request.toString());
assertEquals(
"ChunkRequest: jobId=111, sequence=0, contribution=[StepContribution: read=0, written=0, filtered=0, readSkips=0, writeSkips=0, processSkips=0, exitStatus=EXECUTING], item count=2",
request.toString());
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2022 the original author or authors.
* Copyright 2006-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,6 +24,7 @@ import org.springframework.util.SerializationUtils;
/**
* @author Dave Syer
* @author Mahmoud Ben Hassine
*
*/
class ChunkResponseTests {
@@ -43,7 +44,9 @@ class ChunkResponseTests {
@Test
void testToString() {
System.err.println(response.toString());
assertEquals(
"ChunkResponse: jobId=111, sequence=0, stepContribution=[StepContribution: read=0, written=0, filtered=0, readSkips=0, writeSkips=0, processSkips=0, exitStatus=EXECUTING], successful=true",
response.toString());
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2022 the original author or authors.
* Copyright 2010-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -50,7 +50,6 @@ class RemoteChunkFaultTolerantStepIntegrationTests {
void drain() {
Message<?> message = replies.receive(100L);
while (message != null) {
// System.err.println(message);
message = replies.receive(100L);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2022 the original author or authors.
* Copyright 2006-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,6 +35,7 @@ import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
/**
* @author Dave Syer
* @author Mahmoud Ben Hassine
*
*/
@SpringJUnitConfig
@@ -58,7 +59,6 @@ class ResourceSplitterIntegrationTests {
@Splitter(inputChannel = "resources", outputChannel = "requests")
public Resource[] handle(Resource[] message) {
List<Resource> list = Arrays.asList(message);
System.err.println(list);
return message;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2022 the original author or authors.
* Copyright 2010-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -98,7 +98,6 @@ class RetryRepeatTransactionalPollingIntegrationTests implements ApplicationCont
service.setExpected(expected);
waitForResults(lifecycle, expected.size(), 60); // (a,b), (fail), (fail),
// ([fail],d), (e,f)
System.err.println(service.getProcessed());
assertEquals(7, service.getProcessed().size()); // a,b,fail,fail,d,e,f
assertEquals(1, recoverer.getRecovered().size()); // fail
assertEquals(expected, service.getProcessed());

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2022 the original author or authors.
* Copyright 2010-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -100,7 +100,6 @@ public class RetryTransactionalPollingIntegrationTests implements ApplicationCon
List<String> expected = Arrays.asList(StringUtils.commaDelimitedListToStringArray("a,b,fail,fail,d,e"));
service.setExpected(expected);
waitForResults(bus, expected.size(), 100); // a, b, (fail, fail, [fail]), d, e
// System.err.println(service.getProcessed());
assertEquals(6, service.getProcessed().size()); // a,b,fail,fail,d,e
assertEquals(1, recoverer.getRecovered().size()); // fail
assertEquals(expected, service.getProcessed());

View File

@@ -265,7 +265,6 @@ class SkipSampleFunctionalTests {
// Step2: 7 input records, 1 skipped on process, 1 on write => 5 written
// to output
// System.err.println(jdbcTemplate.queryForList("SELECT * FROM TRADE"));
assertEquals(5, JdbcTestUtils.countRowsInTableWhere(jdbcTemplate, "TRADE", "VERSION=1"));
// 1 record skipped in processing second step
@@ -281,7 +280,6 @@ class SkipSampleFunctionalTests {
jdbcTemplate.queryForObject("SELECT MESSAGE from ERROR_LOG where JOB_NAME = ? and STEP_NAME = ?",
String.class, "skipJob", "step2"));
System.err.println(jobExecution.getExecutionContext());
assertEquals(new BigDecimal("340.45"), jobExecution.getExecutionContext().get(TradeWriter.TOTAL_AMOUNT_KEY));
Map<String, Object> step1Execution = getStepExecutionAsMap(jobExecution, "step1");