diff options
Diffstat (limited to 'src/test/java/com/att/nsa/cambria/metabroker')
7 files changed, 0 insertions, 604 deletions
diff --git a/src/test/java/com/att/nsa/cambria/metabroker/BrokerImpl.java b/src/test/java/com/att/nsa/cambria/metabroker/BrokerImpl.java deleted file mode 100644 index 9c5e4e0..0000000 --- a/src/test/java/com/att/nsa/cambria/metabroker/BrokerImpl.java +++ /dev/null @@ -1,71 +0,0 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * 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 com.att.nsa.cambria.metabroker;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.att.dmf.mr.CambriaApiException;
-import com.att.dmf.mr.metabroker.Broker;
-import com.att.dmf.mr.metabroker.Topic;
-import com.att.nsa.configs.ConfigDbException;
-import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException;
-
-public class BrokerImpl implements Broker {
-
- @Override
- public List<Topic> getAllTopics() throws ConfigDbException {
- // TODO Auto-generated method stub
- Topic top = new TopicImplem();
-
- List<Topic> list = new ArrayList<Topic>();
-
- for (int i = 0; i < 5; i++) {
- top = new TopicImplem();
- list.add(top);
-
- }
-
- return null;
-
- }
-
- @Override
- public Topic getTopic(String topic) throws ConfigDbException {
- // TODO Auto-generated method stub
- return new TopicImplem();
- }
-
- @Override
- public Topic createTopic(String topic, String description, String ownerApiKey, int partitions, int replicas,
- boolean transactionEnabled) throws TopicExistsException, CambriaApiException {
- // TODO Auto-generated method stub
- return new TopicImplem(topic, description, ownerApiKey, transactionEnabled);
- }
-
- @Override
- public void deleteTopic(String topic) throws AccessDeniedException, CambriaApiException, TopicExistsException {
- // TODO Auto-generated method stub
- Topic top = new TopicImplem();
-
- }
-
-}
diff --git a/src/test/java/com/att/nsa/cambria/metabroker/BrokerImplTest.java b/src/test/java/com/att/nsa/cambria/metabroker/BrokerImplTest.java deleted file mode 100644 index edc5641..0000000 --- a/src/test/java/com/att/nsa/cambria/metabroker/BrokerImplTest.java +++ /dev/null @@ -1,109 +0,0 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * 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 com.att.nsa.cambria.metabroker;
-
-import static org.junit.Assert.*;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.att.dmf.mr.CambriaApiException;
-import com.att.dmf.mr.metabroker.Broker.TopicExistsException;
-import com.att.nsa.configs.ConfigDbException;
-import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException;
-
-public class BrokerImplTest {
-
- @Before
- public void setUp() throws Exception {
- }
-
- @After
- public void tearDown() throws Exception {
- }
-
- @Test
- public void testGetOwners() {
-
- try {
- new BrokerImpl().getAllTopics();
- } catch (ConfigDbException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- assertTrue(true);
- }
-
- @Test
- public void testGetTopic() {
-
- try {
- new BrokerImpl().getTopic("topicName");
- } catch (ConfigDbException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- assertTrue(true);
-
- }
-
- @Test
- public void testCreateTopic() {
-
- try {
- new BrokerImpl().createTopic("topicName", "testing topic", "owner123", 3, 3, true);
-
- } catch (CambriaApiException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (TopicExistsException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- assertTrue(true);
-
- }
-
- @Test
- public void testDeleteTopic() {
-
- try {
- new BrokerImpl().deleteTopic("topicName");
- } catch (CambriaApiException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (AccessDeniedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (TopicExistsException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- assertTrue(true);
-
- }
-}
diff --git a/src/test/java/com/att/nsa/cambria/metabroker/JUnitTestSuite.java b/src/test/java/com/att/nsa/cambria/metabroker/JUnitTestSuite.java deleted file mode 100644 index 0e2535b..0000000 --- a/src/test/java/com/att/nsa/cambria/metabroker/JUnitTestSuite.java +++ /dev/null @@ -1,42 +0,0 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * 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 com.att.nsa.cambria.metabroker;
-
-import junit.framework.TestSuite;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.junit.runners.Suite.SuiteClasses;
-import org.apache.log4j.Logger;
-
-@RunWith(Suite.class)
-@SuiteClasses({ BrokerImplTest.class, TopicImplemTest.class, })
-public class JUnitTestSuite {
- private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class);
-
- public static void main(String[] args) {
- LOGGER.info("Running the test suite");
-
- TestSuite tstSuite = new TestSuite();
- LOGGER.info("Total Test Counts " + tstSuite.countTestCases());
- }
-
-}
diff --git a/src/test/java/com/att/nsa/cambria/metabroker/TestRunner.java b/src/test/java/com/att/nsa/cambria/metabroker/TestRunner.java deleted file mode 100644 index e96d9c2..0000000 --- a/src/test/java/com/att/nsa/cambria/metabroker/TestRunner.java +++ /dev/null @@ -1,41 +0,0 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * 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 com.att.nsa.cambria.metabroker;
-
-import org.junit.runner.JUnitCore;
-import org.junit.runner.Result;
-import org.junit.runner.notification.Failure;
-import org.apache.log4j.Logger;
-
-public class TestRunner {
- private static final Logger LOGGER = Logger.getLogger(TestRunner.class);
-
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- Result result = JUnitCore.runClasses(JUnitTestSuite.class);
- for (Failure failure : result.getFailures()) {
- LOGGER.info(failure.toString());
-
- }
- LOGGER.info(result.wasSuccessful());
- }
-
-}
diff --git a/src/test/java/com/att/nsa/cambria/metabroker/TopicImplTest.java b/src/test/java/com/att/nsa/cambria/metabroker/TopicImplTest.java deleted file mode 100644 index 67cf60d..0000000 --- a/src/test/java/com/att/nsa/cambria/metabroker/TopicImplTest.java +++ /dev/null @@ -1,25 +0,0 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * 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 com.att.nsa.cambria.metabroker;
-
-public class TopicImplTest {
-
-}
diff --git a/src/test/java/com/att/nsa/cambria/metabroker/TopicImplem.java b/src/test/java/com/att/nsa/cambria/metabroker/TopicImplem.java deleted file mode 100644 index 9539073..0000000 --- a/src/test/java/com/att/nsa/cambria/metabroker/TopicImplem.java +++ /dev/null @@ -1,140 +0,0 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * 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 com.att.nsa.cambria.metabroker;
-
-import java.util.Set;
-
-import com.att.dmf.mr.metabroker.Topic;
-import com.att.nsa.configs.ConfigDbException;
-import com.att.nsa.security.NsaAcl;
-import com.att.nsa.security.NsaApiKey;
-
-public class TopicImplem implements Topic {
- private String name, owner, description;
- boolean isTransactionEnabled;
- private Set<String> set = null;
- private NsaAcl readerAcl, writerAcl;
-
- public TopicImplem() {
- name = getName();
- owner = getOwner();
- description = getDescription();
- isTransactionEnabled = true;
- readerAcl = getReaderAcl();
- writerAcl = getWriterAcl();
- }
-
- public TopicImplem(String topic, String description, String ownerApiKey, boolean transactionEnabled) {
-
- this.name = topic;
- this.owner = ownerApiKey;
- this.description = description;
- isTransactionEnabled = transactionEnabled;
-
-
- }
- @Override
- public Set<String> getOwners() {
- // TODO Auto-generated method stub
- for (int i = 0; i < 5; i++) {
- set.add("string" + (i + 1));
- }
- return set;
- }
-
- @Override
- public String getName() {
- // TODO Auto-generated method stub
- return "testTopic";
- }
-
- @Override
- public String getOwner() {
- // TODO Auto-generated method stub
- return "owner";
- }
-
- @Override
- public String getDescription() {
- // TODO Auto-generated method stub
- return "topic for testing purposes";
- }
-
- @Override
- public boolean isTransactionEnabled() {
- // TODO Auto-generated method stub
- return true;
- }
-
- @Override
- public NsaAcl getReaderAcl() {
- // TODO Auto-generated method stub
- return new NsaAcl();
- }
-
- @Override
- public NsaAcl getWriterAcl() {
- // TODO Auto-generated method stub
- return new NsaAcl();
- }
-
- @Override
- public void checkUserRead(NsaApiKey user) throws AccessDeniedException {
- // TODO Auto-generated method stub
- NsaApiKey u = user;
- }
-
- @Override
- public void checkUserWrite(NsaApiKey user) throws AccessDeniedException {
- // TODO Auto-generated method stub
-
- NsaApiKey u = user;
- }
-
- @Override
- public void permitWritesFromUser(String publisherId, NsaApiKey asUser)
- throws AccessDeniedException, ConfigDbException {
- // TODO Auto-generated method stub
- String id = publisherId;
-
- }
-
- @Override
- public void denyWritesFromUser(String publisherId, NsaApiKey asUser)
- throws AccessDeniedException, ConfigDbException {
- // TODO Auto-generated method stub
- String id = publisherId;
-
- }
-
- @Override
- public void permitReadsByUser(String consumerId, NsaApiKey asUser) throws AccessDeniedException, ConfigDbException {
- // TODO Auto-generated method stub
- String id = consumerId;
- }
-
- @Override
- public void denyReadsByUser(String consumerId, NsaApiKey asUser) throws AccessDeniedException, ConfigDbException {
- // TODO Auto-generated method stub
- String id = consumerId;
- }
-
-}
diff --git a/src/test/java/com/att/nsa/cambria/metabroker/TopicImplemTest.java b/src/test/java/com/att/nsa/cambria/metabroker/TopicImplemTest.java deleted file mode 100644 index c3ef097..0000000 --- a/src/test/java/com/att/nsa/cambria/metabroker/TopicImplemTest.java +++ /dev/null @@ -1,176 +0,0 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * 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 com.att.nsa.cambria.metabroker;
-
-import static org.junit.Assert.*;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.att.nsa.configs.ConfigDbException;
-import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException;
-
-public class TopicImplemTest {
-
- @Before
- public void setUp() throws Exception {
- }
-
- @After
- public void tearDown() throws Exception {
- }
-
-
- @Test
- public void testGetOwners() {
-
- assertNotNull(new TopicImplem().getOwner());
-
- }
-
- @Test
- public void testGetName() {
-
- assertNotNull(new TopicImplem().getName());
-
- }
-
- @Test
- public void testGetOwner() {
-
- assertNotNull(new TopicImplem().getOwner());
-
- }
-
- @Test
- public void testGetDescription() {
-
- assertNotNull(new TopicImplem().getDescription());
-
- }
-
- @Test
- public void testIsTransactionEnabled() {
-
- assertTrue(new TopicImplem().isTransactionEnabled());
-
- }
-
- @Test
- public void testGetReaderAcl() {
- new TopicImplem().getReaderAcl();
- assertTrue(true);
-
- }
-
- @Test
- public void testGetWriterAcl() {
- new TopicImplem().getReaderAcl();
- assertTrue(true);
-
- }
-
-
- @Test
- public void testCheckUserRead() {
- try {
- new TopicImplem().checkUserRead(null);
- } catch (AccessDeniedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- assertTrue(true);
-
- }
-
- @Test
- public void testCheckUserWrite() {
- try {
- new TopicImplem().checkUserWrite(null);
- } catch (AccessDeniedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- assertTrue(true);
-
- }
-
- @Test
- public void testPermitWritesFromUser() {
- try {
- new TopicImplem().permitWritesFromUser("publisherId", null);
- } catch (AccessDeniedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (ConfigDbException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- assertTrue(true);
-
- }
-
- @Test
- public void testDenyWritesFromUser() {
- try {
- new TopicImplem().denyWritesFromUser("publisherId", null);
- } catch (AccessDeniedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (ConfigDbException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- assertTrue(true);
-
- }
-
- @Test
- public void testPermitReadsByUser() {
- try {
- new TopicImplem().permitReadsByUser("consumerId", null);
- } catch (AccessDeniedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (ConfigDbException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- assertTrue(true);
-
- }
-
- @Test
- public void testDenyReadsByUser() {
- try {
- new TopicImplem().denyReadsByUser("consumerId", null);
- } catch (AccessDeniedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (ConfigDbException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- assertTrue(true);
-
- }
-}
|