YARN-6146. Add Builder methods for TimelineEntityFilters (Haibo Chen via Varun Saxena)

This commit is contained in:
Varun Saxena 2017-03-23 14:35:37 +05:30
parent 44999aabc2
commit b87b72b40a
9 changed files with 381 additions and 380 deletions

View File

@ -660,7 +660,7 @@ public class TestHBaseTimelineStorageApps {
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, null, TimelineEntityType.YARN_APPLICATION.toString(),
null),
new TimelineEntityFilters(),
new TimelineEntityFilters.Builder().build(),
new TimelineDataToRetrieve(null, null, EnumSet.of(Field.ALL), null));
assertEquals(3, entities.size());
int cfgCnt = 0;
@ -697,8 +697,8 @@ public class TestHBaseTimelineStorageApps {
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, null, TimelineEntityType.YARN_APPLICATION.toString(),
null),
new TimelineEntityFilters(null, 1425016502000L, 1425016502040L, null,
null, null, null, null, null),
new TimelineEntityFilters.Builder().createdTimeBegin(1425016502000L)
.createTimeEnd(1425016502040L).build(),
new TimelineDataToRetrieve());
assertEquals(3, entities.size());
for (TimelineEntity entity : entities) {
@ -714,8 +714,8 @@ public class TestHBaseTimelineStorageApps {
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, null, TimelineEntityType.YARN_APPLICATION.toString(),
null),
new TimelineEntityFilters(null, 1425016502015L, null, null, null, null,
null, null, null),
new TimelineEntityFilters.Builder().createdTimeBegin(1425016502015L)
.build(),
new TimelineDataToRetrieve());
assertEquals(2, entities.size());
for (TimelineEntity entity : entities) {
@ -729,8 +729,8 @@ public class TestHBaseTimelineStorageApps {
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, null, TimelineEntityType.YARN_APPLICATION.toString(),
null),
new TimelineEntityFilters(null, null, 1425016502015L, null, null, null,
null, null, null),
new TimelineEntityFilters.Builder().createTimeEnd(1425016502015L)
.build(),
new TimelineDataToRetrieve());
assertEquals(1, entities.size());
for (TimelineEntity entity : entities) {
@ -757,7 +757,7 @@ public class TestHBaseTimelineStorageApps {
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, null, TimelineEntityType.YARN_APPLICATION.toString(),
null),
new TimelineEntityFilters(),
new TimelineEntityFilters.Builder().build(),
new TimelineDataToRetrieve());
assertEquals(3, es1.size());
for (TimelineEntity e : es1) {
@ -783,7 +783,7 @@ public class TestHBaseTimelineStorageApps {
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, null, TimelineEntityType.YARN_APPLICATION.toString(),
null),
new TimelineEntityFilters(),
new TimelineEntityFilters.Builder().build(),
new TimelineDataToRetrieve(
null, null, EnumSet.of(Field.IS_RELATED_TO, Field.METRICS), null));
assertEquals(3, es1.size());
@ -813,8 +813,7 @@ public class TestHBaseTimelineStorageApps {
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, null, TimelineEntityType.YARN_APPLICATION.toString(),
null),
new TimelineEntityFilters(null, null, null, null, irt, null, null, null,
null),
new TimelineEntityFilters.Builder().isRelatedTo(irt).build(),
new TimelineDataToRetrieve(null, null, EnumSet.of(Field.ALL), null));
assertEquals(2, entities.size());
int isRelatedToCnt = 0;
@ -839,8 +838,7 @@ public class TestHBaseTimelineStorageApps {
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, null, TimelineEntityType.YARN_APPLICATION.toString(),
null),
new TimelineEntityFilters(null, null, null, null, irt1, null, null,
null, null),
new TimelineEntityFilters.Builder().isRelatedTo(irt1).build(),
new TimelineDataToRetrieve());
assertEquals(1, entities.size());
isRelatedToCnt = 0;
@ -863,8 +861,7 @@ public class TestHBaseTimelineStorageApps {
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, null, TimelineEntityType.YARN_APPLICATION.toString(),
null),
new TimelineEntityFilters(null, null, null, null, irt2, null, null,
null, null),
new TimelineEntityFilters.Builder().isRelatedTo(irt2).build(),
new TimelineDataToRetrieve());
assertEquals(2, entities.size());
isRelatedToCnt = 0;
@ -886,8 +883,7 @@ public class TestHBaseTimelineStorageApps {
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, null, TimelineEntityType.YARN_APPLICATION.toString(),
null),
new TimelineEntityFilters(null, null, null, null, irt3, null, null,
null, null),
new TimelineEntityFilters.Builder().isRelatedTo(irt3).build(),
new TimelineDataToRetrieve());
assertEquals(1, entities.size());
isRelatedToCnt = 0;
@ -910,8 +906,7 @@ public class TestHBaseTimelineStorageApps {
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, null, TimelineEntityType.YARN_APPLICATION.toString(),
null),
new TimelineEntityFilters(null, null, null, null, irt4, null, null,
null, null),
new TimelineEntityFilters.Builder().isRelatedTo(irt4).build(),
new TimelineDataToRetrieve());
assertEquals(0, entities.size());
@ -923,8 +918,7 @@ public class TestHBaseTimelineStorageApps {
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, null, TimelineEntityType.YARN_APPLICATION.toString(),
null),
new TimelineEntityFilters(null, null, null, null, irt5, null, null,
null, null),
new TimelineEntityFilters.Builder().isRelatedTo(irt5).build(),
new TimelineDataToRetrieve());
assertEquals(0, entities.size());
@ -944,8 +938,7 @@ public class TestHBaseTimelineStorageApps {
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, null, TimelineEntityType.YARN_APPLICATION.toString(),
null),
new TimelineEntityFilters(null, null, null, null, irt6, null, null,
null, null),
new TimelineEntityFilters.Builder().isRelatedTo(irt6).build(),
new TimelineDataToRetrieve());
assertEquals(1, entities.size());
isRelatedToCnt = 0;
@ -972,8 +965,7 @@ public class TestHBaseTimelineStorageApps {
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, null, TimelineEntityType.YARN_APPLICATION.toString(),
null),
new TimelineEntityFilters(null, null, null, rt, null, null, null, null,
null),
new TimelineEntityFilters.Builder().relatesTo(rt).build(),
new TimelineDataToRetrieve(null, null, EnumSet.of(Field.ALL), null));
assertEquals(2, entities.size());
int relatesToCnt = 0;
@ -998,8 +990,7 @@ public class TestHBaseTimelineStorageApps {
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, null, TimelineEntityType.YARN_APPLICATION.toString(),
null),
new TimelineEntityFilters(null, null, null, rt1, null, null, null, null,
null),
new TimelineEntityFilters.Builder().relatesTo(rt1).build(),
new TimelineDataToRetrieve());
assertEquals(1, entities.size());
relatesToCnt = 0;
@ -1022,8 +1013,7 @@ public class TestHBaseTimelineStorageApps {
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, null, TimelineEntityType.YARN_APPLICATION.toString(),
null),
new TimelineEntityFilters(null, null, null, rt2, null, null, null, null,
null),
new TimelineEntityFilters.Builder().relatesTo(rt2).build(),
new TimelineDataToRetrieve());
assertEquals(2, entities.size());
relatesToCnt = 0;
@ -1045,8 +1035,7 @@ public class TestHBaseTimelineStorageApps {
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, null, TimelineEntityType.YARN_APPLICATION.toString(),
null),
new TimelineEntityFilters(null, null, null, rt3, null, null, null, null,
null),
new TimelineEntityFilters.Builder().relatesTo(rt3).build(),
new TimelineDataToRetrieve());
assertEquals(1, entities.size());
relatesToCnt = 0;
@ -1069,8 +1058,7 @@ public class TestHBaseTimelineStorageApps {
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, null, TimelineEntityType.YARN_APPLICATION.toString(),
null),
new TimelineEntityFilters(null, null, null, rt4, null, null, null, null,
null),
new TimelineEntityFilters.Builder().relatesTo(rt4).build(),
new TimelineDataToRetrieve());
assertEquals(0, entities.size());
@ -1082,8 +1070,7 @@ public class TestHBaseTimelineStorageApps {
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, null, TimelineEntityType.YARN_APPLICATION.toString(),
null),
new TimelineEntityFilters(null, null, null, rt5, null, null, null, null,
null),
new TimelineEntityFilters.Builder().relatesTo(rt5).build(),
new TimelineDataToRetrieve());
assertEquals(0, entities.size());
@ -1103,8 +1090,7 @@ public class TestHBaseTimelineStorageApps {
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, null, TimelineEntityType.YARN_APPLICATION.toString(),
null),
new TimelineEntityFilters(null, null, null, rt6, null, null, null, null,
null),
new TimelineEntityFilters.Builder().relatesTo(rt6).build(),
new TimelineDataToRetrieve());
assertEquals(1, entities.size());
relatesToCnt = 0;
@ -1140,8 +1126,7 @@ public class TestHBaseTimelineStorageApps {
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, null, TimelineEntityType.YARN_APPLICATION.toString(),
null),
new TimelineEntityFilters(null, null, null, rt7, null, null, null, null,
null),
new TimelineEntityFilters.Builder().relatesTo(rt7).build(),
new TimelineDataToRetrieve());
assertEquals(1, entities.size());
relatesToCnt = 0;
@ -1178,8 +1163,8 @@ public class TestHBaseTimelineStorageApps {
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, null, TimelineEntityType.YARN_APPLICATION.toString(),
null),
new TimelineEntityFilters(null, null, null, relatesTo, isRelatedTo,
null, null, null, eventFilter),
new TimelineEntityFilters.Builder().relatesTo(relatesTo)
.isRelatedTo(isRelatedTo).eventFilters(eventFilter).build(),
new TimelineDataToRetrieve());
assertEquals(1, entities.size());
int eventCnt = 0;
@ -1216,8 +1201,8 @@ public class TestHBaseTimelineStorageApps {
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, null, TimelineEntityType.YARN_APPLICATION.toString(),
null),
new TimelineEntityFilters(null, null, null, null, null, null,
confFilterList, null, null),
new TimelineEntityFilters.Builder().configFilters(confFilterList)
.build(),
new TimelineDataToRetrieve(null, null, EnumSet.of(Field.CONFIGS),
null));
assertEquals(2, entities.size());
@ -1231,8 +1216,8 @@ public class TestHBaseTimelineStorageApps {
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, null, TimelineEntityType.YARN_APPLICATION.toString(),
null),
new TimelineEntityFilters(null, null, null, null, null, null,
confFilterList, null, null),
new TimelineEntityFilters.Builder().configFilters(confFilterList)
.build(),
new TimelineDataToRetrieve(null, null, EnumSet.of(Field.ALL), null));
assertEquals(2, entities.size());
cfgCnt = 0;
@ -1248,8 +1233,8 @@ public class TestHBaseTimelineStorageApps {
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, null, TimelineEntityType.YARN_APPLICATION.toString(),
null),
new TimelineEntityFilters(null, null, null, null, null, null,
confFilterList1, null, null),
new TimelineEntityFilters.Builder().configFilters(confFilterList1)
.build(),
new TimelineDataToRetrieve(null, null, EnumSet.of(Field.CONFIGS),
null));
assertEquals(1, entities.size());
@ -1268,8 +1253,8 @@ public class TestHBaseTimelineStorageApps {
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, null, TimelineEntityType.YARN_APPLICATION.toString(),
null),
new TimelineEntityFilters(null, null, null, null, null, null,
confFilterList2, null, null),
new TimelineEntityFilters.Builder().configFilters(confFilterList2)
.build(),
new TimelineDataToRetrieve(null, null, EnumSet.of(Field.CONFIGS),
null));
assertEquals(0, entities.size());
@ -1281,8 +1266,8 @@ public class TestHBaseTimelineStorageApps {
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, null, TimelineEntityType.YARN_APPLICATION.toString(),
null),
new TimelineEntityFilters(null, null, null, null, null, null,
confFilterList3, null, null),
new TimelineEntityFilters.Builder().configFilters(confFilterList3)
.build(),
new TimelineDataToRetrieve(null, null, EnumSet.of(Field.CONFIGS),
null));
assertEquals(0, entities.size());
@ -1294,8 +1279,8 @@ public class TestHBaseTimelineStorageApps {
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, null, TimelineEntityType.YARN_APPLICATION.toString(),
null),
new TimelineEntityFilters(null, null, null, null, null, null,
confFilterList4, null, null),
new TimelineEntityFilters.Builder().configFilters(confFilterList4)
.build(),
new TimelineDataToRetrieve(null, null, EnumSet.of(Field.CONFIGS),
null));
assertEquals(0, entities.size());
@ -1307,8 +1292,8 @@ public class TestHBaseTimelineStorageApps {
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, null, TimelineEntityType.YARN_APPLICATION.toString(),
null),
new TimelineEntityFilters(null, null, null, null, null, null,
confFilterList5, null, null),
new TimelineEntityFilters.Builder().configFilters(confFilterList5)
.build(),
new TimelineDataToRetrieve(null, null, EnumSet.of(Field.CONFIGS),
null));
assertEquals(3, entities.size());
@ -1325,8 +1310,7 @@ public class TestHBaseTimelineStorageApps {
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, null, TimelineEntityType.YARN_APPLICATION.toString(),
null),
new TimelineEntityFilters(null, null, null, null, null, null, null,
null, ef),
new TimelineEntityFilters.Builder().eventFilters(ef).build(),
new TimelineDataToRetrieve(null, null, EnumSet.of(Field.ALL), null));
assertEquals(1, entities.size());
int eventCnt = 0;
@ -1347,8 +1331,8 @@ public class TestHBaseTimelineStorageApps {
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, null, TimelineEntityType.YARN_APPLICATION.toString(),
null),
new TimelineEntityFilters(null, null, null, null, null, null, null,
null, ef1), new TimelineDataToRetrieve());
new TimelineEntityFilters.Builder().eventFilters(ef1).build(),
new TimelineDataToRetrieve());
assertEquals(1, entities.size());
eventCnt = 0;
for (TimelineEntity timelineEntity : entities) {
@ -1366,8 +1350,7 @@ public class TestHBaseTimelineStorageApps {
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, null, TimelineEntityType.YARN_APPLICATION.toString(),
null),
new TimelineEntityFilters(null, null, null, null, null, null, null,
null, ef2),
new TimelineEntityFilters.Builder().eventFilters(ef2).build(),
new TimelineDataToRetrieve());
assertEquals(2, entities.size());
eventCnt = 0;
@ -1390,8 +1373,7 @@ public class TestHBaseTimelineStorageApps {
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, null, TimelineEntityType.YARN_APPLICATION.toString(),
null),
new TimelineEntityFilters(null, null, null, null, null, null, null,
null, ef3),
new TimelineEntityFilters.Builder().eventFilters(ef3).build(),
new TimelineDataToRetrieve());
assertEquals(0, entities.size());
@ -1408,8 +1390,7 @@ public class TestHBaseTimelineStorageApps {
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, null, TimelineEntityType.YARN_APPLICATION.toString(),
null),
new TimelineEntityFilters(null, null, null, null, null, null, null,
null, ef4),
new TimelineEntityFilters.Builder().eventFilters(ef4).build(),
new TimelineDataToRetrieve());
assertEquals(1, entities.size());
eventCnt = 0;
@ -1430,8 +1411,7 @@ public class TestHBaseTimelineStorageApps {
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, null, TimelineEntityType.YARN_APPLICATION.toString(),
null),
new TimelineEntityFilters(null, null, null, null, null, null, null,
null, ef5),
new TimelineEntityFilters.Builder().eventFilters(ef5).build(),
new TimelineDataToRetrieve());
assertEquals(1, entities.size());
eventCnt = 0;
@ -1460,7 +1440,7 @@ public class TestHBaseTimelineStorageApps {
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, null, TimelineEntityType.YARN_APPLICATION.toString(),
null) ,
new TimelineEntityFilters(),
new TimelineEntityFilters.Builder().build(),
new TimelineDataToRetrieve(list, null, null, null));
int cfgCnt = 0;
for (TimelineEntity entity : es1) {
@ -1485,8 +1465,8 @@ public class TestHBaseTimelineStorageApps {
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, null, TimelineEntityType.YARN_APPLICATION.toString(),
null),
new TimelineEntityFilters(null, null, null, null, null, null,
confFilterList, null, null),
new TimelineEntityFilters.Builder().configFilters(confFilterList)
.build(),
new TimelineDataToRetrieve(list, null, null, null));
assertEquals(1, entities.size());
int cfgCnt = 0;
@ -1518,8 +1498,8 @@ public class TestHBaseTimelineStorageApps {
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, null, TimelineEntityType.YARN_APPLICATION.toString(),
null),
new TimelineEntityFilters(null, null, null, null, null, null,
confFilterList1, null, null),
new TimelineEntityFilters.Builder().configFilters(confFilterList1)
.build(),
new TimelineDataToRetrieve(confsToRetrieve, null, null, null));
assertEquals(2, entities.size());
cfgCnt = 0;
@ -1549,8 +1529,8 @@ public class TestHBaseTimelineStorageApps {
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, null, TimelineEntityType.YARN_APPLICATION.toString(),
null),
new TimelineEntityFilters(null, null, null, null, null, null, null,
metricFilterList, null),
new TimelineEntityFilters.Builder().metricFilters(metricFilterList)
.build(),
new TimelineDataToRetrieve(null, null, EnumSet.of(Field.METRICS),
null));
assertEquals(2, entities.size());
@ -1564,8 +1544,8 @@ public class TestHBaseTimelineStorageApps {
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, null, TimelineEntityType.YARN_APPLICATION.toString(),
null),
new TimelineEntityFilters(null, null, null, null, null, null, null,
metricFilterList, null),
new TimelineEntityFilters.Builder().metricFilters(metricFilterList)
.build(),
new TimelineDataToRetrieve(null, null, EnumSet.of(Field.ALL), null));
assertEquals(2, entities.size());
metricCnt = 0;
@ -1583,8 +1563,8 @@ public class TestHBaseTimelineStorageApps {
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, null, TimelineEntityType.YARN_APPLICATION.toString(),
null),
new TimelineEntityFilters(null, null, null, null, null, null, null,
metricFilterList1, null),
new TimelineEntityFilters.Builder().metricFilters(metricFilterList1)
.build(),
new TimelineDataToRetrieve(null, null, EnumSet.of(Field.METRICS),
null));
assertEquals(1, entities.size());
@ -1603,8 +1583,8 @@ public class TestHBaseTimelineStorageApps {
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, null, TimelineEntityType.YARN_APPLICATION.toString(),
null),
new TimelineEntityFilters(null, null, null, null, null, null, null,
metricFilterList2, null),
new TimelineEntityFilters.Builder().metricFilters(metricFilterList2)
.build(),
new TimelineDataToRetrieve(null, null, EnumSet.of(Field.METRICS),
null));
assertEquals(0, entities.size());
@ -1616,8 +1596,8 @@ public class TestHBaseTimelineStorageApps {
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, null, TimelineEntityType.YARN_APPLICATION.toString(),
null),
new TimelineEntityFilters(null, null, null, null, null, null, null,
metricFilterList3, null),
new TimelineEntityFilters.Builder().metricFilters(metricFilterList3)
.build(),
new TimelineDataToRetrieve(null, null, EnumSet.of(Field.METRICS),
null));
assertEquals(0, entities.size());
@ -1629,8 +1609,8 @@ public class TestHBaseTimelineStorageApps {
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, null, TimelineEntityType.YARN_APPLICATION.toString(),
null),
new TimelineEntityFilters(null, null, null, null, null, null, null,
metricFilterList4, null),
new TimelineEntityFilters.Builder().metricFilters(metricFilterList4)
.build(),
new TimelineDataToRetrieve(null, null, EnumSet.of(Field.METRICS),
null));
assertEquals(0, entities.size());
@ -1642,8 +1622,8 @@ public class TestHBaseTimelineStorageApps {
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, null, TimelineEntityType.YARN_APPLICATION.toString(),
null),
new TimelineEntityFilters(null, null, null, null, null, null, null,
metricFilterList5, null),
new TimelineEntityFilters.Builder().metricFilters(metricFilterList5)
.build(),
new TimelineDataToRetrieve(null, null, EnumSet.of(Field.METRICS),
null));
assertEquals(3, entities.size());
@ -1665,7 +1645,7 @@ public class TestHBaseTimelineStorageApps {
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, null, TimelineEntityType.YARN_APPLICATION.toString(),
null),
new TimelineEntityFilters(),
new TimelineEntityFilters.Builder().build(),
new TimelineDataToRetrieve(null, list, null, null));
int metricCnt = 0;
for (TimelineEntity entity : es1) {
@ -1690,8 +1670,8 @@ public class TestHBaseTimelineStorageApps {
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, null, TimelineEntityType.YARN_APPLICATION.toString(),
null),
new TimelineEntityFilters(null, null, null, null, null, null, null,
metricFilterList, null),
new TimelineEntityFilters.Builder().metricFilters(metricFilterList)
.build(),
new TimelineDataToRetrieve(null, list, null, null));
int metricCnt = 0;
assertEquals(1, entities.size());
@ -1716,8 +1696,8 @@ public class TestHBaseTimelineStorageApps {
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, null, TimelineEntityType.YARN_APPLICATION.toString(),
null),
new TimelineEntityFilters(null, null, null, null, null, null, null,
metricFilterList1, null),
new TimelineEntityFilters.Builder().metricFilters(metricFilterList1)
.build(),
new TimelineDataToRetrieve(null, metricsToRetrieve, null, null));
metricCnt = 0;
assertEquals(2, entities.size());
@ -1733,8 +1713,9 @@ public class TestHBaseTimelineStorageApps {
entities = reader.getEntities(new TimelineReaderContext("cluster1", "user1",
"some_flow_name", 1002345678919L, null,
TimelineEntityType.YARN_APPLICATION.toString(), null),
new TimelineEntityFilters(null, null, null, null, null, null, null,
metricFilterList1, null), new TimelineDataToRetrieve(null,
new TimelineEntityFilters.Builder().metricFilters(metricFilterList1)
.build(),
new TimelineDataToRetrieve(null,
metricsToRetrieve, EnumSet.of(Field.METRICS), Integer.MAX_VALUE));
metricCnt = 0;
int metricValCnt = 0;
@ -1769,8 +1750,7 @@ public class TestHBaseTimelineStorageApps {
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, null, TimelineEntityType.YARN_APPLICATION.toString(),
null),
new TimelineEntityFilters(null, null, null, null, null, infoFilterList,
null, null, null),
new TimelineEntityFilters.Builder().infoFilters(infoFilterList).build(),
new TimelineDataToRetrieve(null, null, EnumSet.of(Field.INFO), null));
assertEquals(2, entities.size());
int infoCnt = 0;
@ -1786,8 +1766,8 @@ public class TestHBaseTimelineStorageApps {
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, null, TimelineEntityType.YARN_APPLICATION.toString(),
null),
new TimelineEntityFilters(null, null, null, null, null, infoFilterList1,
null, null, null),
new TimelineEntityFilters.Builder().infoFilters(infoFilterList1)
.build(),
new TimelineDataToRetrieve(null, null, EnumSet.of(Field.INFO), null));
assertEquals(1, entities.size());
infoCnt = 0;
@ -1805,8 +1785,8 @@ public class TestHBaseTimelineStorageApps {
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, null, TimelineEntityType.YARN_APPLICATION.toString(),
null),
new TimelineEntityFilters(null, null, null, null, null, infoFilterList2,
null, null, null),
new TimelineEntityFilters.Builder().infoFilters(infoFilterList2)
.build(),
new TimelineDataToRetrieve(null, null, EnumSet.of(Field.INFO), null));
assertEquals(0, entities.size());
@ -1817,8 +1797,8 @@ public class TestHBaseTimelineStorageApps {
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, null, TimelineEntityType.YARN_APPLICATION.toString(),
null),
new TimelineEntityFilters(null, null, null, null, null, infoFilterList3,
null, null, null),
new TimelineEntityFilters.Builder().infoFilters(infoFilterList3)
.build(),
new TimelineDataToRetrieve(null, null, EnumSet.of(Field.INFO), null));
assertEquals(0, entities.size());
@ -1829,8 +1809,8 @@ public class TestHBaseTimelineStorageApps {
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, null, TimelineEntityType.YARN_APPLICATION.toString(),
null),
new TimelineEntityFilters(null, null, null, null, null, infoFilterList4,
null, null, null),
new TimelineEntityFilters.Builder().infoFilters(infoFilterList4)
.build(),
new TimelineDataToRetrieve(null, null, EnumSet.of(Field.INFO), null));
assertEquals(0, entities.size());
@ -1841,8 +1821,8 @@ public class TestHBaseTimelineStorageApps {
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, null, TimelineEntityType.YARN_APPLICATION.toString(),
null),
new TimelineEntityFilters(null, null, null, null, null, infoFilterList5,
null, null, null),
new TimelineEntityFilters.Builder().infoFilters(infoFilterList5)
.build(),
new TimelineDataToRetrieve(null, null, EnumSet.of(Field.INFO), null));
assertEquals(3, entities.size());
}

