|
|
@ -1,5 +1,5 @@
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* Copyright 2012-2017 the original author or authors.
|
|
|
|
* Copyright 2012-2018 the original author or authors.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
@ -45,7 +45,7 @@ public class InMemoryAuditEventRepositoryTests {
|
|
|
|
InMemoryAuditEventRepository repository = new InMemoryAuditEventRepository();
|
|
|
|
InMemoryAuditEventRepository repository = new InMemoryAuditEventRepository();
|
|
|
|
repository.add(new AuditEvent("dave", "a"));
|
|
|
|
repository.add(new AuditEvent("dave", "a"));
|
|
|
|
repository.add(new AuditEvent("dave", "b"));
|
|
|
|
repository.add(new AuditEvent("dave", "b"));
|
|
|
|
List<AuditEvent> events = repository.find("dave", null);
|
|
|
|
List<AuditEvent> events = repository.find("dave", null, null);
|
|
|
|
assertThat(events.size()).isEqualTo(2);
|
|
|
|
assertThat(events.size()).isEqualTo(2);
|
|
|
|
assertThat(events.get(0).getType()).isEqualTo("a");
|
|
|
|
assertThat(events.get(0).getType()).isEqualTo("a");
|
|
|
|
assertThat(events.get(1).getType()).isEqualTo("b");
|
|
|
|
assertThat(events.get(1).getType()).isEqualTo("b");
|
|
|
@ -57,7 +57,7 @@ public class InMemoryAuditEventRepositoryTests {
|
|
|
|
repository.add(new AuditEvent("dave", "a"));
|
|
|
|
repository.add(new AuditEvent("dave", "a"));
|
|
|
|
repository.add(new AuditEvent("dave", "b"));
|
|
|
|
repository.add(new AuditEvent("dave", "b"));
|
|
|
|
repository.add(new AuditEvent("dave", "c"));
|
|
|
|
repository.add(new AuditEvent("dave", "c"));
|
|
|
|
List<AuditEvent> events = repository.find("dave", null);
|
|
|
|
List<AuditEvent> events = repository.find("dave", null, null);
|
|
|
|
assertThat(events.size()).isEqualTo(2);
|
|
|
|
assertThat(events.size()).isEqualTo(2);
|
|
|
|
assertThat(events.get(0).getType()).isEqualTo("b");
|
|
|
|
assertThat(events.get(0).getType()).isEqualTo("b");
|
|
|
|
assertThat(events.get(1).getType()).isEqualTo("c");
|
|
|
|
assertThat(events.get(1).getType()).isEqualTo("c");
|
|
|
@ -78,7 +78,7 @@ public class InMemoryAuditEventRepositoryTests {
|
|
|
|
repository.add(new AuditEvent("phil", "b"));
|
|
|
|
repository.add(new AuditEvent("phil", "b"));
|
|
|
|
repository.add(new AuditEvent("dave", "c"));
|
|
|
|
repository.add(new AuditEvent("dave", "c"));
|
|
|
|
repository.add(new AuditEvent("phil", "d"));
|
|
|
|
repository.add(new AuditEvent("phil", "d"));
|
|
|
|
List<AuditEvent> events = repository.find("dave", null);
|
|
|
|
List<AuditEvent> events = repository.find("dave", null, null);
|
|
|
|
assertThat(events.size()).isEqualTo(2);
|
|
|
|
assertThat(events.size()).isEqualTo(2);
|
|
|
|
assertThat(events.get(0).getType()).isEqualTo("a");
|
|
|
|
assertThat(events.get(0).getType()).isEqualTo("a");
|
|
|
|
assertThat(events.get(1).getType()).isEqualTo("c");
|
|
|
|
assertThat(events.get(1).getType()).isEqualTo("c");
|
|
|
@ -113,11 +113,11 @@ public class InMemoryAuditEventRepositoryTests {
|
|
|
|
calendar.add(Calendar.DAY_OF_YEAR, 1);
|
|
|
|
calendar.add(Calendar.DAY_OF_YEAR, 1);
|
|
|
|
repository.add(new AuditEvent(calendar.getTime(), "phil", "d", data));
|
|
|
|
repository.add(new AuditEvent(calendar.getTime(), "phil", "d", data));
|
|
|
|
calendar.add(Calendar.DAY_OF_YEAR, 1);
|
|
|
|
calendar.add(Calendar.DAY_OF_YEAR, 1);
|
|
|
|
List<AuditEvent> events = repository.find(after);
|
|
|
|
List<AuditEvent> events = repository.find(null, after, null);
|
|
|
|
assertThat(events.size()).isEqualTo(2);
|
|
|
|
assertThat(events.size()).isEqualTo(2);
|
|
|
|
assertThat(events.get(0).getType()).isEqualTo("c");
|
|
|
|
assertThat(events.get(0).getType()).isEqualTo("c");
|
|
|
|
assertThat(events.get(1).getType()).isEqualTo("d");
|
|
|
|
assertThat(events.get(1).getType()).isEqualTo("d");
|
|
|
|
events = repository.find("dave", after);
|
|
|
|
events = repository.find("dave", after, null);
|
|
|
|
assertThat(events.size()).isEqualTo(1);
|
|
|
|
assertThat(events.size()).isEqualTo(1);
|
|
|
|
assertThat(events.get(0).getType()).isEqualTo("c");
|
|
|
|
assertThat(events.get(0).getType()).isEqualTo("c");
|
|
|
|
}
|
|
|
|
}
|
|
|
|