From 1cb7623802f69bdf23dd285d67bd662f94d9f2d3 Mon Sep 17 00:00:00 2001 From: surya-huawei Date: Thu, 28 Sep 2017 17:59:53 +0530 Subject: Add a unit test for mdsal *Add a negative unit test case for ConfigResource This is to check availability of query and improve sonar code coverage Issue-Id: CCSDK-106 Change-Id: Ic276d1cfacce3aea7444adcb7bf09d6cdffb294e Signed-off-by: surya-huawei --- .../resource/mdsal/ConfigResourceTest.java | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 mdsal-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/ConfigResourceTest.java (limited to 'mdsal-resource') diff --git a/mdsal-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/ConfigResourceTest.java b/mdsal-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/ConfigResourceTest.java new file mode 100644 index 000000000..f5b0bcf0c --- /dev/null +++ b/mdsal-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/ConfigResourceTest.java @@ -0,0 +1,43 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 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.onap.ccsdk.sli.adaptors.resource.mdsal; + +import org.junit.Test; +import org.onap.ccsdk.sli.core.sli.SvcLogicContext; +import org.onap.ccsdk.sli.core.sli.SvcLogicException; +import org.onap.ccsdk.sli.core.sli.SvcLogicResource.QueryStatus; + +import static org.junit.Assert.assertEquals; + +public class ConfigResourceTest { + ConfigResource configResource = new ConfigResource("http", "local", + "10001", "admin", + "password"); + + @Test + public void isAvailableNegativeTest() throws SvcLogicException { + SvcLogicContext ctx = new SvcLogicContext(); + assertEquals(QueryStatus.NOT_FOUND, configResource.isAvailable + ("xyz", "key", "prefix", ctx)); + } +} + -- cgit 1.2.3-korg