summaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorSébastien Determe <sd378r@intl.att.com>2018-05-23 15:52:30 +0000
committerGerrit Code Review <gerrit@onap.org>2018-05-23 15:52:30 +0000
commit2206cf470405b527b5d666cf657f011eac6e0b80 (patch)
tree6a8d2391edcc5092b5047151d540da4a43edfae7 /src/test
parent090d9eadb13e5833bd179ede05d9b158e524ae54 (diff)
parent2aad6d681dcbea5564425648375f7ddca2080940 (diff)
Merge "Generate API documents"
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/onap/clamp/clds/it/SdcReqItCase.java3
-rw-r--r--src/test/java/org/onap/clamp/clds/it/sdc/controller/installer/CsarInstallerItCase.java3
-rw-r--r--src/test/java/org/onap/clamp/clds/swagger/SwaggerConfig.java46
-rw-r--r--src/test/java/org/onap/clamp/clds/swagger/SwaggerGenerationTest.java42
4 files changed, 92 insertions, 2 deletions
diff --git a/src/test/java/org/onap/clamp/clds/it/SdcReqItCase.java b/src/test/java/org/onap/clamp/clds/it/SdcReqItCase.java
index f0db5129..36cbc590 100644
--- a/src/test/java/org/onap/clamp/clds/it/SdcReqItCase.java
+++ b/src/test/java/org/onap/clamp/clds/it/SdcReqItCase.java
@@ -32,6 +32,7 @@ import java.security.GeneralSecurityException;
import java.util.List;
import org.apache.commons.codec.DecoderException;
+import org.json.JSONException;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -87,7 +88,7 @@ public class SdcReqItCase {
}
@Test
- public void formatSdcReqTest() {
+ public void formatSdcReqTest() throws JSONException {
String jsonResult = sdcReq.formatSdcReq("payload", "artifactName", "artifactLabel", "artifactType");
JSONAssert.assertEquals(
"{\"payloadData\" : \"cGF5bG9hZA==\",\"artifactLabel\" : \"artifactLabel\",\"artifactName\" :\"artifactName\",\"artifactType\" : \"artifactType\","
diff --git a/src/test/java/org/onap/clamp/clds/it/sdc/controller/installer/CsarInstallerItCase.java b/src/test/java/org/onap/clamp/clds/it/sdc/controller/installer/CsarInstallerItCase.java
index 222f757e..56d29d52 100644
--- a/src/test/java/org/onap/clamp/clds/it/sdc/controller/installer/CsarInstallerItCase.java
+++ b/src/test/java/org/onap/clamp/clds/it/sdc/controller/installer/CsarInstallerItCase.java
@@ -38,6 +38,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.json.JSONException;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
@@ -149,7 +150,7 @@ public class CsarInstallerItCase {
@Test
public void testInstallTheCsarTca()
- throws SdcArtifactInstallerException, SdcToscaParserException, CsarHandlerException, IOException {
+ throws SdcArtifactInstallerException, SdcToscaParserException, CsarHandlerException, IOException, JSONException {
String generatedName = RandomStringUtils.randomAlphanumeric(5);
CsarHandler csar = buildFakeCsarHandler(generatedName);
csarInstaller.installTheCsar(csar);
diff --git a/src/test/java/org/onap/clamp/clds/swagger/SwaggerConfig.java b/src/test/java/org/onap/clamp/clds/swagger/SwaggerConfig.java
new file mode 100644
index 00000000..87409644
--- /dev/null
+++ b/src/test/java/org/onap/clamp/clds/swagger/SwaggerConfig.java
@@ -0,0 +1,46 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * 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.onap.clamp.clds.swagger;
+
+import org.springframework.context.annotation.Configuration;
+import springfox.documentation.builders.ApiInfoBuilder;
+import springfox.documentation.service.*;
+import springfox.documentation.spi.DocumentationType;
+import springfox.documentation.swagger2.annotations.EnableSwagger2;
+
+
+
+
+@EnableSwagger2
+@Configuration
+public class SwaggerConfig {
+
+ private ApiInfo apiInfo() {
+ return new ApiInfoBuilder()
+ .title("Clamp")
+ .description("Clamp API Description")
+ .license("Apache 2.0")
+ .licenseUrl("http://www.apache.org/licenses/LICENSE-2.0")
+ .build();
+ }
+}
diff --git a/src/test/java/org/onap/clamp/clds/swagger/SwaggerGenerationTest.java b/src/test/java/org/onap/clamp/clds/swagger/SwaggerGenerationTest.java
new file mode 100644
index 00000000..a4691b16
--- /dev/null
+++ b/src/test/java/org/onap/clamp/clds/swagger/SwaggerGenerationTest.java
@@ -0,0 +1,42 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * 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.onap.clamp.clds.swagger;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import io.github.swagger2markup.Swagger2MarkupConverter;
+import org.onap.clamp.clds.Application;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@SpringBootTest(classes = {Application.class, SwaggerConfig.class})
+public class SwaggerGenerationTest {
+
+ @Test
+ public void convertRemoteSwaggerToAsciiDoc() {
+ Path localSwaggerFile = Paths.get("docs/swagger/swagger.json");
+ Swagger2MarkupConverter.from(localSwaggerFile).build();
+ }
+}