mirror of
https://github.com/Febbweiss/logstash-forwarder-java.git
synced 2026-03-05 06:35:44 +00:00
Create new ProtocolAdapter if connection is lost.
This commit is contained in:
@@ -18,6 +18,7 @@ package info.fetter.logstashforwarder;
|
||||
*/
|
||||
|
||||
import static org.apache.log4j.Level.*;
|
||||
import info.fetter.logstashforwarder.util.AdapterException;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -47,7 +48,7 @@ public class FileReaderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFileReader1() throws IOException, InterruptedException {
|
||||
public void testFileReader1() throws IOException, InterruptedException, AdapterException {
|
||||
FileReader reader = new FileReader(2);
|
||||
reader.setAdapter(new MockProtocolAdapter());
|
||||
List<FileState> fileList = new ArrayList<FileState>(1);
|
||||
|
||||
@@ -17,7 +17,6 @@ package info.fetter.logstashforwarder;
|
||||
*
|
||||
*/
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
@@ -25,7 +24,7 @@ import org.apache.log4j.Logger;
|
||||
public class MockProtocolAdapter implements ProtocolAdapter {
|
||||
private static Logger logger = Logger.getLogger(MockProtocolAdapter.class);
|
||||
|
||||
public int sendEvents(List<Event> eventList) throws IOException {
|
||||
public int sendEvents(List<Event> eventList) {
|
||||
for(Event event : eventList) {
|
||||
logger.trace("Event :");
|
||||
for(String key : event.getKeyValues().keySet()) {
|
||||
@@ -35,7 +34,7 @@ public class MockProtocolAdapter implements ProtocolAdapter {
|
||||
return eventList.size();
|
||||
}
|
||||
|
||||
public void close() throws IOException {
|
||||
public void close() {
|
||||
// not implemented
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user