|
@@ -151,6 +151,8 @@ public class TestDFSInotifyEventInputStream {
|
|
Assert.assertEquals("/file4", re.getDstPath());
|
|
Assert.assertEquals("/file4", re.getDstPath());
|
|
Assert.assertEquals("/file", re.getSrcPath());
|
|
Assert.assertEquals("/file", re.getSrcPath());
|
|
Assert.assertTrue(re.getTimestamp() > 0);
|
|
Assert.assertTrue(re.getTimestamp() > 0);
|
|
|
|
+ LOG.info(re.toString());
|
|
|
|
+ Assert.assertTrue(re.toString().startsWith("RenameEvent [srcPath="));
|
|
|
|
|
|
long eventsBehind = eis.getTxidsBehindEstimate();
|
|
long eventsBehind = eis.getTxidsBehindEstimate();
|
|
|
|
|
|
@@ -163,6 +165,7 @@ public class TestDFSInotifyEventInputStream {
|
|
Assert.assertTrue(re2.getDstPath().equals("/file2"));
|
|
Assert.assertTrue(re2.getDstPath().equals("/file2"));
|
|
Assert.assertTrue(re2.getSrcPath().equals("/file4"));
|
|
Assert.assertTrue(re2.getSrcPath().equals("/file4"));
|
|
Assert.assertTrue(re.getTimestamp() > 0);
|
|
Assert.assertTrue(re.getTimestamp() > 0);
|
|
|
|
+ LOG.info(re2.toString());
|
|
|
|
|
|
// AddOp with overwrite
|
|
// AddOp with overwrite
|
|
batch = waitForNextEvents(eis);
|
|
batch = waitForNextEvents(eis);
|
|
@@ -177,6 +180,8 @@ public class TestDFSInotifyEventInputStream {
|
|
Assert.assertTrue(ce.getSymlinkTarget() == null);
|
|
Assert.assertTrue(ce.getSymlinkTarget() == null);
|
|
Assert.assertTrue(ce.getOverwrite());
|
|
Assert.assertTrue(ce.getOverwrite());
|
|
Assert.assertEquals(BLOCK_SIZE, ce.getDefaultBlockSize());
|
|
Assert.assertEquals(BLOCK_SIZE, ce.getDefaultBlockSize());
|
|
|
|
+ LOG.info(ce.toString());
|
|
|
|
+ Assert.assertTrue(ce.toString().startsWith("CreateEvent [INodeType="));
|
|
|
|
|
|
// CloseOp
|
|
// CloseOp
|
|
batch = waitForNextEvents(eis);
|
|
batch = waitForNextEvents(eis);
|
|
@@ -187,6 +192,8 @@ public class TestDFSInotifyEventInputStream {
|
|
Assert.assertTrue(ce2.getPath().equals("/file2"));
|
|
Assert.assertTrue(ce2.getPath().equals("/file2"));
|
|
Assert.assertTrue(ce2.getFileSize() > 0);
|
|
Assert.assertTrue(ce2.getFileSize() > 0);
|
|
Assert.assertTrue(ce2.getTimestamp() > 0);
|
|
Assert.assertTrue(ce2.getTimestamp() > 0);
|
|
|
|
+ LOG.info(ce2.toString());
|
|
|
|
+ Assert.assertTrue(ce2.toString().startsWith("CloseEvent [path="));
|
|
|
|
|
|
// AppendOp
|
|
// AppendOp
|
|
batch = waitForNextEvents(eis);
|
|
batch = waitForNextEvents(eis);
|
|
@@ -196,6 +203,8 @@ public class TestDFSInotifyEventInputStream {
|
|
Event.AppendEvent append2 = (Event.AppendEvent)batch.getEvents()[0];
|
|
Event.AppendEvent append2 = (Event.AppendEvent)batch.getEvents()[0];
|
|
Assert.assertEquals("/file2", append2.getPath());
|
|
Assert.assertEquals("/file2", append2.getPath());
|
|
Assert.assertFalse(append2.toNewBlock());
|
|
Assert.assertFalse(append2.toNewBlock());
|
|
|
|
+ LOG.info(append2.toString());
|
|
|
|
+ Assert.assertTrue(append2.toString().startsWith("AppendEvent [path="));
|
|
|
|
|
|
// CloseOp
|
|
// CloseOp
|
|
batch = waitForNextEvents(eis);
|
|
batch = waitForNextEvents(eis);
|
|
@@ -213,6 +222,8 @@ public class TestDFSInotifyEventInputStream {
|
|
Assert.assertTrue(mue.getPath().equals("/file2"));
|
|
Assert.assertTrue(mue.getPath().equals("/file2"));
|
|
Assert.assertTrue(mue.getMetadataType() ==
|
|
Assert.assertTrue(mue.getMetadataType() ==
|
|
Event.MetadataUpdateEvent.MetadataType.TIMES);
|
|
Event.MetadataUpdateEvent.MetadataType.TIMES);
|
|
|
|
+ LOG.info(mue.toString());
|
|
|
|
+ Assert.assertTrue(mue.toString().startsWith("MetadataUpdateEvent [path="));
|
|
|
|
|
|
// SetReplicationOp
|
|
// SetReplicationOp
|
|
batch = waitForNextEvents(eis);
|
|
batch = waitForNextEvents(eis);
|
|
@@ -224,6 +235,7 @@ public class TestDFSInotifyEventInputStream {
|
|
Assert.assertTrue(mue2.getMetadataType() ==
|
|
Assert.assertTrue(mue2.getMetadataType() ==
|
|
Event.MetadataUpdateEvent.MetadataType.REPLICATION);
|
|
Event.MetadataUpdateEvent.MetadataType.REPLICATION);
|
|
Assert.assertTrue(mue2.getReplication() == 1);
|
|
Assert.assertTrue(mue2.getReplication() == 1);
|
|
|
|
+ LOG.info(mue2.toString());
|
|
|
|
|
|
// ConcatDeleteOp
|
|
// ConcatDeleteOp
|
|
batch = waitForNextEvents(eis);
|
|
batch = waitForNextEvents(eis);
|
|
@@ -235,6 +247,8 @@ public class TestDFSInotifyEventInputStream {
|
|
Event.UnlinkEvent ue2 = (Event.UnlinkEvent) batch.getEvents()[1];
|
|
Event.UnlinkEvent ue2 = (Event.UnlinkEvent) batch.getEvents()[1];
|
|
Assert.assertTrue(ue2.getPath().equals("/file3"));
|
|
Assert.assertTrue(ue2.getPath().equals("/file3"));
|
|
Assert.assertTrue(ue2.getTimestamp() > 0);
|
|
Assert.assertTrue(ue2.getTimestamp() > 0);
|
|
|
|
+ LOG.info(ue2.toString());
|
|
|
|
+ Assert.assertTrue(ue2.toString().startsWith("UnlinkEvent [path="));
|
|
Assert.assertTrue(batch.getEvents()[2].getEventType() == Event.EventType.CLOSE);
|
|
Assert.assertTrue(batch.getEvents()[2].getEventType() == Event.EventType.CLOSE);
|
|
Event.CloseEvent ce3 = (Event.CloseEvent) batch.getEvents()[2];
|
|
Event.CloseEvent ce3 = (Event.CloseEvent) batch.getEvents()[2];
|
|
Assert.assertTrue(ce3.getPath().equals("/file2"));
|
|
Assert.assertTrue(ce3.getPath().equals("/file2"));
|
|
@@ -248,6 +262,7 @@ public class TestDFSInotifyEventInputStream {
|
|
Event.UnlinkEvent ue = (Event.UnlinkEvent) batch.getEvents()[0];
|
|
Event.UnlinkEvent ue = (Event.UnlinkEvent) batch.getEvents()[0];
|
|
Assert.assertTrue(ue.getPath().equals("/file2"));
|
|
Assert.assertTrue(ue.getPath().equals("/file2"));
|
|
Assert.assertTrue(ue.getTimestamp() > 0);
|
|
Assert.assertTrue(ue.getTimestamp() > 0);
|
|
|
|
+ LOG.info(ue.toString());
|
|
|
|
|
|
// MkdirOp
|
|
// MkdirOp
|
|
batch = waitForNextEvents(eis);
|
|
batch = waitForNextEvents(eis);
|
|
@@ -261,6 +276,7 @@ public class TestDFSInotifyEventInputStream {
|
|
Assert.assertTrue(ce4.getCtime() > 0);
|
|
Assert.assertTrue(ce4.getCtime() > 0);
|
|
Assert.assertTrue(ce4.getReplication() == 0);
|
|
Assert.assertTrue(ce4.getReplication() == 0);
|
|
Assert.assertTrue(ce4.getSymlinkTarget() == null);
|
|
Assert.assertTrue(ce4.getSymlinkTarget() == null);
|
|
|
|
+ LOG.info(ce4.toString());
|
|
|
|
|
|
// SetPermissionsOp
|
|
// SetPermissionsOp
|
|
batch = waitForNextEvents(eis);
|
|
batch = waitForNextEvents(eis);
|
|
@@ -272,6 +288,7 @@ public class TestDFSInotifyEventInputStream {
|
|
Assert.assertTrue(mue3.getMetadataType() ==
|
|
Assert.assertTrue(mue3.getMetadataType() ==
|
|
Event.MetadataUpdateEvent.MetadataType.PERMS);
|
|
Event.MetadataUpdateEvent.MetadataType.PERMS);
|
|
Assert.assertTrue(mue3.getPerms().toString().contains("rw-rw-rw-"));
|
|
Assert.assertTrue(mue3.getPerms().toString().contains("rw-rw-rw-"));
|
|
|
|
+ LOG.info(mue3.toString());
|
|
|
|
|
|
// SetOwnerOp
|
|
// SetOwnerOp
|
|
batch = waitForNextEvents(eis);
|
|
batch = waitForNextEvents(eis);
|
|
@@ -284,6 +301,7 @@ public class TestDFSInotifyEventInputStream {
|
|
Event.MetadataUpdateEvent.MetadataType.OWNER);
|
|
Event.MetadataUpdateEvent.MetadataType.OWNER);
|
|
Assert.assertTrue(mue4.getOwnerName().equals("username"));
|
|
Assert.assertTrue(mue4.getOwnerName().equals("username"));
|
|
Assert.assertTrue(mue4.getGroupName().equals("groupname"));
|
|
Assert.assertTrue(mue4.getGroupName().equals("groupname"));
|
|
|
|
+ LOG.info(mue4.toString());
|
|
|
|
|
|
// SymlinkOp
|
|
// SymlinkOp
|
|
batch = waitForNextEvents(eis);
|
|
batch = waitForNextEvents(eis);
|
|
@@ -297,6 +315,7 @@ public class TestDFSInotifyEventInputStream {
|
|
Assert.assertTrue(ce5.getCtime() > 0);
|
|
Assert.assertTrue(ce5.getCtime() > 0);
|
|
Assert.assertTrue(ce5.getReplication() == 0);
|
|
Assert.assertTrue(ce5.getReplication() == 0);
|
|
Assert.assertTrue(ce5.getSymlinkTarget().equals("/dir"));
|
|
Assert.assertTrue(ce5.getSymlinkTarget().equals("/dir"));
|
|
|
|
+ LOG.info(ce5.toString());
|
|
|
|
|
|
// SetXAttrOp
|
|
// SetXAttrOp
|
|
batch = waitForNextEvents(eis);
|
|
batch = waitForNextEvents(eis);
|
|
@@ -310,6 +329,7 @@ public class TestDFSInotifyEventInputStream {
|
|
Assert.assertTrue(mue5.getxAttrs().size() == 1);
|
|
Assert.assertTrue(mue5.getxAttrs().size() == 1);
|
|
Assert.assertTrue(mue5.getxAttrs().get(0).getName().contains("field"));
|
|
Assert.assertTrue(mue5.getxAttrs().get(0).getName().contains("field"));
|
|
Assert.assertTrue(!mue5.isxAttrsRemoved());
|
|
Assert.assertTrue(!mue5.isxAttrsRemoved());
|
|
|
|
+ LOG.info(mue5.toString());
|
|
|
|
|
|
// RemoveXAttrOp
|
|
// RemoveXAttrOp
|
|
batch = waitForNextEvents(eis);
|
|
batch = waitForNextEvents(eis);
|
|
@@ -323,6 +343,7 @@ public class TestDFSInotifyEventInputStream {
|
|
Assert.assertTrue(mue6.getxAttrs().size() == 1);
|
|
Assert.assertTrue(mue6.getxAttrs().size() == 1);
|
|
Assert.assertTrue(mue6.getxAttrs().get(0).getName().contains("field"));
|
|
Assert.assertTrue(mue6.getxAttrs().get(0).getName().contains("field"));
|
|
Assert.assertTrue(mue6.isxAttrsRemoved());
|
|
Assert.assertTrue(mue6.isxAttrsRemoved());
|
|
|
|
+ LOG.info(mue6.toString());
|
|
|
|
|
|
// SetAclOp (1)
|
|
// SetAclOp (1)
|
|
batch = waitForNextEvents(eis);
|
|
batch = waitForNextEvents(eis);
|
|
@@ -335,6 +356,7 @@ public class TestDFSInotifyEventInputStream {
|
|
Event.MetadataUpdateEvent.MetadataType.ACLS);
|
|
Event.MetadataUpdateEvent.MetadataType.ACLS);
|
|
Assert.assertTrue(mue7.getAcls().contains(
|
|
Assert.assertTrue(mue7.getAcls().contains(
|
|
AclEntry.parseAclEntry("user::rwx", true)));
|
|
AclEntry.parseAclEntry("user::rwx", true)));
|
|
|
|
+ LOG.info(mue7.toString());
|
|
|
|
|
|
// SetAclOp (2)
|
|
// SetAclOp (2)
|
|
batch = waitForNextEvents(eis);
|
|
batch = waitForNextEvents(eis);
|
|
@@ -346,6 +368,7 @@ public class TestDFSInotifyEventInputStream {
|
|
Assert.assertTrue(mue8.getMetadataType() ==
|
|
Assert.assertTrue(mue8.getMetadataType() ==
|
|
Event.MetadataUpdateEvent.MetadataType.ACLS);
|
|
Event.MetadataUpdateEvent.MetadataType.ACLS);
|
|
Assert.assertTrue(mue8.getAcls() == null);
|
|
Assert.assertTrue(mue8.getAcls() == null);
|
|
|
|
+ LOG.info(mue8.toString());
|
|
|
|
|
|
// RenameOp (2)
|
|
// RenameOp (2)
|
|
batch = waitForNextEvents(eis);
|
|
batch = waitForNextEvents(eis);
|
|
@@ -356,6 +379,7 @@ public class TestDFSInotifyEventInputStream {
|
|
Assert.assertTrue(re3.getDstPath().equals("/dir/file5"));
|
|
Assert.assertTrue(re3.getDstPath().equals("/dir/file5"));
|
|
Assert.assertTrue(re3.getSrcPath().equals("/file5"));
|
|
Assert.assertTrue(re3.getSrcPath().equals("/file5"));
|
|
Assert.assertTrue(re.getTimestamp() > 0);
|
|
Assert.assertTrue(re.getTimestamp() > 0);
|
|
|
|
+ LOG.info(re3.toString());
|
|
|
|
|
|
// TruncateOp
|
|
// TruncateOp
|
|
batch = waitForNextEvents(eis);
|
|
batch = waitForNextEvents(eis);
|
|
@@ -368,6 +392,8 @@ public class TestDFSInotifyEventInputStream {
|
|
Assert.assertTrue(et.getPath().equals("/truncate_file"));
|
|
Assert.assertTrue(et.getPath().equals("/truncate_file"));
|
|
Assert.assertTrue(et.getFileSize() == BLOCK_SIZE);
|
|
Assert.assertTrue(et.getFileSize() == BLOCK_SIZE);
|
|
Assert.assertTrue(et.getTimestamp() > 0);
|
|
Assert.assertTrue(et.getTimestamp() > 0);
|
|
|
|
+ LOG.info(et.toString());
|
|
|
|
+ Assert.assertTrue(et.toString().startsWith("TruncateEvent [path="));
|
|
|
|
|
|
// Returns null when there are no further events
|
|
// Returns null when there are no further events
|
|
Assert.assertTrue(eis.poll() == null);
|
|
Assert.assertTrue(eis.poll() == null);
|