INT-2855 Fix Tail Test on Build Server

- Fix tail test
 - Fix 2 javadoc issues
This commit is contained in:
Gary Russell
2013-05-20 21:18:49 -04:00
parent 20d7c30fd0
commit ccf7492097
4 changed files with 18 additions and 9 deletions

View File

@@ -42,7 +42,7 @@ public interface ChannelRegistry {
/**
* Create a tap on an already registered inbound channel
* @param the registered name
* @param name the registered name
* @param channel the channel that will receive messages from the tap
*/
void tap(String name, MessageChannel channel);

View File

@@ -79,7 +79,7 @@ public abstract class FileTailingMessageProducerSupport extends MessageProducerS
/**
* The delay in milliseconds between attempts to tail a non-existent file,
* or between attempts to execute a process if it fails for any reason.
* @param missingFileDelay the delay.
* @param tailAttemptsDelay the delay.
*/
public void setTailAttemptsDelay(long tailAttemptsDelay) {
Assert.isTrue(tailAttemptsDelay > 0, "'tailAttemptsDelay' must be > 0");

View File

@@ -209,14 +209,18 @@ public class OSDelegatingFileTailingMessageProducer extends FileTailingMessagePr
}
}
catch (IOException e) {
logger.error("Exception on tail error reader", e);
if (logger.isDebugEnabled()) {
logger.debug("Exception on tail error reader", e);
}
}
finally {
try {
errorReader.close();
}
catch (IOException e) {
logger.error("Exception while closing stderr", e);
if (logger.isDebugEnabled()) {
logger.debug("Exception while closing stderr", e);
}
}
}
}
@@ -238,12 +242,16 @@ public class OSDelegatingFileTailingMessageProducer extends FileTailingMessagePr
}
}
catch (IOException e) {
logger.error("Exception on tail reader", e);
if (logger.isDebugEnabled()) {
logger.debug("Exception on tail reader", e);
}
try {
this.reader.close();
}
catch (IOException e1) {
if (logger.isDebugEnabled()) {
logger.debug("Exception while closing stdout", e);
}
}
this.destroyProcess();
}

View File

@@ -116,13 +116,14 @@ public class FileTailingMessageProducerTests {
foo.write(("hello" + i + "\n").getBytes());
}
foo.flush();
foo.close();
for (int i = 0; i < 50; i++) {
Message<?> message = outputChannel.receive(5000);
assertNotNull("expected a non-null message", message);
assertEquals("hello" + i, message.getPayload());
}
file.renameTo(renamed);
foo.close();
file = new File(testDir, "foo");
foo = new FileOutputStream(file);
if (adapter instanceof ApacheCommonsFileTailingMessageProducer) {
Thread.sleep(1000);
@@ -131,12 +132,12 @@ public class FileTailingMessageProducerTests {
foo.write(("hello" + i + "\n").getBytes());
}
foo.flush();
foo.close();
for (int i = 50; i < 100; i++) {
Message<?> message = outputChannel.receive(3000);
Message<?> message = outputChannel.receive(10000);
assertNotNull("expected a non-null message", message);
assertEquals("hello" + i, message.getPayload());
}
foo.close();
}
private void waitForField(FileTailingMessageProducerSupport adapter, String field) throws Exception {