Search in sources :

Example 1 with EventBuilder

use of org.ff4j.audit.EventBuilder in project ff4j by ff4j.

the class AuditBeanTest method testTimeSerieChart.

@Test
public void testTimeSerieChart() {
    long top = System.currentTimeMillis();
    TimeSeriesChart t1 = new TimeSeriesChart(top - 100000, top + 100000, TimeUnit.MINUTES);
    new TimeSeriesChart(top - 100000, top + 100000, TimeUnit.HOURS);
    new TimeSeriesChart(top - 100000, top + 100000, TimeUnit.DAYS);
    new TimeSeriesChart(top - 100000, top + 100000, TimeUnit.SECONDS);
    t1.addEvent(new EventBuilder().name("f1").build());
    t1.addEvent(new EventBuilder().name("f2").build());
    Assert.assertNotNull(t1.getSdf());
    Assert.assertNotNull(t1.toString());
    TimeSeriesChart tsc1 = new TimeSeriesChart();
    tsc1.setSdf(new SimpleDateFormat("yyyy"));
    tsc1.setTimeSlots(new ArrayList<String>());
    tsc1.setSeries(new HashMap<String, Serie<Map<String, MutableHitCount>>>());
    Assert.assertNotNull(tsc1);
}
Also used : EventBuilder(org.ff4j.audit.EventBuilder) TimeSeriesChart(org.ff4j.audit.chart.TimeSeriesChart) SimpleDateFormat(java.text.SimpleDateFormat) Serie(org.ff4j.audit.chart.Serie) MutableHitCount(org.ff4j.audit.MutableHitCount) Test(org.junit.Test)

Example 2 with EventBuilder

use of org.ff4j.audit.EventBuilder in project ff4j by ff4j.

the class AuditBeanTest method testEventBuider.

@Test
public void testEventBuider() {
    FF4j ff4j = new FF4j();
    ff4j.setAuthorizationsManager(new DefinedPermissionSecurityManager("a", Util.set("1", "2")));
    EventBuilder eb = new EventBuilder(ff4j);
    eb.name("FeatureX");
    Assert.assertEquals("a", eb.build().getUser());
}
Also used : EventBuilder(org.ff4j.audit.EventBuilder) FF4j(org.ff4j.FF4j) DefinedPermissionSecurityManager(org.ff4j.test.DefinedPermissionSecurityManager) Test(org.junit.Test)

Example 3 with EventBuilder

use of org.ff4j.audit.EventBuilder in project ff4j by ff4j.

the class AuditBeanTest method testAverageDuration.

@Test
public void testAverageDuration() {
    EventSeries es = new EventSeries();
    es.add(new EventBuilder().duration(1).build());
    es.add(new EventBuilder().duration(3).build());
    Assert.assertEquals(new Double(2), new Double(es.getAverageDuration()));
}
Also used : EventBuilder(org.ff4j.audit.EventBuilder) EventSeries(org.ff4j.audit.EventSeries) Test(org.junit.Test)

Aggregations

EventBuilder (org.ff4j.audit.EventBuilder)3 Test (org.junit.Test)3 SimpleDateFormat (java.text.SimpleDateFormat)1 FF4j (org.ff4j.FF4j)1 EventSeries (org.ff4j.audit.EventSeries)1 MutableHitCount (org.ff4j.audit.MutableHitCount)1 Serie (org.ff4j.audit.chart.Serie)1 TimeSeriesChart (org.ff4j.audit.chart.TimeSeriesChart)1 DefinedPermissionSecurityManager (org.ff4j.test.DefinedPermissionSecurityManager)1