public void testBasicPatternMatching() {
try {
Filter rules = new Filter("host=foo.*&cluster=bar&datatype=Data");
assertEquals(3, rules.size());
byte[] dat = "someText".getBytes();
ChunkImpl chunkNone = new ChunkImpl("badData","aname", dat.length, dat, null);
assertFalse(rules.matches(chunkNone));
assertTrue(Filter.ALL.matches(chunkNone));
//do the right thing on a non-match
ChunkImpl chunkSome = new ChunkImpl("badData", "aname", dat.length, dat, null);
chunkSome.setSource("fooly");
chunkSome.addTag("cluster=\"bar\"");
assertFalse(rules.matches( chunkSome));
assertTrue(Filter.ALL.matches(chunkSome));
ChunkImpl chunkAll = new ChunkImpl("Data", "aname", dat.length, dat, null);
chunkAll.setSource("fooly");
chunkAll.addTag("cluster=\"bar\"");
assertTrue(rules.matches(chunkAll));
assertTrue(Filter.ALL.matches(chunkAll));