diff options
author | seshukm <seshu.kumar.m@huawei.com> | 2017-10-04 13:47:44 +0530 |
---|---|---|
committer | Seshu Kumar M <seshu.kumar.m@huawei.com> | 2017-10-04 11:13:41 +0000 |
commit | fb137ed56a5dcc9ce15ad70c9f8971f3ac78a81b (patch) | |
tree | 55dd89a5d32de3c10dab3932f71b7c4b47a2e3f5 /mso-catalog-db/src | |
parent | 33ef19f5f07ae792d3294e87732c718af926be81 (diff) |
Adding UT for MsoCatalog POJO
UT-Step3
IssueId: SO-172
Change-Id: Iac580a8936104078e529db9fdab178e0686eae51
Signed-off-by: seshukm <seshu.kumar.m@huawei.com>
Diffstat (limited to 'mso-catalog-db/src')
3 files changed, 168 insertions, 0 deletions
diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/RecipeTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/RecipeTest.java new file mode 100644 index 0000000000..49dc9b7079 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/RecipeTest.java @@ -0,0 +1,55 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.openecomp.mso.db.catalog.test; + +import static org.junit.Assert.assertTrue; + +import java.sql.Timestamp; + +import org.junit.Test; +import org.openecomp.mso.db.catalog.beans.Recipe; + +/** + */ + +public class RecipeTest { + + @Test + public final void recipeDataTest() { + Recipe recipe = new Recipe(); + recipe.setAction("action"); + assertTrue(recipe.getAction().equalsIgnoreCase("action")); + recipe.setCreated(new Timestamp(System.currentTimeMillis())); + assertTrue(recipe.getCreated() != null); + recipe.setDescription("description"); + assertTrue(recipe.getDescription().equalsIgnoreCase("description")); + recipe.setId(1); + assertTrue(recipe.getId() == 1); + recipe.setOrchestrationUri("orchestrationUri"); + assertTrue(recipe.getOrchestrationUri().equalsIgnoreCase("orchestrationUri")); + recipe.setRecipeTimeout(1); + assertTrue(recipe.getRecipeTimeout() == 1); + recipe.setServiceType("serviceType"); + assertTrue(recipe.getServiceType().equalsIgnoreCase("serviceType")); +// assertTrue(recipe.toString() != null); + } + +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceMacroHolderTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceMacroHolderTest.java new file mode 100644 index 0000000000..0e3492170e --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceMacroHolderTest.java @@ -0,0 +1,48 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.openecomp.mso.db.catalog.test; + +import static org.junit.Assert.assertTrue; + +import org.junit.Test; +import org.openecomp.mso.db.catalog.beans.AllottedResourceCustomization; +import org.openecomp.mso.db.catalog.beans.NetworkResourceCustomization; +import org.openecomp.mso.db.catalog.beans.ServiceMacroHolder; +import org.openecomp.mso.db.catalog.beans.VnfResource; +import org.openecomp.mso.db.catalog.beans.VnfResourceCustomization; + +/** + */ + +public class ServiceMacroHolderTest { + + @Test + public final void serviceMacroHolderDataTest() { + ServiceMacroHolder serviceMacroHolder = new ServiceMacroHolder(); + assertTrue(serviceMacroHolder.getService() == null); + serviceMacroHolder.addVnfResource(new VnfResource()); + serviceMacroHolder.addVnfResourceCustomizations(new VnfResourceCustomization()); + serviceMacroHolder.addNetworkResourceCustomization(new NetworkResourceCustomization()); + serviceMacroHolder.addAllottedResourceCustomization(new AllottedResourceCustomization()); + assertTrue(serviceMacroHolder != null); + } + +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceRecipeTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceRecipeTest.java new file mode 100644 index 0000000000..4b4a5adf4a --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceRecipeTest.java @@ -0,0 +1,65 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.openecomp.mso.db.catalog.test; + +import static org.junit.Assert.assertTrue; + +import java.sql.Timestamp; +import java.util.Date; + +import org.junit.Test; +import org.openecomp.mso.db.catalog.beans.ServiceRecipe; + +/** + */ + +public class ServiceRecipeTest { + + @Test + public final void serviceRecipeDataTest() { + + ServiceRecipe serviceRecipe = new ServiceRecipe(); + serviceRecipe.setAction("action"); + assertTrue(serviceRecipe.getAction().equalsIgnoreCase("action")); + serviceRecipe.setCreated(new Timestamp(System.currentTimeMillis())); + assertTrue(serviceRecipe.getCreated() != null); + serviceRecipe.setDescription("description"); + assertTrue(serviceRecipe.getDescription().equalsIgnoreCase("description")); + serviceRecipe.setId(1); + assertTrue(serviceRecipe.getId() == 1); + serviceRecipe.setOrchestrationUri("orchestrationUri"); + assertTrue(serviceRecipe.getOrchestrationUri().equalsIgnoreCase("orchestrationUri")); + serviceRecipe.setRecipeTimeout(1); + assertTrue(serviceRecipe.getRecipeTimeout() == 1); + serviceRecipe.setVersion("version"); + assertTrue(serviceRecipe.getVersion().equalsIgnoreCase("version")); + serviceRecipe.setServiceTimeoutInterim(1); + assertTrue(serviceRecipe.getServiceTimeoutInterim() == 1); + serviceRecipe.setServiceParamXSD("serviceParamXSD"); + assertTrue(serviceRecipe.getServiceParamXSD().equalsIgnoreCase("serviceParamXSD")); + assertTrue(serviceRecipe.toString() != null); + ServiceRecipe serviceRecipeWithValue = new ServiceRecipe(1, "string", "string", "string", "string", "string", 1, + 1, new Date()); + assertTrue(serviceRecipeWithValue.toString() != null); + + } + +} |