diff options
author | Yan Yang <yangyanyj@chinamobile.com> | 2019-06-11 19:09:34 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-06-11 19:09:34 +0000 |
commit | a27334bb03617bc2306aae895095b8336b6294ff (patch) | |
tree | b0222fe6fbf95620f53daee80813f2ee303feea7 | |
parent | c94846da72a38200fdf90956fe86f46f0156b174 (diff) | |
parent | 8ecf4157c3a740a89bfea06647e825e7b1a48d2b (diff) |
Merge "Unit test 1"
5 files changed, 254 insertions, 0 deletions
diff --git a/components/datalake-handler/feeder/src/test/java/org/onap/datalake/feeder/domain/DesignTypeTest.java b/components/datalake-handler/feeder/src/test/java/org/onap/datalake/feeder/domain/DesignTypeTest.java new file mode 100644 index 00000000..5f3b5993 --- /dev/null +++ b/components/datalake-handler/feeder/src/test/java/org/onap/datalake/feeder/domain/DesignTypeTest.java @@ -0,0 +1,43 @@ +/* + * ============LICENSE_START======================================================= + * ONAP : DATALAKE + * ================================================================================ + * Copyright 2019 China Mobile + *================================================================================= + * 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.domain; + +import org.junit.Test; + +import static org.junit.Assert.*; + +public class DesignTypeTest { + + @Test + public void testIs(){ + + DesignType designType = new DesignType(); + designType.setName("Kibana Dashboard"); + designType.setNote("test"); + Portal portal = new Portal(); + portal.setName("Kibana"); + designType.setPortal(portal); + assertTrue("Kibana Dashboard".equals(designType.getName())); + assertTrue("test".equals(designType.getNote())); + assertFalse("Kibana".equals(designType.getPortal())); + } + +}
\ No newline at end of file diff --git a/components/datalake-handler/feeder/src/test/java/org/onap/datalake/feeder/domain/PortalDesignTest.java b/components/datalake-handler/feeder/src/test/java/org/onap/datalake/feeder/domain/PortalDesignTest.java new file mode 100644 index 00000000..1f6d7619 --- /dev/null +++ b/components/datalake-handler/feeder/src/test/java/org/onap/datalake/feeder/domain/PortalDesignTest.java @@ -0,0 +1,52 @@ +/* + * ============LICENSE_START======================================================= + * ONAP : DATALAKE + * ================================================================================ + * Copyright 2019 China Mobile + *================================================================================= + * 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.domain; + +import org.junit.Test; + +import static org.junit.Assert.*; + +public class PortalDesignTest { + + @Test + public void testIs() { + + PortalDesign portalDesign = new PortalDesign(); + portalDesign.setId(1); + portalDesign.setSubmitted(false); + portalDesign.setBody("jsonString"); + portalDesign.setName("templateTest"); + Topic topic = new Topic("_DL_DEFAULT_"); + portalDesign.setTopic(topic); + DesignType designType = new DesignType(); + designType.setName("Kibana"); + portalDesign.setDesignType(designType); + portalDesign.setNote("test"); + assertFalse("1".equals(portalDesign.getId())); + assertTrue("templateTest".equals(portalDesign.getName())); + assertTrue("jsonString".equals(portalDesign.getBody())); + assertFalse("_DL_DEFAULT_".equals(portalDesign.getTopic())); + assertTrue("test".equals(portalDesign.getNote())); + assertFalse("Kibana".equals(portalDesign.getDesignType())); + assertFalse("false".equals(portalDesign.getSubmitted())); + } + +}
\ No newline at end of file diff --git a/components/datalake-handler/feeder/src/test/java/org/onap/datalake/feeder/domain/PortalTest.java b/components/datalake-handler/feeder/src/test/java/org/onap/datalake/feeder/domain/PortalTest.java new file mode 100644 index 00000000..8d52145c --- /dev/null +++ b/components/datalake-handler/feeder/src/test/java/org/onap/datalake/feeder/domain/PortalTest.java @@ -0,0 +1,49 @@ +/* + * ============LICENSE_START======================================================= + * ONAP : DATALAKE + * ================================================================================ + * Copyright 2019 China Mobile + *================================================================================= + * 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.domain; + +import org.junit.Test; + +import static org.junit.Assert.*; +import static org.junit.Assert.assertTrue; + +public class PortalTest { + + @Test + public void testIs() { + + Portal portal = new Portal(); + portal.setName("Kibana"); + portal.setEnabled(true); + portal.setHost("localhost"); + portal.setPort(5601); + portal.setLogin("admin"); + portal.setPass("password"); + portal.setDb(new Db("Elasticsearch")); + assertTrue("Kibana".equals(portal.getName())); + assertFalse("true".equals(portal.getEnabled())); + assertTrue("localhost".equals(portal.getHost())); + assertFalse("5601".equals(portal.getPort())); + assertTrue("admin".equals(portal.getLogin())); + assertTrue("password".equals(portal.getPass())); + assertFalse("Elasticsearch".equals(portal.getDb())); + } +}
\ No newline at end of file diff --git a/components/datalake-handler/feeder/src/test/java/org/onap/datalake/feeder/dto/PortalConfigTest.java b/components/datalake-handler/feeder/src/test/java/org/onap/datalake/feeder/dto/PortalConfigTest.java new file mode 100644 index 00000000..f13894c9 --- /dev/null +++ b/components/datalake-handler/feeder/src/test/java/org/onap/datalake/feeder/dto/PortalConfigTest.java @@ -0,0 +1,50 @@ +/* + * ============LICENSE_START======================================================= + * ONAP : DATALAKE + * ================================================================================ + * Copyright 2019 China Mobile + *================================================================================= + * 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.dto; + +import org.junit.Test; +import org.onap.datalake.feeder.domain.Db; +import org.onap.datalake.feeder.domain.Portal; + +import static org.junit.Assert.*; + +public class PortalConfigTest { + + @Test + public void testIs(){ + + Portal testPortal = new Portal(); + testPortal.setName("Kibana"); + testPortal.setDb(new Db("Elasticsearch")); + Portal testPortal2 = new Portal(); + testPortal2.setName("Kibana"); + testPortal2.setDb(new Db("Elasticsearch")); + PortalConfig testPortalConfig = testPortal.getPortalConfig(); + assertNotEquals(testPortalConfig, testPortal2.getPortalConfig()); + assertNotEquals(testPortalConfig, testPortal); + assertNotEquals(testPortalConfig, null); + assertEquals(testPortalConfig.getHost(), null); + assertEquals(testPortalConfig.getPort(), null); + assertEquals(testPortalConfig.getEnabled(), null); + assertEquals(testPortalConfig.getLogin(), null); + assertEquals(testPortalConfig.getPass(), null); + } +}
\ No newline at end of file diff --git a/components/datalake-handler/feeder/src/test/java/org/onap/datalake/feeder/dto/PortalDesignConfigTest.java b/components/datalake-handler/feeder/src/test/java/org/onap/datalake/feeder/dto/PortalDesignConfigTest.java new file mode 100644 index 00000000..d20dcb0a --- /dev/null +++ b/components/datalake-handler/feeder/src/test/java/org/onap/datalake/feeder/dto/PortalDesignConfigTest.java @@ -0,0 +1,60 @@ +/* + * ============LICENSE_START======================================================= + * ONAP : DATALAKE + * ================================================================================ + * Copyright 2019 China Mobile + *================================================================================= + * 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.dto; + +import org.junit.Test; +import org.onap.datalake.feeder.domain.DesignType; +import org.onap.datalake.feeder.domain.PortalDesign; +import org.onap.datalake.feeder.domain.Topic; + +import static org.junit.Assert.*; + +public class PortalDesignConfigTest { + + @Test + public void testIs() { + + PortalDesign testPortaldesign = new PortalDesign(); + testPortaldesign.setId(1); + testPortaldesign.setTopic(new Topic("test")); + DesignType testDesignType = new DesignType(); + testDesignType.setName("test"); + testPortaldesign.setDesignType(testDesignType); + + PortalDesign testPortaldesign2 = new PortalDesign(); + testPortaldesign2.setId(1); + testPortaldesign2.setTopic(new Topic("test")); + DesignType testDesignType2 = new DesignType(); + testDesignType2.setName("test"); + testPortaldesign2.setDesignType(testDesignType2); + + PortalDesignConfig testPortalDesignConfig = testPortaldesign.getPortalDesignConfig(); + + assertNotEquals(testPortalDesignConfig, testPortaldesign2.getPortalDesignConfig()); + assertNotEquals(testPortalDesignConfig, null); + assertNotEquals(testPortalDesignConfig.getId(), null); + assertEquals(testPortalDesignConfig.getBody(), null); + assertEquals(testPortalDesignConfig.getNote(), null); + assertEquals(testPortalDesignConfig.getName(), null); + assertEquals(testPortalDesignConfig.getSubmitted(), null); + } + +}
\ No newline at end of file |