summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRama-Huawei <rama.subba.reddy.s@huawei.com>2019-04-24 15:55:57 +0530
committerRama-Huawei <rama.subba.reddy.s@huawei.com>2019-04-24 15:57:55 +0530
commit63b3725490d9505154a2c44e30e0c02414a0fc02 (patch)
treec585bc57fe4482d6626673d0254b71cb34f0e9de
parentc82dafde6b3f02cccba0822a340cb9d7bed35a1c (diff)
Unit test code for datalake seed code
Increased the code coverage to 100% for domain controller module Issue-ID: DCAEGEN2-1309 Change-Id: Ie0d737323928c6350e8d41ada2eb3880975a93bc Signed-off-by: Rama-Huawei <rama.subba.reddy.s@huawei.com>
-rw-r--r--components/datalake-handler/feeder/src/test/java/org/onap/datalake/feeder/controller/domain/DbConfigTest.java47
-rw-r--r--components/datalake-handler/feeder/src/test/java/org/onap/datalake/feeder/controller/domain/PostReturnBodyTest.java38
2 files changed, 85 insertions, 0 deletions
diff --git a/components/datalake-handler/feeder/src/test/java/org/onap/datalake/feeder/controller/domain/DbConfigTest.java b/components/datalake-handler/feeder/src/test/java/org/onap/datalake/feeder/controller/domain/DbConfigTest.java
new file mode 100644
index 00000000..2c53def4
--- /dev/null
+++ b/components/datalake-handler/feeder/src/test/java/org/onap/datalake/feeder/controller/domain/DbConfigTest.java
@@ -0,0 +1,47 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : DATALAKE
+ * ================================================================================
+ * Copyright (C) 2018-2019 Huawei. All rights reserved.
+ * ================================================================================
+ * 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=========================================================
+ */
+
+package org.onap.datalake.feeder.controller.domain;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public class DbConfigTest {
+ @Test
+ public void testDbConfig() {
+ DbConfig dbConfig = new DbConfig();
+ dbConfig.setName("elasticsearch");
+ assertTrue("elasticsearch".equals(dbConfig.getName()));
+ dbConfig.setHost("localhost");
+ assertTrue("localhost".equals(dbConfig.getHost()));
+ dbConfig.setLogin("root");
+ assertTrue("root".equals(dbConfig.getLogin()));
+ dbConfig.setPassword("root123");
+ assertTrue("root123".equals(dbConfig.getPassword()));
+ dbConfig.setDatabase("elasticsearch");
+ assertTrue("elasticsearch".equals(dbConfig.getDatabase()));
+ dbConfig.setPort(123);
+ assertEquals(123, dbConfig.getPort());
+ dbConfig.setPoperties("driver");
+ assertTrue("driver".equals(dbConfig.getPoperties()));
+ }
+}
diff --git a/components/datalake-handler/feeder/src/test/java/org/onap/datalake/feeder/controller/domain/PostReturnBodyTest.java b/components/datalake-handler/feeder/src/test/java/org/onap/datalake/feeder/controller/domain/PostReturnBodyTest.java
new file mode 100644
index 00000000..f9c251dc
--- /dev/null
+++ b/components/datalake-handler/feeder/src/test/java/org/onap/datalake/feeder/controller/domain/PostReturnBodyTest.java
@@ -0,0 +1,38 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : DATALAKE
+ * ================================================================================
+ * Copyright (C) 2018-2019 Huawei. All rights reserved.
+ * ================================================================================
+ * 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=========================================================
+ */
+
+package org.onap.datalake.feeder.controller.domain;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public class PostReturnBodyTest {
+
+ @Test
+ public void testPostReturnBody() {
+ PostReturnBody postReturnBody = new PostReturnBody();
+ postReturnBody.setStatusCode(200);
+ assertEquals(200, postReturnBody.getStatusCode());
+ postReturnBody.setReturnBody("abc");
+ assertTrue("abc".equals(postReturnBody.getReturnBody()));
+ }
+}