View File

@ -300,7 +300,7 @@ public class TestHBaseTimelineStorageEntities {
Set<TimelineEntity> es1 = reader.getEntities(
new TimelineReaderContext(cluster, user, flow, runid, appName,
entity.getType(), null),
new TimelineEntityFilters(),
new TimelineEntityFilters.Builder().build(),
new TimelineDataToRetrieve(null, null, EnumSet.of(Field.ALL),
Integer.MAX_VALUE));
assertNotNull(e1);
@ -455,7 +455,7 @@ public class TestHBaseTimelineStorageEntities {
Set<TimelineEntity> es1 = reader.getEntities(
new TimelineReaderContext(cluster, user, flow, runid, appName,
entity.getType(), null),
new TimelineEntityFilters(),
new TimelineEntityFilters.Builder().build(),
new TimelineDataToRetrieve(null, null, EnumSet.of(Field.ALL), null));
assertNotNull(e1);
assertEquals(1, es1.size());
@ -553,7 +553,7 @@ public class TestHBaseTimelineStorageEntities {
Set<TimelineEntity> entities = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, "application_1231111111_1111", "world",
null), new TimelineEntityFilters(),
null), new TimelineEntityFilters.Builder().build(),
new TimelineDataToRetrieve(null, null, EnumSet.of(Field.ALL), null));
assertEquals(3, entities.size());
int cfgCnt = 0;
@ -589,8 +589,9 @@ public class TestHBaseTimelineStorageEntities {
Set<TimelineEntity> entities = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, "application_1231111111_1111", "world", null),
new TimelineEntityFilters(null, 1425016502000L, 1425016502040L, null,
null, null, null, null, null), new TimelineDataToRetrieve());
new TimelineEntityFilters.Builder().createdTimeBegin(1425016502000L)
.createTimeEnd(1425016502040L).build(),
new TimelineDataToRetrieve());
assertEquals(3, entities.size());
for (TimelineEntity entity : entities) {
if (!entity.getId().equals("hello") && !entity.getId().equals("hello1") &&
@ -602,8 +603,9 @@ public class TestHBaseTimelineStorageEntities {
entities = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, "application_1231111111_1111", "world", null),
new TimelineEntityFilters(null, 1425016502015L, null, null, null, null,
null, null, null), new TimelineDataToRetrieve());
new TimelineEntityFilters.Builder().createdTimeBegin(1425016502015L)
.build(),
new TimelineDataToRetrieve());
assertEquals(2, entities.size());
for (TimelineEntity entity : entities) {
if (!entity.getId().equals("hello1") &&
@ -614,8 +616,9 @@ public class TestHBaseTimelineStorageEntities {
entities = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, "application_1231111111_1111", "world", null),
new TimelineEntityFilters(null, null, 1425016502015L, null, null, null,
null, null, null), new TimelineDataToRetrieve());
new TimelineEntityFilters.Builder().createTimeEnd(1425016502015L)
.build(),
new TimelineDataToRetrieve());
assertEquals(1, entities.size());
for (TimelineEntity entity : entities) {
if (!entity.getId().equals("hello")) {
@ -647,8 +650,9 @@ public class TestHBaseTimelineStorageEntities {
Set<TimelineEntity> entities = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, "application_1231111111_1111", "world", null),
new TimelineEntityFilters(null, null, null, relatesTo, isRelatedTo,
null, null, null, eventFilter), new TimelineDataToRetrieve());
new TimelineEntityFilters.Builder().relatesTo(relatesTo)
.isRelatedTo(isRelatedTo).eventFilters(eventFilter).build(),
new TimelineDataToRetrieve());
assertEquals(1, entities.size());
int eventCnt = 0;
int isRelatedToCnt = 0;
@ -676,8 +680,7 @@ public class TestHBaseTimelineStorageEntities {
Set<TimelineEntity> entities = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, "application_1231111111_1111", "world", null),
new TimelineEntityFilters(null, null, null, null, null, null, null,
null, ef),
new TimelineEntityFilters.Builder().eventFilters(ef).build(),
new TimelineDataToRetrieve(null, null, EnumSet.of(Field.ALL), null));
assertEquals(1, entities.size());
int eventCnt = 0;
@ -697,8 +700,7 @@ public class TestHBaseTimelineStorageEntities {
entities = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, "application_1231111111_1111", "world", null),
new TimelineEntityFilters(null, null, null, null, null, null, null,
null, ef1),
new TimelineEntityFilters.Builder().eventFilters(ef1).build(),
new TimelineDataToRetrieve());
assertEquals(1, entities.size());
eventCnt = 0;
@ -716,8 +718,7 @@ public class TestHBaseTimelineStorageEntities {
entities = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, "application_1231111111_1111", "world", null),
new TimelineEntityFilters(null, null, null, null, null, null, null,
null, ef2),
new TimelineEntityFilters.Builder().eventFilters(ef2).build(),
new TimelineDataToRetrieve());
assertEquals(2, entities.size());
eventCnt = 0;
@ -738,8 +739,7 @@ public class TestHBaseTimelineStorageEntities {
entities = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, "application_1231111111_1111", "world", null),
new TimelineEntityFilters(null, null, null, null, null, null, null,
null, ef3),
new TimelineEntityFilters.Builder().eventFilters(ef3).build(),
new TimelineDataToRetrieve());
assertEquals(0, entities.size());
@ -755,8 +755,7 @@ public class TestHBaseTimelineStorageEntities {
entities = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, "application_1231111111_1111", "world", null),
new TimelineEntityFilters(null, null, null, null, null, null, null,
null, ef4),
new TimelineEntityFilters.Builder().eventFilters(ef4).build(),
new TimelineDataToRetrieve());
assertEquals(1, entities.size());
eventCnt = 0;
@ -776,8 +775,7 @@ public class TestHBaseTimelineStorageEntities {
entities = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, "application_1231111111_1111", "world", null),
new TimelineEntityFilters(null, null, null, null, null, null, null,
null, ef5),
new TimelineEntityFilters.Builder().eventFilters(ef5).build(),
new TimelineDataToRetrieve());
assertEquals(1, entities.size());
eventCnt = 0;
@ -802,8 +800,7 @@ public class TestHBaseTimelineStorageEntities {
Set<TimelineEntity> entities = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, "application_1231111111_1111", "world", null),
new TimelineEntityFilters(null, null, null, null, irt, null, null, null,
null),
new TimelineEntityFilters.Builder().isRelatedTo(irt).build(),
new TimelineDataToRetrieve(null, null, EnumSet.of(Field.ALL), null));
assertEquals(2, entities.size());
int isRelatedToCnt = 0;
@ -826,8 +823,7 @@ public class TestHBaseTimelineStorageEntities {
entities = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, "application_1231111111_1111", "world", null),
new TimelineEntityFilters(null, null, null, null, irt1, null, null,
null, null),
new TimelineEntityFilters.Builder().isRelatedTo(irt1).build(),
new TimelineDataToRetrieve());
assertEquals(1, entities.size());
isRelatedToCnt = 0;
@ -849,8 +845,7 @@ public class TestHBaseTimelineStorageEntities {
entities = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, "application_1231111111_1111", "world", null),
new TimelineEntityFilters(null, null, null, null, irt2, null, null,
null, null),
new TimelineEntityFilters.Builder().isRelatedTo(irt2).build(),
new TimelineDataToRetrieve());
assertEquals(2, entities.size());
isRelatedToCnt = 0;
@ -870,8 +865,7 @@ public class TestHBaseTimelineStorageEntities {
entities = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, "application_1231111111_1111", "world", null),
new TimelineEntityFilters(null, null, null, null, irt3, null, null,
null, null),
new TimelineEntityFilters.Builder().isRelatedTo(irt3).build(),
new TimelineDataToRetrieve());
assertEquals(1, entities.size());
isRelatedToCnt = 0;
@ -893,8 +887,7 @@ public class TestHBaseTimelineStorageEntities {
entities = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, "application_1231111111_1111", "world", null),
new TimelineEntityFilters(null, null, null, null, irt4, null, null,
null, null),
new TimelineEntityFilters.Builder().isRelatedTo(irt4).build(),
new TimelineDataToRetrieve());
assertEquals(0, entities.size());
@ -905,8 +898,7 @@ public class TestHBaseTimelineStorageEntities {
entities = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, "application_1231111111_1111", "world", null),
new TimelineEntityFilters(null, null, null, null, irt5, null, null,
null, null),
new TimelineEntityFilters.Builder().isRelatedTo(irt5).build(),
new TimelineDataToRetrieve());
assertEquals(0, entities.size());
@ -925,8 +917,7 @@ public class TestHBaseTimelineStorageEntities {
entities = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, "application_1231111111_1111", "world", null),
new TimelineEntityFilters(null, null, null, null, irt6, null, null,
null, null),
new TimelineEntityFilters.Builder().isRelatedTo(irt6).build(),
new TimelineDataToRetrieve());
assertEquals(1, entities.size());
isRelatedToCnt = 0;
@ -951,8 +942,7 @@ public class TestHBaseTimelineStorageEntities {
Set<TimelineEntity> entities = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, "application_1231111111_1111", "world", null),
new TimelineEntityFilters(null, null, null, rt, null, null, null, null,
null),
new TimelineEntityFilters.Builder().relatesTo(rt).build(),
new TimelineDataToRetrieve(null, null, EnumSet.of(Field.ALL), null));
assertEquals(2, entities.size());
int relatesToCnt = 0;
@ -975,8 +965,7 @@ public class TestHBaseTimelineStorageEntities {
entities = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, "application_1231111111_1111", "world", null),
new TimelineEntityFilters(null, null, null, rt1, null, null, null, null,
null),
new TimelineEntityFilters.Builder().relatesTo(rt1).build(),
new TimelineDataToRetrieve());
assertEquals(1, entities.size());
relatesToCnt = 0;
@ -998,8 +987,7 @@ public class TestHBaseTimelineStorageEntities {
entities = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, "application_1231111111_1111", "world", null),
new TimelineEntityFilters(null, null, null, rt2, null, null, null, null,
null),
new TimelineEntityFilters.Builder().relatesTo(rt2).build(),
new TimelineDataToRetrieve());
assertEquals(2, entities.size());
relatesToCnt = 0;
@ -1019,8 +1007,7 @@ public class TestHBaseTimelineStorageEntities {
entities = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, "application_1231111111_1111", "world", null),
new TimelineEntityFilters(null, null, null, rt3, null, null, null, null,
null),
new TimelineEntityFilters.Builder().relatesTo(rt3).build(),
new TimelineDataToRetrieve());
assertEquals(1, entities.size());
relatesToCnt = 0;
@ -1042,8 +1029,7 @@ public class TestHBaseTimelineStorageEntities {
entities = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, "application_1231111111_1111", "world", null),
new TimelineEntityFilters(null, null, null, rt4, null, null, null, null,
null),
new TimelineEntityFilters.Builder().relatesTo(rt4).build(),
new TimelineDataToRetrieve());
assertEquals(0, entities.size());
@ -1054,8 +1040,7 @@ public class TestHBaseTimelineStorageEntities {
entities = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, "application_1231111111_1111", "world", null),
new TimelineEntityFilters(null, null, null, rt5, null, null, null, null,
null),
new TimelineEntityFilters.Builder().relatesTo(rt5).build(),
new TimelineDataToRetrieve());
assertEquals(0, entities.size());
@ -1074,8 +1059,7 @@ public class TestHBaseTimelineStorageEntities {
entities = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, "application_1231111111_1111", "world", null),
new TimelineEntityFilters(null, null, null, rt6, null, null, null, null,
null),
new TimelineEntityFilters.Builder().relatesTo(rt6).build(),
new TimelineDataToRetrieve());
assertEquals(1, entities.size());
relatesToCnt = 0;
@ -1110,8 +1094,7 @@ public class TestHBaseTimelineStorageEntities {
entities = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, "application_1231111111_1111", "world", null),
new TimelineEntityFilters(null, null, null, rt7, null, null, null, null,
null),
new TimelineEntityFilters.Builder().relatesTo(rt7).build(),
new TimelineDataToRetrieve());
assertEquals(1, entities.size());
relatesToCnt = 0;
@ -1138,7 +1121,7 @@ public class TestHBaseTimelineStorageEntities {
Set<TimelineEntity> es1 = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, "application_1231111111_1111", "world", null),
new TimelineEntityFilters(),
new TimelineEntityFilters.Builder().build(),
new TimelineDataToRetrieve());
assertEquals(3, es1.size());
for (TimelineEntity e : es1) {
@ -1162,7 +1145,7 @@ public class TestHBaseTimelineStorageEntities {
Set<TimelineEntity> es1 = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, "application_1231111111_1111", "world", null),
new TimelineEntityFilters(),
new TimelineEntityFilters.Builder().build(),
new TimelineDataToRetrieve(
null, null, EnumSet.of(Field.IS_RELATED_TO, Field.METRICS), null));
assertEquals(3, es1.size());
@ -1193,7 +1176,7 @@ public class TestHBaseTimelineStorageEntities {
Set<TimelineEntity> es1 = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, "application_1231111111_1111", "world", null),
new TimelineEntityFilters(),
new TimelineEntityFilters.Builder().build(),
new TimelineDataToRetrieve(list, null, null, null));
int cfgCnt = 0;
for (TimelineEntity entity : es1) {
@ -1223,8 +1206,8 @@ public class TestHBaseTimelineStorageEntities {
Set<TimelineEntity> entities = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, "application_1231111111_1111", "world", null),
new TimelineEntityFilters(null, null, null, null, null, null,
confFilterList, null, null),
new TimelineEntityFilters.Builder().configFilters(confFilterList)
.build(),
new TimelineDataToRetrieve(null, null, EnumSet.of(Field.CONFIGS),
null));
assertEquals(2, entities.size());
@ -1237,8 +1220,8 @@ public class TestHBaseTimelineStorageEntities {
entities = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, "application_1231111111_1111", "world", null),
new TimelineEntityFilters(null, null, null, null, null, null,
confFilterList, null, null),
new TimelineEntityFilters.Builder().configFilters(confFilterList)
.build(),
new TimelineDataToRetrieve(null, null, EnumSet.of(Field.ALL), null));
assertEquals(2, entities.size());
cfgCnt = 0;
@ -1253,8 +1236,8 @@ public class TestHBaseTimelineStorageEntities {
entities = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, "application_1231111111_1111", "world", null),
new TimelineEntityFilters(null, null, null, null, null, null,
confFilterList1, null, null),
new TimelineEntityFilters.Builder().configFilters(confFilterList1)
.build(),
new TimelineDataToRetrieve(null, null, EnumSet.of(Field.CONFIGS),
null));
assertEquals(1, entities.size());
@ -1272,8 +1255,8 @@ public class TestHBaseTimelineStorageEntities {
entities = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, "application_1231111111_1111", "world", null),
new TimelineEntityFilters(null, null, null, null, null, null,
confFilterList2, null, null),
new TimelineEntityFilters.Builder().configFilters(confFilterList2)
.build(),
new TimelineDataToRetrieve(null, null, EnumSet.of(Field.CONFIGS),
null));
assertEquals(0, entities.size());
@ -1284,8 +1267,8 @@ public class TestHBaseTimelineStorageEntities {
entities = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, "application_1231111111_1111", "world", null),
new TimelineEntityFilters(null, null, null, null, null, null,
confFilterList3, null, null),
new TimelineEntityFilters.Builder().configFilters(confFilterList3)
.build(),
new TimelineDataToRetrieve(null, null, EnumSet.of(Field.CONFIGS),
null));
assertEquals(0, entities.size());
@ -1294,11 +1277,11 @@ public class TestHBaseTimelineStorageEntities {
new TimelineKeyValueFilter(
TimelineCompareOp.NOT_EQUAL, "dummy_config", "value1"));
entities = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, "application_1231111111_1111", "world", null),
new TimelineEntityFilters(null, null, null, null, null, null,
confFilterList4, null, null),
new TimelineDataToRetrieve(null, null, EnumSet.of(Field.CONFIGS),
new TimelineEntityFilters.Builder().configFilters(confFilterList4)
.build(),
new TimelineDataToRetrieve(null, null, EnumSet.of(Field.CONFIGS),
null));
assertEquals(0, entities.size());
@ -1308,8 +1291,8 @@ public class TestHBaseTimelineStorageEntities {
entities = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, "application_1231111111_1111", "world", null),
new TimelineEntityFilters(null, null, null, null, null, null,
confFilterList5, null, null),
new TimelineEntityFilters.Builder().configFilters(confFilterList5)
.build(),
new TimelineDataToRetrieve(null, null, EnumSet.of(Field.CONFIGS),
null));
assertEquals(3, entities.size());
@ -1326,8 +1309,8 @@ public class TestHBaseTimelineStorageEntities {
Set<TimelineEntity> entities = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, "application_1231111111_1111", "world", null),
new TimelineEntityFilters(null, null, null, null, null, null,
confFilterList, null, null),
new TimelineEntityFilters.Builder().configFilters(confFilterList)
.build(),
new TimelineDataToRetrieve(list, null, null, null));
assertEquals(1, entities.size());
int cfgCnt = 0;
@ -1357,8 +1340,8 @@ public class TestHBaseTimelineStorageEntities {
entities = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, "application_1231111111_1111", "world", null),
new TimelineEntityFilters(null, null, null, null, null, null,
confFilterList1, null, null),
new TimelineEntityFilters.Builder().configFilters(confFilterList1)
.build(),
new TimelineDataToRetrieve(confsToRetrieve, null, null, null));
assertEquals(2, entities.size());
cfgCnt = 0;
@ -1386,7 +1369,7 @@ public class TestHBaseTimelineStorageEntities {
Set<TimelineEntity> es1 = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, "application_1231111111_1111", "world", null),
new TimelineEntityFilters(),
new TimelineEntityFilters.Builder().build(),
new TimelineDataToRetrieve(null, list, null, null));
int metricCnt = 0;
for (TimelineEntity entity : es1) {
@ -1414,8 +1397,8 @@ public class TestHBaseTimelineStorageEntities {
Set<TimelineEntity> entities = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, "application_1231111111_1111", "world", null),
new TimelineEntityFilters(null, null, null, null, null, null, null,
metricFilterList, null),
new TimelineEntityFilters.Builder().metricFilters(metricFilterList)
.build(),
new TimelineDataToRetrieve(null, null, EnumSet.of(Field.METRICS),
null));
assertEquals(2, entities.size());
@ -1428,8 +1411,8 @@ public class TestHBaseTimelineStorageEntities {
entities = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, "application_1231111111_1111", "world", null),
new TimelineEntityFilters(null, null, null, null, null, null, null,
metricFilterList, null),
new TimelineEntityFilters.Builder().metricFilters(metricFilterList)
.build(),
new TimelineDataToRetrieve(null, null, EnumSet.of(Field.ALL), null));
assertEquals(2, entities.size());
metricCnt = 0;
@ -1446,8 +1429,8 @@ public class TestHBaseTimelineStorageEntities {
entities = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, "application_1231111111_1111", "world", null),
new TimelineEntityFilters(null, null, null, null, null, null, null,
metricFilterList1, null),
new TimelineEntityFilters.Builder().metricFilters(metricFilterList1)
.build(),
new TimelineDataToRetrieve(null, null, EnumSet.of(Field.METRICS),
null));
assertEquals(1, entities.size());
@ -1465,8 +1448,8 @@ public class TestHBaseTimelineStorageEntities {
entities = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, "application_1231111111_1111", "world", null),
new TimelineEntityFilters(null, null, null, null, null, null, null,
metricFilterList2, null),
new TimelineEntityFilters.Builder().metricFilters(metricFilterList2)
.build(),
new TimelineDataToRetrieve(null, null, EnumSet.of(Field.METRICS),
null));
assertEquals(0, entities.size());
@ -1477,8 +1460,8 @@ public class TestHBaseTimelineStorageEntities {
entities = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, "application_1231111111_1111", "world", null),
new TimelineEntityFilters(null, null, null, null, null, null, null,
metricFilterList3, null),
new TimelineEntityFilters.Builder().metricFilters(metricFilterList3)
.build(),
new TimelineDataToRetrieve(null, null, EnumSet.of(Field.METRICS),
null));
assertEquals(0, entities.size());
@ -1489,8 +1472,8 @@ public class TestHBaseTimelineStorageEntities {
entities = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, "application_1231111111_1111", "world", null),
new TimelineEntityFilters(null, null, null, null, null, null, null,
metricFilterList4, null),
new TimelineEntityFilters.Builder().metricFilters(metricFilterList4)
.build(),
new TimelineDataToRetrieve(null, null, EnumSet.of(Field.METRICS),
null));
assertEquals(0, entities.size());
@ -1501,8 +1484,8 @@ public class TestHBaseTimelineStorageEntities {
entities = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, "application_1231111111_1111", "world", null),
new TimelineEntityFilters(null, null, null, null, null, null, null,
metricFilterList5, null),
new TimelineEntityFilters.Builder().metricFilters(metricFilterList5)
.build(),
new TimelineDataToRetrieve(null, null, EnumSet.of(Field.METRICS),
null));
assertEquals(3, entities.size());
@ -1519,8 +1502,8 @@ public class TestHBaseTimelineStorageEntities {
Set<TimelineEntity> entities = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, "application_1231111111_1111", "world", null),
new TimelineEntityFilters(null, null, null, null, null, null, null,
metricFilterList, null),
new TimelineEntityFilters.Builder().metricFilters(metricFilterList)
.build(),
new TimelineDataToRetrieve(null, list, null, null));
assertEquals(1, entities.size());
int metricCnt = 0;
@ -1548,8 +1531,8 @@ public class TestHBaseTimelineStorageEntities {
entities = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, "application_1231111111_1111", "world", null),
new TimelineEntityFilters(null, null, null, null, null, null, null,
metricFilterList1, null),
new TimelineEntityFilters.Builder().metricFilters(metricFilterList1)
.build(),
new TimelineDataToRetrieve(
null, metricsToRetrieve, EnumSet.of(Field.METRICS), null));
assertEquals(2, entities.size());
@ -1567,8 +1550,10 @@ public class TestHBaseTimelineStorageEntities {
entities = reader.getEntities(new TimelineReaderContext("cluster1", "user1",
"some_flow_name", 1002345678919L, "application_1231111111_1111",
"world", null), new TimelineEntityFilters(null, null, null, null, null,
null, null, metricFilterList1, null), new TimelineDataToRetrieve(null,
"world", null),
new TimelineEntityFilters.Builder().metricFilters(metricFilterList1)
.build(),
new TimelineDataToRetrieve(null,
metricsToRetrieve, EnumSet.of(Field.METRICS), Integer.MAX_VALUE));
assertEquals(2, entities.size());
metricCnt = 0;
@ -1602,8 +1587,7 @@ public class TestHBaseTimelineStorageEntities {
Set<TimelineEntity> entities = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, "application_1231111111_1111", "world", null),
new TimelineEntityFilters(null, null, null, null, null, infoFilterList,
null, null, null),
new TimelineEntityFilters.Builder().infoFilters(infoFilterList).build(),
new TimelineDataToRetrieve(null, null, EnumSet.of(Field.INFO), null));
assertEquals(2, entities.size());
int infoCnt = 0;
@ -1618,8 +1602,8 @@ public class TestHBaseTimelineStorageEntities {
entities = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, "application_1231111111_1111", "world", null),
new TimelineEntityFilters(null, null, null, null, null, infoFilterList1,
null, null, null),
new TimelineEntityFilters.Builder().infoFilters(infoFilterList1)
.build(),
new TimelineDataToRetrieve(null, null, EnumSet.of(Field.INFO), null));
assertEquals(1, entities.size());
infoCnt = 0;
@ -1636,8 +1620,8 @@ public class TestHBaseTimelineStorageEntities {
entities = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, "application_1231111111_1111", "world", null),
new TimelineEntityFilters(null, null, null, null, null, infoFilterList2,
null, null, null),
new TimelineEntityFilters.Builder().infoFilters(infoFilterList2)
.build(),
new TimelineDataToRetrieve(null, null, EnumSet.of(Field.INFO), null));
assertEquals(0, entities.size());
@ -1647,8 +1631,8 @@ public class TestHBaseTimelineStorageEntities {
entities = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, "application_1231111111_1111", "world", null),
new TimelineEntityFilters(null, null, null, null, null, infoFilterList3,
null, null, null),
new TimelineEntityFilters.Builder().infoFilters(infoFilterList3)
.build(),
new TimelineDataToRetrieve(null, null, EnumSet.of(Field.INFO), null));
assertEquals(0, entities.size());
@ -1658,8 +1642,8 @@ public class TestHBaseTimelineStorageEntities {
entities = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, "application_1231111111_1111", "world", null),
new TimelineEntityFilters(null, null, null, null, null, infoFilterList4,
null, null, null),
new TimelineEntityFilters.Builder().infoFilters(infoFilterList4)
.build(),
new TimelineDataToRetrieve(null, null, EnumSet.of(Field.INFO), null));
assertEquals(0, entities.size());
@ -1669,8 +1653,8 @@ public class TestHBaseTimelineStorageEntities {
entities = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "some_flow_name",
1002345678919L, "application_1231111111_1111", "world", null),
new TimelineEntityFilters(null, null, null, null, null, infoFilterList5,
null, null, null),
new TimelineEntityFilters.Builder().infoFilters(infoFilterList5)
.build(),
new TimelineDataToRetrieve(null, null, EnumSet.of(Field.INFO), null));
assertEquals(3, entities.size());
}

