diff options
Diffstat (limited to 'sdnr/wt/data-provider/dblib/src/test')
2 files changed, 25 insertions, 8 deletions
diff --git a/sdnr/wt/data-provider/dblib/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/dblib/test/TestMariaDataProvider.java b/sdnr/wt/data-provider/dblib/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/dblib/test/TestMariaDataProvider.java index c9cf27c68..34c4d6fe8 100644 --- a/sdnr/wt/data-provider/dblib/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/dblib/test/TestMariaDataProvider.java +++ b/sdnr/wt/data-provider/dblib/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/dblib/test/TestMariaDataProvider.java @@ -183,7 +183,8 @@ public class TestMariaDataProvider { assertEquals(2, faultCurrents.getData().size()); ReadStatusOutputBuilder status = null; try { - status = dbProvider.readStatus(); + EntityInput input=null; + status = dbProvider.readStatus(input); } catch (IOException e) { e.printStackTrace(); fail("failed to read status"); @@ -567,7 +568,8 @@ public class TestMariaDataProvider { ReadStatusOutputBuilder status = null; try { - status = dbProvider.readStatus(); + EntityInput input=null; + status = dbProvider.readStatus(input); } catch (IOException e) { e.printStackTrace(); fail("failed to read status"); diff --git a/sdnr/wt/data-provider/dblib/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/dblib/test/TestQuerySyntax.java b/sdnr/wt/data-provider/dblib/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/dblib/test/TestQuerySyntax.java index 576a3825c..7dd2464f9 100644 --- a/sdnr/wt/data-provider/dblib/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/dblib/test/TestQuerySyntax.java +++ b/sdnr/wt/data-provider/dblib/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/dblib/test/TestQuerySyntax.java @@ -1,5 +1,4 @@ -/* - * ============LICENSE_START======================================================= +/* ============LICENSE_START======================================================= * ONAP : ccsdk features * ================================================================================ * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. @@ -27,6 +26,8 @@ import static org.junit.Assert.assertTrue; import java.util.Arrays; import java.util.HashMap; import java.util.Map; +import java.util.Set; + import org.junit.Test; import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.query.CountQuery; import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.query.SelectQuery; @@ -169,7 +170,7 @@ public class TestQuerySyntax { public void testSelectForFilterValues() { EntityInput input = new ReadGuiCutThroughEntryInputBuilder() .setFilter(YangToolsMapperHelper.toMap(Arrays.asList( - new FilterBuilder().setProperty("id").setFiltervalues(Arrays.asList("das", "das2")).build()))) + new FilterBuilder().setProperty("id").setFiltervalues(Set.of("das", "das2")).build()))) .setPagination(new PaginationBuilder().setSize(Uint32.valueOf(20)).setPage(Uint64.valueOf(1)).build()) .build(); SelectQuery query = new SelectQuery(TABLENAME1, input, CONTROLLERID); @@ -190,7 +191,7 @@ public class TestQuerySyntax { public void testSelectForFilterValues3() { EntityInput input = new ReadGuiCutThroughEntryInputBuilder() .setFilter(YangToolsMapperHelper.toMap(Arrays.asList( - new FilterBuilder().setProperty("id").setFiltervalues(Arrays.asList("*","abc")).build()))) + new FilterBuilder().setProperty("id").setFiltervalues(Set.of("*","abc")).build()))) .setPagination(new PaginationBuilder().setSize(Uint32.valueOf(20)).setPage(Uint64.valueOf(1)).build()) .build(); SelectQuery query = new SelectQuery(TABLENAME1, input, CONTROLLERID); @@ -201,8 +202,8 @@ public class TestQuerySyntax { public void testSelectForFilterValues4() { EntityInput input = new ReadGuiCutThroughEntryInputBuilder() .setFilter(YangToolsMapperHelper.toMap(Arrays.asList( - new FilterBuilder().setProperty("id").setFiltervalues(Arrays.asList("abc")).build(), - new FilterBuilder().setProperty("node-id").setFiltervalues(Arrays.asList("*")).build()))) + new FilterBuilder().setProperty("id").setFiltervalues(Set.of("abc")).build(), + new FilterBuilder().setProperty("node-id").setFiltervalues(Set.of("*")).build()))) .setPagination(new PaginationBuilder().setSize(Uint32.valueOf(20)).setPage(Uint64.valueOf(1)).build()) .build(); SelectQuery query = new SelectQuery(TABLENAME1, input, CONTROLLERID); @@ -210,6 +211,20 @@ public class TestQuerySyntax { assertFalse(query.toSql().contains("RLIKE")); } @Test + public void testSelectForFilterValues5() { + EntityInput input = new ReadGuiCutThroughEntryInputBuilder() + .setFilter(YangToolsMapperHelper.toMap(Arrays.asList( + new FilterBuilder().setProperty("id").setFiltervalues(Set.of("abc")).build(), + new FilterBuilder().setProperty("node-id").setFiltervalues(Set.of("*ran*")).build()))) + .setPagination(new PaginationBuilder().setSize(Uint32.valueOf(20)).setPage(Uint64.valueOf(1)).build()) + .build(); + SelectQuery query = new SelectQuery(TABLENAME1, input, CONTROLLERID); + System.out.println(query.toSql()); + assertTrue(query.toSql().contains("RLIKE")); + assertTrue(query.toSql().contains(".*")); + + } + @Test public void testCount() { CountQuery query = new CountQuery(Entity.Eventlog, TestMariaDataProvider.createInput(1, 20)); String sQuery = query.toSql(); |