diff options
author | Michael Dürre <michael.duerre@highstreet-technologies.com> | 2022-07-20 09:32:50 +0200 |
---|---|---|
committer | Michael Dürre <michael.duerre@highstreet-technologies.com> | 2022-07-21 12:38:52 +0200 |
commit | 25423c50e504676f15c7a57c03aad40bfc35c7e6 (patch) | |
tree | 811649e2ec44e0332e601c6563e00e914d355b9a /sdnr/wt/data-provider/dblib/src/test/java/org | |
parent | cea47224b7b6afdd7b3d3ead8d08baf46eadc575 (diff) |
migrate sdnr features to sulfur
fix sdnr code for sulfur
Issue-ID: CCSDK-3692
Signed-off-by: Michael Dürre <michael.duerre@highstreet-technologies.com>
Change-Id: I0a62ade424bb978222e7ce6450215fb327f957b7
Signed-off-by: Michael Dürre <michael.duerre@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wt/data-provider/dblib/src/test/java/org')
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(); |