Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* RAD-5256 Adding afterTest method to delete the data source between tests cases.

* RAD-5256 removing unused import

---------

Co-authored-by: Benjamin Perez <benji811124@users.noreply.github.com>
  • Loading branch information
benji811124 and benji811124 committed Feb 16, 2024
1 parent ddf7501 commit 2b179d8
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;

import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -69,6 +70,8 @@ public class EventInstanceWithTagsQueryTest extends MangoTestBase {
private User point2User;
private User allUser;

private MockDataSourceVO ds;

private final Random random = new Random();

@Before
Expand All @@ -82,12 +85,13 @@ public void before(){

setupRoles();


AtomicInteger count = new AtomicInteger();
List<String> tagKeys = Stream.generate(() -> "key" + count.getAndIncrement())
.limit(2).collect(Collectors.toList());
allTags = tagKeys.stream().collect(Collectors.toMap(Function.identity(), k -> k + "_value" + random.nextInt(10)));

MockDataSourceVO ds = createMockDataSource(true);
ds = createMockDataSource(true);

//Insert 2 data points
point1 = createMockDataPoint(ds, (dp) -> {
Expand Down Expand Up @@ -125,6 +129,12 @@ public void before(){
});
}

@After
public void afterTest(){
DataSourceService service = Common.getBean(DataSourceService.class);
service.delete(ds);
}

@Test
public void testTagQuery() {

Expand Down

0 comments on commit 2b179d8

Please sign in to comment.