diff options
4 files changed, 590 insertions, 67 deletions
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy index 933d45066a..1beb31254f 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy @@ -47,7 +47,7 @@ import org.openecomp.mso.rest.APIResponse; * This groovy class supports the <class>CreateSDNCCNetworkResource.bpmn</class> process.
* flow for SDNC Network Resource Create
*/
-public class CreateSDNCCNetworkResource extends AbstractServiceTaskProcessor {
+public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
String Prefix="CRESDNCRES_"
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtilTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtilTest.java new file mode 100644 index 0000000000..b861a79feb --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtilTest.java @@ -0,0 +1,34 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 AT&T Intellectual Property. 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.bpmn.infrastructure.workflow.serviceTask.client; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +public class HeaderUtilTest { + + @Test + public void getAuthorizationTest() throws Exception { + String authorization = HeaderUtil.getAuthorization(HeaderUtil.USER, HeaderUtil.PASS); + assertEquals("Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==", authorization); + } + +}
\ No newline at end of file diff --git a/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/APIResponseTest.java b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/APIResponseTest.java new file mode 100644 index 0000000000..166a2ff52f --- /dev/null +++ b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/APIResponseTest.java @@ -0,0 +1,57 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SO +* ================================================================================ +* Copyright (C) 2018 AT&T Intellectual Property. 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.rest; + +import static org.junit.Assert.assertEquals; + +import org.json.JSONObject; +import org.junit.Test; + +import org.apache.http.HttpResponse; +import org.apache.http.ProtocolVersion; +import org.apache.http.HttpEntity; +import org.apache.http.entity.ContentType; +import org.apache.http.entity.StringEntity; +import org.apache.http.message.BasicHttpResponse; + +public class APIResponseTest { + + @Test + public void test() throws Exception { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("firstName", "firstName1"); + jsonObject.put("lastName", "lastName1"); + String jsonObjectAsString= jsonObject.toString(); + HttpEntity entity = new StringEntity(jsonObjectAsString, ContentType.APPLICATION_JSON); + ProtocolVersion ver = new ProtocolVersion("HTTP", 1, 1); + HttpResponse response = new BasicHttpResponse(ver, 1, "Ok"); + response.setStatusLine(ver, 200); + response.setEntity(entity); + response.setHeader("name", "value"); + response.setStatusCode(200); + APIResponse apiResponse = new APIResponse(response); + assertEquals(200, apiResponse.getStatusCode()); + assertEquals(jsonObject.toString(), apiResponse.getResponseBodyAsString()); + assertEquals("value", apiResponse.getFirstHeader("name")); + assertEquals(1, apiResponse.getAllHeaders().length); + assertEquals(49, apiResponse.getResponseBodyAsByteArray().length); + } +}
\ No newline at end of file diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/CatalogDatabaseTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/CatalogDatabaseTest.java index 58ce80cacd..42ffda7509 100644 --- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/CatalogDatabaseTest.java +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/CatalogDatabaseTest.java @@ -1378,8 +1378,110 @@ public class CatalogDatabaseTest { } @Test - public void getVnfComponentTestException() throws Exception{ - thrown.expect(Exception.class); + public void getVnfComponentNullTest() throws Exception{ + mockUpQuery = new MockUp<Query>() { + @Mock + public Object uniqueResult() { + return null; + } + }; + + mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + mockCd = new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + + VnfComponent ht = cd.getVnfComponent(123,"vnf"); + assertNull(ht); + } + + @Test + public void getVnfComponentNonUniqueTest() throws Exception{ + mockUpQuery = new MockUp<Query>() { + @Mock + public Object uniqueResult() { + throw new org.hibernate.NonUniqueResultException(2); + } + }; + + mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + mockCd = new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + + thrown.expect(org.hibernate.NonUniqueResultException.class); + VnfComponent ht = cd.getVnfComponent(123,"vnf"); + } + + @Test + public void getVnfComponentHibernateExceptionTest() throws Exception{ + mockUpQuery = new MockUp<Query>() { + @Mock + public Object uniqueResult() { + throw new org.hibernate.HibernateException("test case"); + } + }; + + mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + mockCd = new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + + thrown.expect(org.hibernate.HibernateException.class); + VnfComponent ht = cd.getVnfComponent(123,"vnf"); + } + + @Test + public void getVnfComponentExceptionTest() throws Exception{ + mockUpQuery = new MockUp<Query>() { + @Mock + public Object uniqueResult() { + throw new NullPointerException(); + } + }; + + mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + mockCd = new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + + thrown.expect(NullPointerException.class); VnfComponent ht = cd.getVnfComponent(123,"vnf"); } @@ -1407,7 +1509,7 @@ public class CatalogDatabaseTest { return mockedSession.getMockInstance(); } }; - VnfResource vnfResource = cd.getVnfResource("vnf"); + VnfResource vnfResource = cd.getVnfResourceByType("vnf"); assertEquals("123-uuid", vnfResource.getModelUuid()); @@ -1435,7 +1537,7 @@ public class CatalogDatabaseTest { return mockedSession.getMockInstance(); } }; - VnfResource vnfResource = cd.getVnfResource("vnf"); + VnfResource vnfResource = cd.getVnfResourceByType("vnf"); assertEquals(null, vnfResource); @@ -1592,6 +1694,33 @@ public class CatalogDatabaseTest { } @Test + public void getVnfResourceByModelCustomizationIdNullTest() { + mockUpQuery = new MockUp<Query>() { + @Mock + public Object uniqueResult() throws Exception { + return null; + } + }; + + mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + mockCd = new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + + VnfResource vnfResource = cd.getVnfResourceByModelCustomizationId("3992"); + assertNull(vnfResource); + } + + @Test public void getVnfResourceByModelCustomizationIdNURExceptionTest() { mockUpQuery = new MockUp<Query>() { @@ -1645,8 +1774,33 @@ public class CatalogDatabaseTest { }; thrown.expect(HibernateException.class); VnfResource vnfResource = cd.getVnfResourceByModelCustomizationId("3992"); + } + @Test + public void getVnfResourceByModelCustomizationIdExceptionTest() { + mockUpQuery = new MockUp<Query>() { + + @Mock + public Object uniqueResult() throws Exception { + throw new NullPointerException(); + } + }; + mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + mockCd = new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + thrown.expect(NullPointerException.class); + VnfResource vnfResource = cd.getVnfResourceByModelCustomizationId("3992"); } @@ -1867,8 +2021,42 @@ public class CatalogDatabaseTest { @Test public void getVnfResourceByIdTestException(){ - thrown.expect(Exception.class); + mockUpQuery = new MockUp<Query>() { + int id = 0; + @Mock + public Query setParameter(String name, Object val) { + id = (Integer)val; + return this.getMockInstance(); + } + + @Mock + public List<VnfResource> list() throws Exception { + if (id==0) return new ArrayList<VnfResource>(); + VnfResource vm = new VnfResource(); + vm.setModelInvariantUuid(Integer.toString(id)); + return Arrays.asList(vm); + } + }; + + mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + mockCd = new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + VnfResource vnf = cd.getVnfResourceById(19299); + assertEquals("19299", vnf.getModelInvariantUuid()); + + vnf = cd.getVnfResourceById(0); + assertNull(vnf); } @Test @@ -1932,9 +2120,19 @@ public class CatalogDatabaseTest { @Test public void getVfModuleModelNameTest() { mockUpQuery = new MockUp<Query>() { + String modelVersion = null; + + @Mock + public Query setParameter(String name, Object val) { + if (name.equals("model_version")) modelVersion = (String)val; + return this.getMockInstance(); + } @Mock public Object uniqueResult() { + if (modelVersion==null || modelVersion.equals("nil")) { + return null; + } VfModule vfModule = new VfModule(); vfModule.setModelUUID("123-uuid"); return vfModule; @@ -1958,7 +2156,8 @@ public class CatalogDatabaseTest { VfModule vfModule = cd.getVfModuleModelName("tetes","4kidsl"); assertEquals("123-uuid", vfModule.getModelUUID()); - + vfModule = cd.getVfModuleModelName("tetes","nil"); + assertNull(vfModule); } @Test @@ -2346,16 +2545,46 @@ public class CatalogDatabaseTest { @Test public void getVfModuleTypeTestException(){ - thrown.expect(Exception.class); + mockUpQuery = new MockUp<Query>() { + String type = null; + @Mock + public Query setParameter(String name, Object val) { + type = (String)val; + return this.getMockInstance(); + } + + @Mock + public List<VfModule> list() { + if ("nil".equals(type)) return new ArrayList<VfModule>(); + + VfModule vm = new VfModule(); + vm.setModelUUID("123-uuid"); + return Arrays.asList(vm); + } + }; + + mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + mockCd = new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + VfModule vnf = cd.getVfModuleType("4993493"); + assertEquals("123-uuid", vnf.getModelUUID()); + + vnf = cd.getVfModuleType("nil"); + assertNull(vnf); } @Test - public void getVfModuleType2TestException(){ - thrown.expect(Exception.class); - VfModule vnf = cd.getVfModuleType("4993493","vnf"); - } - @Test public void getVnfResourceByServiceUuidTest(){ mockUpQuery = new MockUp<Query>() { @@ -2794,17 +3023,24 @@ public class CatalogDatabaseTest { } @Test - public void getVfModuleByModelInvariantUuidAndModelVersionTestException(){ - thrown.expect(Exception.class); - VfModule vnf = cd.getVfModuleByModelInvariantUuidAndModelVersion("4993493","vnf"); - } - - @Test public void getVfModuleCustomizationByModelCustomizationIdTest(){ mockUpQuery = new MockUp<Query>() { + String modelCustomizationUuid = null; + + @Mock + public Query setParameter(String name, Object val) { + if (name.equals("modelCustomizationUuid")) modelCustomizationUuid = (String)val; + return this.getMockInstance(); + } + @Mock public Object uniqueResult() { - VfModuleCustomization vm = new VfModuleCustomization(); + if ("nil".equals(modelCustomizationUuid)) return null; + if ("multi".equals(modelCustomizationUuid)) throw new org.hibernate.NonUniqueResultException(2); + if ("he".equals(modelCustomizationUuid)) throw new org.hibernate.HibernateException("test case"); + if ("npe".equals(modelCustomizationUuid)) throw new NullPointerException(); + + VfModuleCustomization vm = new VfModuleCustomization(); vm.setModelCustomizationUuid("4993493"); return vm; } @@ -2826,12 +3062,104 @@ public class CatalogDatabaseTest { VfModuleCustomization vnf = cd.getVfModuleCustomizationByModelCustomizationId("4993493"); assertEquals("4993493", vnf.getModelCustomizationUuid()); + + vnf = cd.getVfModuleCustomizationByModelCustomizationId("nil"); + assertNull(vnf); + + + try { + thrown = ExpectedException.none(); + thrown.expect(org.hibernate.NonUniqueResultException.class); + vnf = cd.getVfModuleCustomizationByModelCustomizationId("multi"); + } catch (org.hibernate.NonUniqueResultException e) { + // noop + } + + try { + thrown = ExpectedException.none(); + thrown.expect(org.hibernate.HibernateException.class); + vnf = cd.getVfModuleCustomizationByModelCustomizationId("he"); + } catch (org.hibernate.HibernateException e) { + // noop + } + + try { + thrown = ExpectedException.none(); + thrown.expect(NullPointerException.class); + vnf = cd.getVfModuleCustomizationByModelCustomizationId("npe"); + } catch (NullPointerException e) { + // noop + } + } @Test public void getVfModuleByModelUuidTestException(){ - thrown.expect(Exception.class); - VfModule vnf = cd.getVfModuleByModelUuid("4993493"); + mockUpQuery = new MockUp<Query>() { + String modelUuidValue = null; + + @Mock + public Query setParameter(String name, Object val) { + if (name.equals("modelUuidValue")) modelUuidValue = (String)val; + return this.getMockInstance(); + } + + @Mock + public List<VfModule> list() { + if ("nil".equals(modelUuidValue)) return null; + if ("multi".equals(modelUuidValue)) throw new org.hibernate.NonUniqueResultException(2); + if ("he".equals(modelUuidValue)) throw new org.hibernate.HibernateException("test case"); + if ("npe".equals(modelUuidValue)) throw new NullPointerException(); + + VfModule vfModule = new VfModule(); + vfModule.setModelInvariantUuid(modelUuidValue); + return Arrays.asList(vfModule); + } + }; + + mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + mockCd = new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + + VfModule vnf = cd.getVfModuleByModelUuid("4993493"); + assertEquals("4993493", vnf.getModelInvariantUuid()); + + vnf = cd.getVfModuleByModelUuid("nil"); + assertNull(vnf); + + try { + thrown = ExpectedException.none(); + thrown.expect(org.hibernate.NonUniqueResultException.class); + vnf = cd.getVfModuleByModelUuid("multi"); + } catch (org.hibernate.NonUniqueResultException e) { + // noop + } + + try { + thrown = ExpectedException.none(); + thrown.expect(org.hibernate.HibernateException.class); + vnf = cd.getVfModuleByModelUuid("he"); + } catch (org.hibernate.HibernateException e) { + // noop + } + + try { + thrown = ExpectedException.none(); + thrown.expect(NullPointerException.class); + vnf = cd.getVfModuleByModelUuid("npe"); + } catch (NullPointerException e) { + // noop + } } @Test public void getVnfResourceCustomizationByModelCustomizationUuidTestException(){ @@ -4463,10 +4791,20 @@ public class CatalogDatabaseTest { @Test public void getVnfRecipeByNameVersion(){ mockUpQuery = new MockUp<Query>() { + String version = null; + + @Mock + public Query setParameter(String name, Object val) { + if (name.equals("version")) version = (String)val; + return this.getMockInstance(); + } @Mock public List<VnfRecipe> list() { + if ("nil".equals(version)) return new ArrayList<VnfRecipe>(); + VnfRecipe vnfRecipe = new VnfRecipe(); + vnfRecipe.setVersion(version); return Arrays.asList(vnfRecipe); } }; @@ -4484,8 +4822,14 @@ public class CatalogDatabaseTest { return mockedSession.getMockInstance(); } }; - assertNotNull(cd.getVnfRecipeByNameVersion("modelName","modelVersion","action")); + + VnfRecipe vf = cd.getVnfRecipeByNameVersion("modelName","modelVersion","action"); + assertEquals("modelVersion", vf.getVersion()); + + vf = cd.getVnfRecipeByNameVersion("modelName","nil","action"); + assertNull(vf); } + @Test public void getVnfRecipeByModuleUuid(){ mockUpQuery = new MockUp<Query>() { @@ -4512,58 +4856,146 @@ public class CatalogDatabaseTest { }; assertNull(cd.getVnfRecipeByModuleUuid("vnfModelUuid","action")); } + @Test public void getVfModuleType(){ - mockUpQuery = new MockUp<Query>() { - - @Mock - public List<VnfRecipe> list() { - VnfRecipe vnfRecipe = new VnfRecipe(); - return Arrays.asList(vnfRecipe); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; + mockUpQuery = new MockUp<Query>() { + String version = null; + + @Mock + public Query setParameter(String name, Object val) { + if (name.equals("version")) version = (String)val; + return this.getMockInstance(); + } + + @Mock + public Object uniqueResult() { + if ("nil".equals(version)) return null; + if ("multi".equals(version)) throw new org.hibernate.NonUniqueResultException(2); + if ("he".equals(version)) throw new org.hibernate.HibernateException("test case"); + if ("npe".equals(version)) throw new NullPointerException(); + + VfModule vfModule = new VfModule(); + vfModule.setVersion(version); + return vfModule; + } + }; + + mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + mockCd = new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + + VfModule vm = cd.getVfModuleType("type","version"); + assertEquals("version", vm.getVersion()); + + vm = cd.getVfModuleType("type", "nil"); + assertNull(vm); + + try { + thrown = ExpectedException.none(); + thrown.expect(org.hibernate.NonUniqueResultException.class); + vm = cd.getVfModuleType("type", "multi"); + } catch (org.hibernate.NonUniqueResultException e) { + // noop + } + + try { + thrown = ExpectedException.none(); + thrown.expect(org.hibernate.HibernateException.class); + vm = cd.getVfModuleType("type", "he"); + } catch (org.hibernate.HibernateException e) { + // noop + } + + try { + thrown = ExpectedException.none(); + thrown.expect(NullPointerException.class); + vm = cd.getVfModuleType("type", "npe"); + } catch (NullPointerException e) { + // noop + } - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - assertNull(cd.getVfModuleType("type","version")); } @Test public void getVfModuleByModelInvariantUuidAndModelVersion(){ - mockUpQuery = new MockUp<Query>() { - - @Mock - public List<VnfRecipe> list() { - VnfRecipe vnfRecipe = new VnfRecipe(); - return Arrays.asList(vnfRecipe); - } - }; - - mockedSession = new MockUp<Session>() { - @Mock - public Query createQuery(String hql) { - return mockUpQuery.getMockInstance(); - } - }; + mockUpQuery = new MockUp<Query>() { + String version = null; + + @Mock + public Query setParameter(String name, Object val) { + if (name.equals("modelVersion")) version = (String)val; + return this.getMockInstance(); + } + + @Mock + public Object uniqueResult() { + if ("nil".equals(version)) return null; + if ("multi".equals(version)) throw new org.hibernate.NonUniqueResultException(2); + if ("he".equals(version)) throw new org.hibernate.HibernateException("test case"); + if ("npe".equals(version)) throw new NullPointerException(); + + VfModule vfModule = new VfModule(); + vfModule.setVersion(version); + return vfModule; + } + }; + + mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + mockCd = new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + + VfModule vm = cd.getVfModuleByModelInvariantUuidAndModelVersion("modelInvariantUuid","modelVersion"); + assertEquals("modelVersion", vm.getVersion()); + + vm = cd.getVfModuleByModelInvariantUuidAndModelVersion("modelInvariantUuid","nil"); + assertNull(vm); + + try { + thrown = ExpectedException.none(); + thrown.expect(org.hibernate.NonUniqueResultException.class); + vm = cd.getVfModuleByModelInvariantUuidAndModelVersion("modelInvariantUuid","multi"); + } catch (org.hibernate.NonUniqueResultException e) { + // noop + } + + try { + thrown = ExpectedException.none(); + thrown.expect(org.hibernate.HibernateException.class); + vm = cd.getVfModuleByModelInvariantUuidAndModelVersion("modelInvariantUuid","he"); + } catch (org.hibernate.HibernateException e) { + // noop + } + + try { + thrown = ExpectedException.none(); + thrown.expect(NullPointerException.class); + vm = cd.getVfModuleByModelInvariantUuidAndModelVersion("modelInvariantUuid","npe"); + } catch (NullPointerException e) { + // noop + } - mockCd = new MockUp<CatalogDatabase>() { - @Mock - private Session getSession() { - return mockedSession.getMockInstance(); - } - }; - assertNull(cd.getVfModuleByModelInvariantUuidAndModelVersion("modelInvariantUuid","modelVersion")); } + @Test public void getVnfResourceCustomizationByModelCustomizationUuid(){ mockUpQuery = new MockUp<Query>() { |