summaryrefslogtreecommitdiffstats
path: root/sdnr/wt/data-provider/dblib/src/test
diff options
context:
space:
mode:
authorMichael Dürre <michael.duerre@highstreet-technologies.com>2022-08-31 08:46:55 +0200
committerDan Timoney <dtimoney@att.com>2022-08-31 21:04:07 +0000
commit34f89faa64f815d5cf33d0905046eaf392017b39 (patch)
tree7bd6295609feb87b3fa187602985b58e34965fe4 /sdnr/wt/data-provider/dblib/src/test
parent63d92319b01b54d72bde494f923f80eb6c242cfe (diff)
add fixes for wt sulfur
fix devmgrs and db access Issue-ID: CCSDK-3749 Signed-off-by: Michael Dürre <michael.duerre@highstreet-technologies.com> Change-Id: I41018d2daa55b200a9ba89e784f8adf4200d32c3 Signed-off-by: Michael Dürre <michael.duerre@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wt/data-provider/dblib/src/test')
-rw-r--r--sdnr/wt/data-provider/dblib/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/dblib/test/TestMariaDataProvider.java41
-rw-r--r--sdnr/wt/data-provider/dblib/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/dblib/test/TestQuerySyntax.java14
-rw-r--r--sdnr/wt/data-provider/dblib/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/dblib/test/util/MariaDBTestBase.java13
3 files changed, 64 insertions, 4 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 34c4d6fe8..33703042e 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
@@ -125,6 +125,7 @@ public class TestMariaDataProvider {
private static final String NODEID1 = "node1";
private static final String NODEID2 = "node2";
+ private static final String NODEID22 = "node22";
private static final String NODEID3 = "node3";
private static final String NODEID4 = "node4";
private static final String NODEID5 = "node5";
@@ -140,6 +141,7 @@ public class TestMariaDataProvider {
private static final String USERNAME = "admin";
private static MariaDBTestBase testBase;
private static SqlDBDataProvider dbProvider;
+ private static SqlDBDataProvider dbProviderOverall;
private static SqlDBClient dbClient;
private static String CONTROLLERID;
@@ -153,6 +155,7 @@ public class TestMariaDataProvider {
MariaDBTestBase.testCreateTableStructure(dbClient);
dbProvider.setControllerId();
CONTROLLERID = dbProvider.getControllerId();
+ dbProviderOverall = testBase.getOverallDbProvider();
}
@@ -533,19 +536,23 @@ public class TestMariaDataProvider {
NetworkElementConnectionEntity ne2 = new NetworkElementConnectionBuilder().setNodeId(NODEID2)
.setHost("10.20.30.55").setPort(Uint32.valueOf(8300)).setIsRequired(false).setUsername("user")
.setPassword("passwd").setStatus(ConnectionLogStatus.Connecting).build();
+ NetworkElementConnectionEntity ne22 = new NetworkElementConnectionBuilder().setNodeId(NODEID22)
+ .setHost("10.20.30.55").setPort(Uint32.valueOf(8300)).setIsRequired(false).setUsername("user")
+ .setPassword("passwd").setStatus(ConnectionLogStatus.Connected).build();
NetworkElementConnectionEntity ne3 = new NetworkElementConnectionBuilder().setNodeId(NODEID3)
.setHost("10.20.30.55").setPort(Uint32.valueOf(8300)).setIsRequired(false).setUsername("user")
.setPassword("passwd").setStatus(ConnectionLogStatus.Connecting).build();
try {
dbProvider.createNetworkElementConnection(ne1);
dbProvider.createNetworkElementConnection(ne2);
+ dbProvider.createNetworkElementConnection(ne22);
dbProvider.updateNetworkConnection22(ne3, NODEID3);
} catch (IOException e) {
e.printStackTrace();
fail("problem creating neconnection");
}
data = dbProvider.readNetworkElementConnectionList(createInput(1, 20));
- assertEquals(3, data.getData().size());
+ assertEquals(4, data.getData().size());
NetworkElementConnectionEntity update1 = new NetworkElementConnectionBuilder()
.setStatus(ConnectionLogStatus.Connected).setDeviceType(NetworkElementDeviceType.ORAN).build();
dbProvider.updateNetworkConnectionDeviceType(update1, NODEID1);
@@ -574,15 +581,41 @@ public class TestMariaDataProvider {
e.printStackTrace();
fail("failed to read status");
}
- assertEquals(1, status.getData().get(0).getNetworkElementConnections().getConnected().intValue());
+ assertEquals(2, status.getData().get(0).getNetworkElementConnections().getConnected().intValue());
assertEquals(2, status.getData().get(0).getNetworkElementConnections().getConnecting().intValue());
assertEquals(0, status.getData().get(0).getNetworkElementConnections().getDisconnected().intValue());
assertEquals(0, status.getData().get(0).getNetworkElementConnections().getMounted().intValue());
- assertEquals(3, status.getData().get(0).getNetworkElementConnections().getTotal().intValue());
+ assertEquals(4, status.getData().get(0).getNetworkElementConnections().getTotal().intValue());
assertEquals(0, status.getData().get(0).getNetworkElementConnections().getUnableToConnect().intValue());
assertEquals(0, status.getData().get(0).getNetworkElementConnections().getUndefined().intValue());
assertEquals(0, status.getData().get(0).getNetworkElementConnections().getUnmounted().intValue());
+ ReadStatusOutputBuilder status2=null;
+ try {
+ EntityInput input=createInput("node-id","node2*", 1, 20);
+ status = dbProvider.readStatus(input);
+ status2 = dbProviderOverall.readStatus(input);
+ } catch (IOException e) {
+ e.printStackTrace();
+ fail("failed to read status");
+ }
+ assertEquals(1, status.getData().get(0).getNetworkElementConnections().getConnected().intValue());
+ assertEquals(1, status.getData().get(0).getNetworkElementConnections().getConnecting().intValue());
+ assertEquals(0, status.getData().get(0).getNetworkElementConnections().getDisconnected().intValue());
+ assertEquals(0, status.getData().get(0).getNetworkElementConnections().getMounted().intValue());
+ assertEquals(2, status.getData().get(0).getNetworkElementConnections().getTotal().intValue());
+ assertEquals(0, status.getData().get(0).getNetworkElementConnections().getUnableToConnect().intValue());
+ assertEquals(0, status.getData().get(0).getNetworkElementConnections().getUndefined().intValue());
+ assertEquals(0, status.getData().get(0).getNetworkElementConnections().getUnmounted().intValue());
+
+ assertEquals(1, status2.getData().get(0).getNetworkElementConnections().getConnected().intValue());
+ assertEquals(1, status2.getData().get(0).getNetworkElementConnections().getConnecting().intValue());
+ assertEquals(0, status2.getData().get(0).getNetworkElementConnections().getDisconnected().intValue());
+ assertEquals(0, status2.getData().get(0).getNetworkElementConnections().getMounted().intValue());
+ assertEquals(2, status2.getData().get(0).getNetworkElementConnections().getTotal().intValue());
+ assertEquals(0, status2.getData().get(0).getNetworkElementConnections().getUnableToConnect().intValue());
+ assertEquals(0, status2.getData().get(0).getNetworkElementConnections().getUndefined().intValue());
+ assertEquals(0, status2.getData().get(0).getNetworkElementConnections().getUnmounted().intValue());
DeleteNetworkElementConnectionInput delete1 =
new DeleteNetworkElementConnectionInputBuilder().setId(NODEID1).build();
@@ -595,7 +628,7 @@ public class TestMariaDataProvider {
data = dbProvider.readNetworkElementConnectionList(createInput("node-id", NODEID1, 1, 20));
assertEquals(0, data.getData().size());
data = dbProvider.readNetworkElementConnectionList(createInput(1, 20));
- assertEquals(2, data.getData().size());
+ assertEquals(3, data.getData().size());
}
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 7dd2464f9..30c68a01d 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
@@ -225,6 +225,20 @@ public class TestQuerySyntax {
}
@Test
+ public void testSelectForFilterValues6() {
+ EntityInput input = new ReadGuiCutThroughEntryInputBuilder()
+ .setFilter(YangToolsMapperHelper.toMap(Arrays.asList(
+ new FilterBuilder().setProperty("id").setFiltervalue("*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();
diff --git a/sdnr/wt/data-provider/dblib/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/dblib/test/util/MariaDBTestBase.java b/sdnr/wt/data-provider/dblib/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/dblib/test/util/MariaDBTestBase.java
index aebd3328e..3123d25a6 100644
--- a/sdnr/wt/data-provider/dblib/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/dblib/test/util/MariaDBTestBase.java
+++ b/sdnr/wt/data-provider/dblib/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/dblib/test/util/MariaDBTestBase.java
@@ -57,6 +57,7 @@ import ch.vorburger.mariadb4j.DBConfigurationBuilder;
public class MariaDBTestBase {
private final SqlDBDataProvider dbProvider;
+ private final SqlDBDataProvider dbProviderOverall;
private final DB db;
private SqlDBConfig config;
private static final Map<String, String> envDefaultValues = initEnvDefaultValues();
@@ -96,6 +97,11 @@ public class MariaDBTestBase {
this.config.setControllerId("test123");
this.db = null;
this.dbProvider = new SqlDBDataProvider(config, false);
+
+ SqlDBConfig config2 = new SqlDBConfig(new ConfigurationFileRepresentation("test2.properties"));
+ config2.setDbSuffix("");
+ config2.setControllerId(null);
+ this.dbProviderOverall = new SqlDBDataProvider(config2, false);
}
public MariaDBTestBase(int port) throws ManagedProcessException {
@@ -111,6 +117,10 @@ public class MariaDBTestBase {
this.db = startDatabase(port);
//create db with name sdnrdb
this.dbProvider = new SqlDBDataProvider(config, false);
+ SqlDBConfig config2 = new SqlDBConfig(new ConfigurationFileRepresentation("test2.properties"));
+ config2.setDbSuffix("");
+ config2.setControllerId(null);
+ this.dbProviderOverall = new SqlDBDataProvider(config2, false);
}
public void close() throws ManagedProcessException {
@@ -126,6 +136,9 @@ public class MariaDBTestBase {
public SqlDBDataProvider getDbProvider() {
return dbProvider;
}
+ public SqlDBDataProvider getOverallDbProvider() {
+ return dbProviderOverall;
+ }
public DB getDb() {
return db;