diff options
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/java/org/onap/music/datastore/PreparedQueryObjectTest.java | 75 | ||||
-rw-r--r-- | src/test/java/org/onap/music/unittests/authentication/AuthorizationErrorTest.java (renamed from src/test/java/org/onap/music/unittests/jsonobjects/NameSpaceTest.java) | 39 | ||||
-rw-r--r-- | src/test/java/org/onap/music/unittests/jsonobjects/AAFResponseTest.java | 54 | ||||
-rw-r--r-- | src/test/java/org/onap/music/unittests/jsonobjects/JsonInsertTest.java | 14 | ||||
-rw-r--r-- | src/test/java/org/onap/music/unittests/jsonobjects/JsonOnboardTest.java | 88 |
5 files changed, 103 insertions, 167 deletions
diff --git a/src/test/java/org/onap/music/datastore/PreparedQueryObjectTest.java b/src/test/java/org/onap/music/datastore/PreparedQueryObjectTest.java new file mode 100644 index 00000000..71e484a7 --- /dev/null +++ b/src/test/java/org/onap/music/datastore/PreparedQueryObjectTest.java @@ -0,0 +1,75 @@ +/* + * ============LICENSE_START========================================== + * org.onap.music + * =================================================================== + * Copyright (c) 2019 IBM. + * =================================================================== + * 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 + * e + * 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.music.datastore; + +import static org.junit.Assert.assertEquals; + +import org.junit.Before; +import org.junit.Test; + +public class PreparedQueryObjectTest { + + private PreparedQueryObject preparedQueryObject; + + @Before + public void setUp() + { + preparedQueryObject = new PreparedQueryObject(); + } + + @Test + public void testKeyspaceName() + { + preparedQueryObject.setKeyspaceName("keyspaceName"); + assertEquals("keyspaceName", preparedQueryObject.getKeyspaceName()); + } + + @Test + public void testConsistency() + { + preparedQueryObject.setConsistency("consistency"); + assertEquals("consistency", preparedQueryObject.getConsistency()); + } + + @Test + public void testTableName() + { + preparedQueryObject.setTableName("tableName"); + assertEquals("tableName", preparedQueryObject.getTableName()); + } + + @Test + public void testoperation() + { + preparedQueryObject.setOperation("operation"); + assertEquals("operation", preparedQueryObject.getOperation()); + } + + @Test + public void testprimaryKeyValue() + { + preparedQueryObject.setPrimaryKeyValue("primaryKeyValue"); + assertEquals("primaryKeyValue", preparedQueryObject.getPrimaryKeyValue()); + } + +} diff --git a/src/test/java/org/onap/music/unittests/jsonobjects/NameSpaceTest.java b/src/test/java/org/onap/music/unittests/authentication/AuthorizationErrorTest.java index ee4d3933..b432072a 100644 --- a/src/test/java/org/onap/music/unittests/jsonobjects/NameSpaceTest.java +++ b/src/test/java/org/onap/music/unittests/authentication/AuthorizationErrorTest.java @@ -2,55 +2,50 @@ * ============LICENSE_START========================================== * org.onap.music * =================================================================== - * Copyright (c) 2018 IBM. + * Copyright (c) 2019 IBM. * =================================================================== * 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.music.unittests.jsonobjects; +package org.onap.music.unittests.authentication; + +import static org.junit.Assert.assertEquals; -import org.junit.Assert; import org.junit.Before; import org.junit.Test; +import org.onap.music.authentication.AuthorizationError; -import org.onap.music.datastore.jsonobjects.NameSpace; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; +public class AuthorizationErrorTest { -public class NameSpaceTest { - private NameSpace nameSpace; + private AuthorizationError authorizationError; @Before public void setUp() { - nameSpace = new NameSpace(); + authorizationError = new AuthorizationError(); } @Test - public void testGetSetAdmin() { - List<String> list = new ArrayList<String>(); - list.add("admin"); - nameSpace.setAdmin(list); - Assert.assertEquals(list, nameSpace.getAdmin()); + public void testResponseCode() { + authorizationError.setResponseCode(400); + assertEquals(400, authorizationError.getResponseCode()); } @Test - public void testGetSetName() { - nameSpace.setName("name"); - Assert.assertEquals("name", nameSpace.getName()); + public void testResponseMessage() { + authorizationError.setResponseMessage("ResponseMessage"); + assertEquals("ResponseMessage", authorizationError.getResponseMessage()); } } diff --git a/src/test/java/org/onap/music/unittests/jsonobjects/AAFResponseTest.java b/src/test/java/org/onap/music/unittests/jsonobjects/AAFResponseTest.java deleted file mode 100644 index 354668c7..00000000 --- a/src/test/java/org/onap/music/unittests/jsonobjects/AAFResponseTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * ============LICENSE_START========================================== - * org.onap.music - * =================================================================== - * Copyright (c) 2017 AT&T Intellectual Property - * =================================================================== - * 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.music.unittests.jsonobjects; - -import static org.junit.Assert.*; -import java.util.ArrayList; -import org.junit.Test; -import org.onap.music.datastore.jsonobjects.AAFResponse; -import org.onap.music.datastore.jsonobjects.NameSpace; - -public class AAFResponseTest { - - @Test - public void testGetNs() { - NameSpace ns = new NameSpace(); - AAFResponse ar = new AAFResponse(); - ArrayList<NameSpace> nsArray = new ArrayList<>(); - ns.setName("tom"); - ArrayList<String> admin = new ArrayList<>(); - admin.add("admin1"); - ns.setAdmin(admin); - nsArray.add(ns); - ar.setNs(nsArray); - assertEquals("tom",ar.getNs().get(0).getName()); - assertEquals("admin1",ar.getNs().get(0).getAdmin().get(0)); - - } - -// @Test -// public void testSetNs() { -// fail("Not yet implemented"); -// } - -} diff --git a/src/test/java/org/onap/music/unittests/jsonobjects/JsonInsertTest.java b/src/test/java/org/onap/music/unittests/jsonobjects/JsonInsertTest.java index 535cdd84..4992af7b 100644 --- a/src/test/java/org/onap/music/unittests/jsonobjects/JsonInsertTest.java +++ b/src/test/java/org/onap/music/unittests/jsonobjects/JsonInsertTest.java @@ -4,6 +4,8 @@ * =================================================================== * Copyright (c) 2017 AT&T Intellectual Property * =================================================================== + * Modifications Copyright (c) 2019 IBM. + * =================================================================== * 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 @@ -22,9 +24,9 @@ package org.onap.music.unittests.jsonobjects; -import static org.junit.Assert.*; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; -import java.io.Serializable; import java.util.HashMap; import java.util.Map; @@ -98,6 +100,12 @@ public class JsonInsertTest { assertArrayEquals(ji1,test1); } - + @Test + public void testObjectMap() + { + Map<String, byte[]> map = new HashMap<>(); + ji.setObjectMap(map); + assertEquals(map, ji.getObjectMap()); + } } diff --git a/src/test/java/org/onap/music/unittests/jsonobjects/JsonOnboardTest.java b/src/test/java/org/onap/music/unittests/jsonobjects/JsonOnboardTest.java deleted file mode 100644 index f7a1576a..00000000 --- a/src/test/java/org/onap/music/unittests/jsonobjects/JsonOnboardTest.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * ============LICENSE_START========================================== - * org.onap.music - * =================================================================== - * Copyright (c) 2017 AT&T Intellectual Property - * =================================================================== - * Modifications Copyright (c) 2019 IBM. - * =================================================================== - * 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.music.unittests.jsonobjects; - -import static org.junit.Assert.*; -import org.junit.Before; -import org.junit.Test; -import org.onap.music.datastore.jsonobjects.JsonOnboard; - -public class JsonOnboardTest { - - JsonOnboard jo = null; - - @Before - public void init() { - jo = new JsonOnboard(); - } - - - @Test - public void testGetPassword() { - String password = "password"; - jo.setPassword(password); - assertEquals(password,jo.getPassword()); - } - - @Test - public void testGetAid() { - String aid = "aid"; - jo.setAid(aid); - assertEquals(aid,jo.getAid()); - - } - - @Test - public void testGetAppname() { - String appName = "appName"; - jo.setAppname(appName); - assertEquals(appName,jo.getAppname()); - - } - - @Test - public void testGetUserId() { - String userId = "userId"; - jo.setUserId(userId); - assertEquals(userId,jo.getUserId()); - - } - - @Test - public void testGetIsAAF() { - String aaf = "true"; - jo.setIsAAF(aaf); - assertEquals(aaf,jo.getIsAAF()); - - } - - @Test - public void testKeyspace() { - jo.setKeyspace_name("Keyspace"); - assertEquals("Keyspace",jo.getKeyspace()); - - } - -} |