summaryrefslogtreecommitdiffstats
path: root/datarouter-prov/src/test/java
diff options
context:
space:
mode:
authorEmmettCox <emmett.cox@est.tech>2019-03-22 16:02:47 +0000
committerEmmettCox <emmett.cox@est.tech>2019-03-22 16:02:47 +0000
commit08728973159e813c10212db23d4e5fb63b44db8a (patch)
tree97629e610433925aff0ccd61ad08fd926d028482 /datarouter-prov/src/test/java
parent2e737e6c37a579065d4e56ab470fd54b1ba1d64f (diff)
fix issue in LogRecord unit tests
Change-Id: Ie3786b4a6aa56177e7157a4c1b595ecdbbc4fc71 Issue-ID: DMAAP-1104 Signed-off-by: EmmettCox <emmett.cox@est.tech>
Diffstat (limited to 'datarouter-prov/src/test/java')
-rw-r--r--datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/beans/LogRecordTest.java59
1 files changed, 27 insertions, 32 deletions
diff --git a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/beans/LogRecordTest.java b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/beans/LogRecordTest.java
index 0c7b7e51..bd0ebdcb 100644
--- a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/beans/LogRecordTest.java
+++ b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/beans/LogRecordTest.java
@@ -1,25 +1,22 @@
-/*******************************************************************************
- * ============LICENSE_START==================================================
- * * org.onap.dmaap
- * * ===========================================================================
- * * Copyright © 2019 Nordix Foundation.
- * * ===========================================================================
- * * Licensed under the Apache License, Version 2.0 (the "License");
- * * you may not use this file except in compliance with the License.
- * * You may obtain a copy of the License at
- * *
- * * http://www.apache.org/licenses/LICENSE-2.0
- * *
- * * Unless required by applicable law or agreed to in writing, software
- * * distributed under the License is distributed on an "AS IS" BASIS,
- * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * * See the License for the specific language governing permissions and
- * * limitations under the License.
- * * ============LICENSE_END====================================================
- * *
- * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * *
- ******************************************************************************/
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
package org.onap.dmaap.datarouter.provisioning.beans;
@@ -66,36 +63,33 @@ public class LogRecordTest {
@Before
public void setUp() throws ParseException, SQLException {
db = new DB();
- String[] args = {"2018-08-29-10-10-10-543.", "LOG","ID","1","URL/file123","PUT","application/vnd.dmaap-.log-list; version=1.0","100","pub", "1","172.0.0.8","user", "204","1","1","204","0","other","1","100","file123"};
Connection conn = db.getConnection();
ps = conn.prepareStatement(INSERT_SQL);
- logRecord = new LogRecord(args);
}
@Test
- public void Validate_Load_For_Pub_Type_Sets_Correct_Values() throws SQLException {
- logRecord.load(ps);
- Assert.assertEquals(ps.toString().substring(128), "3: 'ID', 4: 1, 5: 'URL/file123', 6: 'PUT', 7: 'application/vnd.dmaap-.log-list; version=1.0', 8: 100, 9: '1', 10: '172.0.0.8', 11: 'user', 12: 204, 13: NULL, 14: NULL, 15: NULL, 16: NULL, 17: NULL, 18: 1, 19: NULL, 20: 'file123'}");
+ public void Validate_Load_For_Pub_Type_Sets_Correct_Values() throws SQLException, ParseException {
+ setArgsLoadAndAssertEquals("pub", "{1: 'pub', 3: 'ID', 4: 1, 5: 'URL/file123', 6: 'PUT', 7: 'application/vnd.dmaap-.log-list; version=1.0', 8: 100, 9: '1', 10: '172.0.0.8', 11: 'user', 12: 204, 13: NULL, 14: NULL, 15: NULL, 16: NULL, 17: NULL, 18: 1, 19: NULL, 20: 'file123'}");
}
@Test
public void Validate_Load_For_Del_Type_Sets_Correct_Values() throws SQLException, ParseException {
- setArgsLoadAndAssertEquals("del", "3: 'ID', 4: 1, 5: 'URL/file123', 6: 'PUT', 7: 'application/vnd.dmaap-.log-list; version=1.0', 8: 100, 9: NULL, 10: NULL, 11: 'user', 12: NULL, 13: 1, 14: '1', 15: 204, 16: NULL, 17: NULL, 18: 1, 19: NULL, 20: 'file123'}");
+ setArgsLoadAndAssertEquals("del", "{1: 'del', 3: 'ID', 4: 1, 5: 'URL/file123', 6: 'PUT', 7: 'application/vnd.dmaap-.log-list; version=1.0', 8: 100, 9: NULL, 10: NULL, 11: 'user', 12: NULL, 13: 1, 14: '1', 15: 204, 16: NULL, 17: NULL, 18: 1, 19: NULL, 20: 'file123'}");
}
@Test
public void Validate_Load_For_Exp_Type_Sets_Correct_Values() throws SQLException, ParseException {
- setArgsLoadAndAssertEquals("exp", "3: 'ID', 4: 1, 5: 'URL/file123', 6: 'PUT', 7: 'application/vnd.dmaap-.log-list; version=1.0', 8: 100, 9: NULL, 10: NULL, 11: NULL, 12: NULL, 13: 1, 14: '1', 15: NULL, 16: 0, 17: 'other', 18: 1, 19: NULL, 20: 'file123'}");
+ setArgsLoadAndAssertEquals("exp", "{1: 'exp', 3: 'ID', 4: 1, 5: 'URL/file123', 6: 'PUT', 7: 'application/vnd.dmaap-.log-list; version=1.0', 8: 100, 9: NULL, 10: NULL, 11: NULL, 12: NULL, 13: 1, 14: '1', 15: NULL, 16: 0, 17: 'other', 18: 1, 19: NULL, 20: 'file123'}");
}
@Test
public void Validate_Load_For_Pbf_Type_Sets_Correct_Values() throws SQLException, ParseException {
- setArgsLoadAndAssertEquals("pbf", "3: 'ID', 4: 1, 5: 'URL/file123', 6: 'PUT', 7: 'application/vnd.dmaap-.log-list; version=1.0', 8: 100, 9: '1', 10: '172.0.0.8', 11: 'user', 12: NULL, 13: NULL, 14: NULL, 15: NULL, 16: NULL, 17: NULL, 18: 1, 19: 100, 20: 'file123'}");
+ setArgsLoadAndAssertEquals("pbf", "{1: 'pbf', 3: 'ID', 4: 1, 5: 'URL/file123', 6: 'PUT', 7: 'application/vnd.dmaap-.log-list; version=1.0', 8: 100, 9: '1', 10: '172.0.0.8', 11: 'user', 12: NULL, 13: NULL, 14: NULL, 15: NULL, 16: NULL, 17: NULL, 18: 1, 19: 100, 20: 'file123'}");
}
@Test
public void Validate_Load_For_Dlx_Type_Sets_Correct_Values() throws SQLException, ParseException {
- setArgsLoadAndAssertEquals("dlx", "3: 'ID', 4: 1, 5: 'URL/file123', 6: 'PUT', 7: 'application/vnd.dmaap-.log-list; version=1.0', 8: 100, 9: NULL, 10: NULL, 11: NULL, 12: NULL, 13: 1, 14: NULL, 15: NULL, 16: NULL, 17: NULL, 18: 1, 19: 100, 20: 'file123'}");
+ setArgsLoadAndAssertEquals("dlx", "{1: 'dlx', 3: 'ID', 4: 1, 5: 'URL/file123', 6: 'PUT', 7: 'application/vnd.dmaap-.log-list; version=1.0', 8: 100, 9: NULL, 10: NULL, 11: NULL, 12: NULL, 13: 1, 14: NULL, 15: NULL, 16: NULL, 17: NULL, 18: 1, 19: 100, 20: 'file123'}");
}
@Test
@@ -111,6 +105,7 @@ public class LogRecordTest {
String[] args = {"2018-08-29-10-10-10-543.", "LOG", "ID", "1", "URL/file123", "PUT", "application/vnd.dmaap-.log-list; version=1.0", "100", type, "1", "172.0.0.8", "user", "204", "1", "1", "204", "0", "other", "1", "100", "file123"};
logRecord = new LogRecord(args);
logRecord.load(ps);
- Assert.assertEquals(ps.toString().substring(128), s);
+ String compare_string = ps.toString().substring(ps.toString().indexOf("{1:"), ps.toString().indexOf("2:")) + ps.toString().substring(ps.toString().indexOf("3:"));
+ Assert.assertEquals(compare_string, s);
}
}