View File

@ -184,8 +184,7 @@ public class TestHBaseStorageFlowActivity {
Set<TimelineEntity> entities = hbr.getEntities(
new TimelineReaderContext(cluster, null, null, null, null,
TimelineEntityType.YARN_FLOW_ACTIVITY.toString(), null),
new TimelineEntityFilters(10L, null, null, null, null, null,
null, null, null),
new TimelineEntityFilters.Builder().entityLimit(10L).build(),
new TimelineDataToRetrieve());
assertEquals(1, entities.size());
for (TimelineEntity e : entities) {
@ -249,8 +248,7 @@ public class TestHBaseStorageFlowActivity {
Set<TimelineEntity> entities = hbr.getEntities(
new TimelineReaderContext(cluster, user, flow, null, null,
TimelineEntityType.YARN_FLOW_ACTIVITY.toString(), null),
new TimelineEntityFilters(10L, null, null, null, null, null,
null, null, null),
new TimelineEntityFilters.Builder().entityLimit(10L).build(),
new TimelineDataToRetrieve());
assertEquals(1, entities.size());
for (TimelineEntity e : entities) {
@ -377,8 +375,7 @@ public class TestHBaseStorageFlowActivity {
Set<TimelineEntity> entities = hbr.getEntities(
new TimelineReaderContext(cluster, null, null, null, null,
TimelineEntityType.YARN_FLOW_ACTIVITY.toString(), null),
new TimelineEntityFilters(10L, null, null, null, null, null,
null, null, null),
new TimelineEntityFilters.Builder().entityLimit(10L).build(),
new TimelineDataToRetrieve());
assertEquals(1, entities.size());
for (TimelineEntity e : entities) {

View File

@ -608,7 +608,7 @@ public class TestHBaseStorageFlowRun {
Set<TimelineEntity> entities = hbr.getEntities(
new TimelineReaderContext(cluster, user, flow, null, null,
TimelineEntityType.YARN_FLOW_RUN.toString(), null),
new TimelineEntityFilters(),
new TimelineEntityFilters.Builder().build(),
new TimelineDataToRetrieve(null, metricsToRetrieve, null, null));
assertEquals(2, entities.size());
int metricCnt = 0;
@ -669,7 +669,7 @@ public class TestHBaseStorageFlowRun {
Set<TimelineEntity> entities = hbr.getEntities(
new TimelineReaderContext(cluster, user, flow, runid, null,
TimelineEntityType.YARN_FLOW_RUN.toString(), null),
new TimelineEntityFilters(),
new TimelineEntityFilters.Builder().build(),
new TimelineDataToRetrieve());
assertEquals(1, entities.size());
for (TimelineEntity timelineEntity : entities) {
@ -679,8 +679,9 @@ public class TestHBaseStorageFlowRun {
entities = hbr.getEntities(
new TimelineReaderContext(cluster, user, flow, runid, null,
TimelineEntityType.YARN_FLOW_RUN.toString(), null),
new TimelineEntityFilters(), new TimelineDataToRetrieve(null, null,
EnumSet.of(Field.METRICS), null));
new TimelineEntityFilters.Builder().build(),
new TimelineDataToRetrieve(null, null,
EnumSet.of(Field.METRICS), null));
assertEquals(1, entities.size());
for (TimelineEntity timelineEntity : entities) {
Set<TimelineMetric> timelineMetrics = timelineEntity.getMetrics();
@ -850,8 +851,9 @@ public class TestHBaseStorageFlowRun {
Set<TimelineEntity> entities = hbr.getEntities(
new TimelineReaderContext(cluster, user, flow,
null, null, TimelineEntityType.YARN_FLOW_RUN.toString(), null),
new TimelineEntityFilters(null, 1425016501000L, 1425016502001L, null,
null, null, null, null, null), new TimelineDataToRetrieve());
new TimelineEntityFilters.Builder().createdTimeBegin(1425016501000L)
.createTimeEnd(1425016502001L).build(),
new TimelineDataToRetrieve());
assertEquals(2, entities.size());
for (TimelineEntity entity : entities) {
if (!entity.getId().equals("user2@flow_name2/1002345678918") &&
@ -863,8 +865,9 @@ public class TestHBaseStorageFlowRun {
entities = hbr.getEntities(
new TimelineReaderContext(cluster, user, flow, null, null,
TimelineEntityType.YARN_FLOW_RUN.toString(), null),
new TimelineEntityFilters(null, 1425016501050L, null, null, null,
null, null, null, null), new TimelineDataToRetrieve());
new TimelineEntityFilters.Builder().createdTimeBegin(1425016501050L)
.build(),
new TimelineDataToRetrieve());
assertEquals(1, entities.size());
for (TimelineEntity entity : entities) {
if (!entity.getId().equals("user2@flow_name2/1002345678918")) {
@ -874,8 +877,9 @@ public class TestHBaseStorageFlowRun {
entities = hbr.getEntities(
new TimelineReaderContext(cluster, user, flow, null, null,
TimelineEntityType.YARN_FLOW_RUN.toString(), null),
new TimelineEntityFilters(null, null, 1425016501050L, null, null,
null, null, null, null), new TimelineDataToRetrieve());
new TimelineEntityFilters.Builder().createTimeEnd(1425016501050L)
.build(),
new TimelineDataToRetrieve());
assertEquals(1, entities.size());
for (TimelineEntity entity : entities) {
if (!entity.getId().equals("user2@flow_name2/1002345678919")) {
@ -941,8 +945,9 @@ public class TestHBaseStorageFlowRun {
Set<TimelineEntity> entities = hbr.getEntities(
new TimelineReaderContext(cluster, user, flow, null,
null, TimelineEntityType.YARN_FLOW_RUN.toString(), null),
new TimelineEntityFilters(null, null, null, null, null, null, null,
metricFilterList, null), new TimelineDataToRetrieve(null, null,
new TimelineEntityFilters.Builder().metricFilters(metricFilterList)
.build(),
new TimelineDataToRetrieve(null, null,
EnumSet.of(Field.METRICS), null));
assertEquals(2, entities.size());
int metricCnt = 0;
@ -958,8 +963,9 @@ public class TestHBaseStorageFlowRun {
entities = hbr.getEntities(
new TimelineReaderContext(cluster, user, flow, null, null,
TimelineEntityType.YARN_FLOW_RUN.toString(), null),
new TimelineEntityFilters(null, null, null, null, null, null, null,
metricFilterList1, null), new TimelineDataToRetrieve(null, null,
new TimelineEntityFilters.Builder().metricFilters(metricFilterList1)
.build(),
new TimelineDataToRetrieve(null, null,
EnumSet.of(Field.METRICS), null));
assertEquals(1, entities.size());
metricCnt = 0;
@ -974,8 +980,9 @@ public class TestHBaseStorageFlowRun {
entities = hbr.getEntities(
new TimelineReaderContext(cluster, user, flow, null, null,
TimelineEntityType.YARN_FLOW_RUN.toString(), null),
new TimelineEntityFilters(null, null, null, null, null, null, null,
metricFilterList2, null), new TimelineDataToRetrieve(null, null,
new TimelineEntityFilters.Builder().metricFilters(metricFilterList2)
.build(),
new TimelineDataToRetrieve(null, null,
EnumSet.of(Field.METRICS), null));
assertEquals(0, entities.size());
@ -984,8 +991,9 @@ public class TestHBaseStorageFlowRun {
entities = hbr.getEntities(
new TimelineReaderContext(cluster, user, flow, null, null,
TimelineEntityType.YARN_FLOW_RUN.toString(), null),
new TimelineEntityFilters(null, null, null, null, null, null, null,
metricFilterList3, null), new TimelineDataToRetrieve(null, null,
new TimelineEntityFilters.Builder().metricFilters(metricFilterList3)
.build(),
new TimelineDataToRetrieve(null, null,
EnumSet.of(Field.METRICS), null));
assertEquals(0, entities.size());
@ -1005,8 +1013,8 @@ public class TestHBaseStorageFlowRun {
entities = hbr.getEntities(
new TimelineReaderContext(cluster, user, flow, null, null,
TimelineEntityType.YARN_FLOW_RUN.toString(), null),
new TimelineEntityFilters(null, null, null, null, null, null, null,
metricFilterList4, null),
new TimelineEntityFilters.Builder().metricFilters(metricFilterList4)
.build(),
new TimelineDataToRetrieve(null, metricsToRetrieve,
EnumSet.of(Field.ALL), null));
assertEquals(2, entities.size());

View File

@ -186,7 +186,7 @@ public abstract class TimelineEntityReader extends
*/
protected void createFiltersIfNull() {
if (filters == null) {
filters = new TimelineEntityFilters();
filters = new TimelineEntityFilters.Builder().build();
}
}

View File

@ -107,17 +107,17 @@ import org.apache.hadoop.yarn.server.timelineservice.reader.filter.TimelineKeyVa
*/
@Private
@Unstable
public class TimelineEntityFilters {
private long limit;
public final class TimelineEntityFilters {
private final long limit;
private long createdTimeBegin;
private long createdTimeEnd;
private TimelineFilterList relatesTo;
private TimelineFilterList isRelatedTo;
private TimelineFilterList infoFilters;
private TimelineFilterList configFilters;
private TimelineFilterList metricFilters;
private TimelineFilterList eventFilters;
private String fromId;
private final TimelineFilterList relatesTo;
private final TimelineFilterList isRelatedTo;
private final TimelineFilterList infoFilters;
private final TimelineFilterList configFilters;
private final TimelineFilterList metricFilters;
private final TimelineFilterList eventFilters;
private final String fromId;
private static final long DEFAULT_BEGIN_TIME = 0L;
private static final long DEFAULT_END_TIME = Long.MAX_VALUE;
@ -127,30 +127,14 @@ public class TimelineEntityFilters {
*/
public static final long DEFAULT_LIMIT = 100;
public TimelineEntityFilters() {
this(null, null, null, null, null, null, null, null, null);
}
public TimelineEntityFilters(Long entityLimit, Long timeBegin, Long timeEnd,
TimelineFilterList entityRelatesTo, TimelineFilterList entityIsRelatedTo,
TimelineFilterList entityInfoFilters,
TimelineFilterList entityConfigFilters,
TimelineFilterList entityMetricFilters,
TimelineFilterList entityEventFilters, String fromid) {
this(entityLimit, timeBegin, timeEnd, entityRelatesTo, entityIsRelatedTo,
entityInfoFilters, entityConfigFilters, entityMetricFilters,
entityEventFilters);
this.fromId = fromid;
}
public TimelineEntityFilters(
private TimelineEntityFilters(
Long entityLimit, Long timeBegin, Long timeEnd,
TimelineFilterList entityRelatesTo,
TimelineFilterList entityIsRelatedTo,
TimelineFilterList entityInfoFilters,
TimelineFilterList entityConfigFilters,
TimelineFilterList entityMetricFilters,
TimelineFilterList entityEventFilters) {
TimelineFilterList entityEventFilters, String fromId) {
if (entityLimit == null || entityLimit < 0) {
this.limit = DEFAULT_LIMIT;
} else {
@ -172,97 +156,119 @@ public class TimelineEntityFilters {
this.configFilters = entityConfigFilters;
this.metricFilters = entityMetricFilters;
this.eventFilters = entityEventFilters;
this.fromId = fromId;
}
public long getLimit() {
return limit;
}
public void setLimit(Long entityLimit) {
if (entityLimit == null || entityLimit < 0) {
this.limit = DEFAULT_LIMIT;
} else {
this.limit = entityLimit;
}
}
public long getCreatedTimeBegin() {
return createdTimeBegin;
}
public void setCreatedTimeBegin(Long timeBegin) {
if (timeBegin == null || timeBegin < 0) {
this.createdTimeBegin = DEFAULT_BEGIN_TIME;
} else {
this.createdTimeBegin = timeBegin;
}
}
public long getCreatedTimeEnd() {
return createdTimeEnd;
}
public void setCreatedTimeEnd(Long timeEnd) {
if (timeEnd == null || timeEnd < 0) {
this.createdTimeEnd = DEFAULT_END_TIME;
} else {
this.createdTimeEnd = timeEnd;
}
}
public TimelineFilterList getRelatesTo() {
return relatesTo;
}
public void setRelatesTo(TimelineFilterList relations) {
this.relatesTo = relations;
}
public TimelineFilterList getIsRelatedTo() {
return isRelatedTo;
}
public void setIsRelatedTo(TimelineFilterList relations) {
this.isRelatedTo = relations;
}
public TimelineFilterList getInfoFilters() {
return infoFilters;
}
public void setInfoFilters(TimelineFilterList filters) {
this.infoFilters = filters;
}
public TimelineFilterList getConfigFilters() {
return configFilters;
}
public void setConfigFilters(TimelineFilterList filters) {
this.configFilters = filters;
}
public TimelineFilterList getMetricFilters() {
return metricFilters;
}
public void setMetricFilters(TimelineFilterList filters) {
this.metricFilters = filters;
}
public TimelineFilterList getEventFilters() {
return eventFilters;
}
public void setEventFilters(TimelineFilterList filters) {
this.eventFilters = filters;
}
public String getFromId() {
return fromId;
}
public void setFromId(String fromId) {
this.fromId = fromId;
/**
* A builder class to build an instance of TimelineEntityFilters.
*/
public static class Builder {
private Long entityLimit;
private Long createdTimeBegin;
private Long createdTimeEnd;
private TimelineFilterList relatesToFilters;
private TimelineFilterList isRelatedToFilters;
private TimelineFilterList entityInfoFilters;
private TimelineFilterList entityConfigFilters;
private TimelineFilterList entityMetricFilters;
private TimelineFilterList entityEventFilters;
private String entityFromId;
public Builder entityLimit(Long limit) {
this.entityLimit = limit;
return this;
}
public Builder createdTimeBegin(Long timeBegin) {
this.createdTimeBegin = timeBegin;
return this;
}
public Builder createTimeEnd(Long timeEnd) {
this.createdTimeEnd = timeEnd;
return this;
}
public Builder relatesTo(TimelineFilterList relatesTo) {
this.relatesToFilters = relatesTo;
return this;
}
public Builder isRelatedTo(TimelineFilterList isRelatedTo) {
this.isRelatedToFilters = isRelatedTo;
return this;
}
public Builder infoFilters(TimelineFilterList infoFilters) {
this.entityInfoFilters = infoFilters;
return this;
}
public Builder configFilters(TimelineFilterList configFilters) {
this.entityConfigFilters = configFilters;
return this;
}
public Builder metricFilters(TimelineFilterList metricFilters) {
this.entityMetricFilters = metricFilters;
return this;
}
public Builder eventFilters(TimelineFilterList eventFilters) {
this.entityEventFilters = eventFilters;
return this;
}
public Builder fromId(String fromId) {
this.entityFromId = fromId;
return this;
}
public TimelineEntityFilters build() {
return new TimelineEntityFilters(entityLimit, createdTimeBegin,
createdTimeEnd, relatesToFilters, isRelatedToFilters,
entityInfoFilters, entityConfigFilters, entityMetricFilters,
entityEventFilters, entityFromId);
}
}
}

View File

@ -1393,10 +1393,8 @@ public class TimelineReaderWebServices {
DateRange range = parseDateRange(dateRange);
TimelineEntityFilters entityFilters =
TimelineReaderWebServicesUtils.createTimelineEntityFilters(
limit, null, null, null, null, null, null, null, null,
fromId);
entityFilters.setCreatedTimeBegin(range.dateStart);
entityFilters.setCreatedTimeEnd(range.dateEnd);
limit, range.dateStart, range.dateEnd,
null, null, null, null, null, null, fromId);
entities = timelineReaderManager.getEntities(
TimelineReaderWebServicesUtils.createTimelineReaderContext(
clusterId, null, null, null, null,

View File

@ -76,12 +76,44 @@ final class TimelineReaderWebServicesUtils {
String isRelatedTo, String infofilters, String conffilters,
String metricfilters, String eventfilters,
String fromid) throws TimelineParseException {
return new TimelineEntityFilters(parseLongStr(limit),
parseLongStr(createdTimeStart), parseLongStr(createdTimeEnd),
parseRelationFilters(relatesTo), parseRelationFilters(isRelatedTo),
parseKVFilters(infofilters, false), parseKVFilters(conffilters, true),
parseMetricFilters(metricfilters), parseEventFilters(eventfilters),
parseStr(fromid));
return createTimelineEntityFilters(
limit, parseLongStr(createdTimeStart),
parseLongStr(createdTimeEnd),
relatesTo, isRelatedTo, infofilters,
conffilters, metricfilters, eventfilters, fromid);
}
/**
* Parse the passed filters represented as strings and convert them into a
* {@link TimelineEntityFilters} object.
* @param limit Limit to number of entities to return.
* @param createdTimeStart Created time start for the entities to return.
* @param createdTimeEnd Created time end for the entities to return.
* @param relatesTo Entities to return must match relatesTo.
* @param isRelatedTo Entities to return must match isRelatedTo.
* @param infofilters Entities to return must match these info filters.
* @param conffilters Entities to return must match these metric filters.
* @param metricfilters Entities to return must match these metric filters.
* @param eventfilters Entities to return must match these event filters.
* @return a {@link TimelineEntityFilters} object.
* @throws TimelineParseException if any problem occurs during parsing.
*/
static TimelineEntityFilters createTimelineEntityFilters(String limit,
Long createdTimeStart, Long createdTimeEnd, String relatesTo,
String isRelatedTo, String infofilters, String conffilters,
String metricfilters, String eventfilters,
String fromid) throws TimelineParseException {
return new TimelineEntityFilters.Builder()
.entityLimit(parseLongStr(limit))
.createdTimeBegin(createdTimeStart)
.createTimeEnd(createdTimeEnd)
.relatesTo(parseRelationFilters(relatesTo))
.isRelatedTo(parseRelationFilters(isRelatedTo))
.infoFilters(parseKVFilters(infofilters, false))
.configFilters(parseKVFilters(conffilters, true))
.metricFilters(parseMetricFilters(metricfilters))
.eventFilters(parseEventFilters(eventfilters))
.fromId(parseStr(fromid)).build();
}
/**

View File

@ -398,7 +398,7 @@ public class TestFileSystemTimelineReaderImpl {
public void testGetAllEntities() throws Exception {
Set<TimelineEntity> result = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "flow1", 1L, "app1",
"app", null), new TimelineEntityFilters(),
"app", null), new TimelineEntityFilters.Builder().build(),
new TimelineDataToRetrieve(null, null, EnumSet.of(Field.ALL), null));
// All 4 entities will be returned
Assert.assertEquals(4, result.size());
@ -409,8 +409,8 @@ public class TestFileSystemTimelineReaderImpl {
Set<TimelineEntity> result = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "flow1", 1L, "app1",
"app", null),
new TimelineEntityFilters(2L, null, null, null, null, null, null,
null, null), new TimelineDataToRetrieve());
new TimelineEntityFilters.Builder().entityLimit(2L).build(),
new TimelineDataToRetrieve());
Assert.assertEquals(2, result.size());
// Needs to be rewritten once hashcode and equals for
// TimelineEntity is implemented
@ -424,8 +424,8 @@ public class TestFileSystemTimelineReaderImpl {
result = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "flow1", 1L, "app1",
"app", null),
new TimelineEntityFilters(3L, null, null, null, null, null, null,
null, null), new TimelineDataToRetrieve());
new TimelineEntityFilters.Builder().entityLimit(3L).build(),
new TimelineDataToRetrieve());
// Even though 2 entities out of 4 have same created time, one entity
// is left out due to limit
Assert.assertEquals(3, result.size());
@ -437,8 +437,8 @@ public class TestFileSystemTimelineReaderImpl {
Set<TimelineEntity> result = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "flow1", 1L, "app1",
"app", null),
new TimelineEntityFilters(null, 1425016502030L, 1425016502060L, null,
null, null, null, null, null),
new TimelineEntityFilters.Builder().createdTimeBegin(1425016502030L)
.createTimeEnd(1425016502060L).build(),
new TimelineDataToRetrieve());
Assert.assertEquals(1, result.size());
// Only one entity with ID id_4 should be returned.
@ -452,9 +452,9 @@ public class TestFileSystemTimelineReaderImpl {
result = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "flow1", 1L, "app1",
"app", null),
new TimelineEntityFilters(null, null, 1425016502010L, null, null,
null, null, null, null),
new TimelineDataToRetrieve());
new TimelineEntityFilters.Builder().createTimeEnd(1425016502010L)
.build(),
new TimelineDataToRetrieve());
Assert.assertEquals(3, result.size());
for (TimelineEntity entity : result) {
if (entity.getId().equals("id_4")) {
@ -466,8 +466,8 @@ public class TestFileSystemTimelineReaderImpl {
result = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "flow1", 1L, "app1",
"app", null),
new TimelineEntityFilters(null, 1425016502010L, null, null, null,
null, null, null, null),
new TimelineEntityFilters.Builder().createdTimeBegin(1425016502010L)
.build(),
new TimelineDataToRetrieve());
Assert.assertEquals(1, result.size());
for (TimelineEntity entity : result) {
@ -486,8 +486,7 @@ public class TestFileSystemTimelineReaderImpl {
Set<TimelineEntity> result = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "flow1", 1L, "app1",
"app", null),
new TimelineEntityFilters(null, null, null, null, null, infoFilterList,
null, null, null),
new TimelineEntityFilters.Builder().infoFilters(infoFilterList).build(),
new TimelineDataToRetrieve());
Assert.assertEquals(1, result.size());
// Only one entity with ID id_3 should be returned.
@ -506,8 +505,8 @@ public class TestFileSystemTimelineReaderImpl {
result = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "flow1", 1L, "app1",
"app", null),
new TimelineEntityFilters(null, null, null, null, null, null,
confFilterList, null, null),
new TimelineEntityFilters.Builder().configFilters(confFilterList)
.build(),
new TimelineDataToRetrieve());
Assert.assertEquals(1, result.size());
for (TimelineEntity entity : result) {
@ -525,8 +524,7 @@ public class TestFileSystemTimelineReaderImpl {
result = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "flow1", 1L, "app1",
"app", null),
new TimelineEntityFilters(null, null, null, null, null, null, null,
null, eventFilters),
new TimelineEntityFilters.Builder().eventFilters(eventFilters).build(),
new TimelineDataToRetrieve());
Assert.assertEquals(1, result.size());
for (TimelineEntity entity : result) {
@ -542,8 +540,8 @@ public class TestFileSystemTimelineReaderImpl {
result = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "flow1", 1L, "app1",
"app", null),
new TimelineEntityFilters(null, null, null, null, null, null, null,
metricFilterList, null),
new TimelineEntityFilters.Builder().metricFilters(metricFilterList)
.build(),
new TimelineDataToRetrieve());
Assert.assertEquals(2, result.size());
// Two entities with IDs' id_1 and id_2 should be returned.
@ -569,8 +567,8 @@ public class TestFileSystemTimelineReaderImpl {
result = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "flow1", 1L, "app1",
"app", null),
new TimelineEntityFilters(null, null, null, null, null, null,
confFilterList1, null, null),
new TimelineEntityFilters.Builder().configFilters(confFilterList1)
.build(),
new TimelineDataToRetrieve());
Assert.assertEquals(2, result.size());
for (TimelineEntity entity : result) {
@ -592,8 +590,8 @@ public class TestFileSystemTimelineReaderImpl {
result = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "flow1", 1L, "app1",
"app", null),
new TimelineEntityFilters(null, null, null, null, null, null,
confFilterList2, null, null),
new TimelineEntityFilters.Builder().configFilters(confFilterList2)
.build(),
new TimelineDataToRetrieve());
Assert.assertEquals(2, result.size());
for (TimelineEntity entity : result) {
@ -610,8 +608,8 @@ public class TestFileSystemTimelineReaderImpl {
result = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "flow1", 1L, "app1",
"app", null),
new TimelineEntityFilters(null, null, null, null, null, null,
confFilterList3, null, null),
new TimelineEntityFilters.Builder().configFilters(confFilterList3)
.build(),
new TimelineDataToRetrieve());
Assert.assertEquals(1, result.size());
for(TimelineEntity entity : result) {
@ -628,8 +626,8 @@ public class TestFileSystemTimelineReaderImpl {
result = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "flow1", 1L, "app1",
"app", null),
new TimelineEntityFilters(null, null, null, null, null, null,
confFilterList4, null, null),
new TimelineEntityFilters.Builder().configFilters(confFilterList4)
.build(),
new TimelineDataToRetrieve());
Assert.assertEquals(0, result.size());
@ -641,8 +639,8 @@ public class TestFileSystemTimelineReaderImpl {
result = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "flow1", 1L, "app1",
"app", null),
new TimelineEntityFilters(null, null, null, null, null, null,
confFilterList5, null, null),
new TimelineEntityFilters.Builder().configFilters(confFilterList5)
.build(),
new TimelineDataToRetrieve());
Assert.assertEquals(1, result.size());
for (TimelineEntity entity : result) {
@ -665,8 +663,8 @@ public class TestFileSystemTimelineReaderImpl {
result = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "flow1", 1L, "app1",
"app", null),
new TimelineEntityFilters(null, null, null, null, null, null, null,
metricFilterList1, null),
new TimelineEntityFilters.Builder().metricFilters(metricFilterList1)
.build(),
new TimelineDataToRetrieve());
Assert.assertEquals(2, result.size());
// Two entities with IDs' id_2 and id_3 should be returned.
@ -684,8 +682,8 @@ public class TestFileSystemTimelineReaderImpl {
result = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "flow1", 1L, "app1",
"app", null),
new TimelineEntityFilters(null, null, null, null, null, null, null,
metricFilterList2, null),
new TimelineEntityFilters.Builder().metricFilters(metricFilterList2)
.build(),
new TimelineDataToRetrieve());
Assert.assertEquals(1, result.size());
for (TimelineEntity entity : result) {
@ -702,8 +700,8 @@ public class TestFileSystemTimelineReaderImpl {
result = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "flow1", 1L, "app1",
"app", null),
new TimelineEntityFilters(null, null, null, null, null, null, null,
metricFilterList3, null),
new TimelineEntityFilters.Builder().metricFilters(metricFilterList3)
.build(),
new TimelineDataToRetrieve());
Assert.assertEquals(0, result.size());
@ -715,8 +713,8 @@ public class TestFileSystemTimelineReaderImpl {
result = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "flow1", 1L, "app1",
"app", null),
new TimelineEntityFilters(null, null, null, null, null, null, null,
metricFilterList4, null),
new TimelineEntityFilters.Builder().metricFilters(metricFilterList4)
.build(),
new TimelineDataToRetrieve());
Assert.assertEquals(2, result.size());
for (TimelineEntity entity : result) {
@ -731,8 +729,8 @@ public class TestFileSystemTimelineReaderImpl {
result = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "flow1", 1L, "app1",
"app", null),
new TimelineEntityFilters(null, null, null, null, null, null, null,
metricFilterList5, null),
new TimelineEntityFilters.Builder().metricFilters(metricFilterList5)
.build(),
new TimelineDataToRetrieve());
Assert.assertEquals(2, result.size());
for (TimelineEntity entity : result) {
@ -749,8 +747,8 @@ public class TestFileSystemTimelineReaderImpl {
result = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "flow1", 1L, "app1",
"app", null),
new TimelineEntityFilters(null, null, null, null, null, infoFilterList1,
null, null, null),
new TimelineEntityFilters.Builder().infoFilters(infoFilterList1)
.build(),
new TimelineDataToRetrieve());
Assert.assertEquals(0, result.size());
@ -762,8 +760,8 @@ public class TestFileSystemTimelineReaderImpl {
result = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "flow1", 1L, "app1",
"app", null),
new TimelineEntityFilters(null, null, null, null, null, infoFilterList2,
null, null, null),
new TimelineEntityFilters.Builder().infoFilters(infoFilterList2)
.build(),
new TimelineDataToRetrieve());
Assert.assertEquals(2, result.size());
for (TimelineEntity entity : result) {
@ -780,8 +778,8 @@ public class TestFileSystemTimelineReaderImpl {
result = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "flow1", 1L, "app1",
"app", null),
new TimelineEntityFilters(null, null, null, null, null, infoFilterList3,
null, null, null),
new TimelineEntityFilters.Builder().infoFilters(infoFilterList3)
.build(),
new TimelineDataToRetrieve());
Assert.assertEquals(0, result.size());
@ -793,8 +791,8 @@ public class TestFileSystemTimelineReaderImpl {
result = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "flow1", 1L, "app1",
"app", null),
new TimelineEntityFilters(null, null, null, null, null, infoFilterList4,
null, null, null),
new TimelineEntityFilters.Builder().infoFilters(infoFilterList4)
.build(),
new TimelineDataToRetrieve());
Assert.assertEquals(1, result.size());
for (TimelineEntity entity : result) {
@ -815,8 +813,7 @@ public class TestFileSystemTimelineReaderImpl {
Set<TimelineEntity> result = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "flow1", 1L, "app1",
"app", null),
new TimelineEntityFilters(null, null, null, relatesTo, null, null,
null, null, null),
new TimelineEntityFilters.Builder().relatesTo(relatesTo).build(),
new TimelineDataToRetrieve());
Assert.assertEquals(1, result.size());
// Only one entity with ID id_1 should be returned.
@ -835,8 +832,7 @@ public class TestFileSystemTimelineReaderImpl {
result = reader.getEntities(
new TimelineReaderContext("cluster1", "user1", "flow1", 1L, "app1",
"app", null),
new TimelineEntityFilters(null, null, null, null, isRelatedTo, null,
null, null, null),
new TimelineEntityFilters.Builder().isRelatedTo(isRelatedTo).build(),
new TimelineDataToRetrieve());
Assert.assertEquals(2, result.size());
// Two entities with IDs' id_1 and id_3 should be returned.