summaryrefslogtreecommitdiffstats
path: root/ms/controllerblueprints/application/src/test/java
diff options
context:
space:
mode:
authorJessica Wagantall <jwagantall@linuxfoundation.org>2019-03-22 11:09:33 -0700
committerJessica Wagantall <jwagantall@linuxfoundation.org>2019-03-22 11:09:51 -0700
commitffb6bdfd6de2afa23d95d0884c9db4059982deed (patch)
treec528a1106245ee1b4ad77cd7586d6452d6e34d40 /ms/controllerblueprints/application/src/test/java
parent1a47dc3ce480c4735cbf019918372a0e1ff367bc (diff)
parent1d32aa56013891203fafb2f32d2dc5b9ada0a384 (diff)
Migrate "ms/controllerblueprints" from ccsdk/apps
Migrate code from ccsdk/apps ms/controllerblueprints subfolder into ccsdk/cds Issue-ID: CIMAN-245 Signed-off-by: Jessica Wagantall <jwagantall@linuxfoundation.org>
Diffstat (limited to 'ms/controllerblueprints/application/src/test/java')
-rw-r--r--ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBlueprintsApplicationTest.java62
-rw-r--r--ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/VersionSplitTest.java49
2 files changed, 111 insertions, 0 deletions
diff --git a/ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBlueprintsApplicationTest.java b/ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBlueprintsApplicationTest.java
new file mode 100644
index 000000000..cf9b3e71f
--- /dev/null
+++ b/ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBlueprintsApplicationTest.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright © 2017-2018 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.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
+import org.springframework.boot.test.web.client.TestRestTemplate;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.MediaType;
+import org.springframework.http.client.support.BasicAuthorizationInterceptor;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
+public class ControllerBlueprintsApplicationTest {
+ @Autowired
+ private TestRestTemplate restTemplate;
+
+ @Before
+ public void setUp(){
+ BasicAuthorizationInterceptor bai = new BasicAuthorizationInterceptor("ccsdkapps", "ccsdkapps");
+ this.restTemplate.getRestTemplate().getInterceptors().add(bai);
+ }
+
+ @Test
+ public void testConfigModel() {
+ HttpHeaders headers = new HttpHeaders();
+ headers.set("Accept", MediaType.APPLICATION_JSON_VALUE);
+// ResponseEntity<BlueprintModel> entity = this.restTemplate
+// .exchange("/api/v1/config-model/1", HttpMethod.GET, new HttpEntity<>(headers),BlueprintModel.class);
+// assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
+// Assert.assertNotNull("failed to get response Config model",entity.getBody());
+ }
+
+ @Test
+ public void testConfigModelFailure() {
+ HttpHeaders headers = new HttpHeaders();
+ headers.set("Accept", MediaType.APPLICATION_JSON_VALUE);
+// ResponseEntity<BlueprintModel> entity = this.restTemplate
+// .exchange("/api/v1/config-model-not-found/1", HttpMethod.GET, new HttpEntity<>(headers),BlueprintModel.class);
+// assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.NOT_FOUND);
+// Assert.assertNotNull("failed to get response Config model",entity.getBody());
+ }
+}
diff --git a/ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/VersionSplitTest.java b/ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/VersionSplitTest.java
new file mode 100644
index 000000000..995644fd0
--- /dev/null
+++ b/ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/VersionSplitTest.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright © 2017-2018 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.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import org.apache.commons.lang3.StringUtils;
+import org.junit.Assert;
+import org.junit.Test;
+import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
+
+/**
+ * VersionSplitTest
+ *
+ * @author Brinda Santh
+ */
+public class VersionSplitTest {
+ private static EELFLogger log = EELFManager.getInstance().getLogger(VersionSplitTest.class);
+
+ @Test
+ public void testVersionSplit() {
+ String version = "1.03.04";
+ String[] tokens = StringUtils.split(version, '.');
+ Assert.assertNotNull("failed to tokenize", tokens);
+ Assert.assertEquals("failed to three token ", 3, tokens.length);
+ }
+
+ @Test
+ public void encodeTest() {
+ String name = "ccsdkapps";
+ BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();
+ String encodedValue = bCryptPasswordEncoder.encode(name);
+ Assert.assertTrue("Failed to match", bCryptPasswordEncoder.matches(name, encodedValue));
+ }
+} \ No newline at end of file