summaryrefslogtreecommitdiffstats
path: root/aai-schema-gen/src/main/java
diff options
context:
space:
mode:
authorKeong Lim <keong.lim@huawei.com>2019-03-22 18:03:54 +1100
committerKeong Lim <keong.lim@huawei.com>2019-03-26 15:30:42 +1100
commit79e9db7096b53a81a03c984283cb7307287ba811 (patch)
tree4cfd52c61f74ebde786eef1f700fd9eeb515f2d8 /aai-schema-gen/src/main/java
parent85a4c19f32264bce094e8e9a35adf08e86cdd204 (diff)
AAI-2279 coverage of schema-service/aai-schema-gen
Add tests for schemagen/swagger/Api.java Add tests for schemagen/swagger/Definition.java Tweak schemagen/swagger/Api.java to get more coverage from tests Tweak schemagen/swagger/Definition.java to get more coverage from tests Commit a json file that is generated during test runs Tweak onap-java-formatter to pass checkstyle audit Change-Id: I1f2e9a36b7263818aa5030dcd8ec9b050d046fb1 Issue-ID: AAI-2279 Signed-off-by: Keong Lim <keong.lim@huawei.com>
Diffstat (limited to 'aai-schema-gen/src/main/java')
-rw-r--r--aai-schema-gen/src/main/java/org/onap/aai/schemagen/swagger/Api.java59
-rw-r--r--aai-schema-gen/src/main/java/org/onap/aai/schemagen/swagger/Definition.java22
2 files changed, 34 insertions, 47 deletions
diff --git a/aai-schema-gen/src/main/java/org/onap/aai/schemagen/swagger/Api.java b/aai-schema-gen/src/main/java/org/onap/aai/schemagen/swagger/Api.java
index 717b710..a3adcd8 100644
--- a/aai-schema-gen/src/main/java/org/onap/aai/schemagen/swagger/Api.java
+++ b/aai-schema-gen/src/main/java/org/onap/aai/schemagen/swagger/Api.java
@@ -8,7 +8,7 @@
* 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
+ * 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,
@@ -38,23 +38,23 @@ public class Api {
this.httpMethods = httpMethods;
}
- public String getTag(){
+ public String getTag() {
- if(this.tag != null){
+ if (this.tag != null) {
return this.tag;
}
- if(this.httpMethods != null){
- if(this.httpMethods.size() != 0){
- if(this.httpMethods.get(0).getTags() != null){
- if(this.httpMethods.get(0).getTags().size() != 0){
+ if (this.httpMethods != null) {
+ if (this.httpMethods.size() != 0) {
+ if (this.httpMethods.get(0).getTags() != null) {
+ if (this.httpMethods.get(0).getTags().size() != 0) {
this.tag = this.httpMethods.get(0).getTags().get(0);
}
}
}
}
- if(this.tag == null){
+ if (this.tag == null) {
this.tag = "";
}
@@ -63,10 +63,7 @@ public class Api {
@Override
public String toString() {
- return "Api{" +
- "path='" + path + '\'' +
- ", httpMethods=" + httpMethods +
- '}';
+ return "Api{" + "path='" + path + '\'' + ", httpMethods=" + httpMethods + '}';
}
public void setPath(String path) {
@@ -77,9 +74,9 @@ public class Api {
return this.path;
}
- public String getOperation(){
+ public String getOperation() {
- if(this.path != null){
+ if (this.path != null) {
return this.path.replaceAll("[^a-zA-Z0-9\\-]", "-") + "-";
}
@@ -122,7 +119,7 @@ public class Api {
private String returnSchemaObject;
- public void setConsumerEnabled(boolean consumerEnabled){
+ public void setConsumerEnabled(boolean consumerEnabled) {
this.consumerEnabled = consumerEnabled;
}
@@ -130,7 +127,6 @@ public class Api {
return consumerEnabled;
}
-
public List<String> getTags() {
return tags;
}
@@ -197,16 +193,10 @@ public class Api {
@Override
public String toString() {
- return "HttpVerb{" +
- "tags=" + tags +
- ", type='" + type + '\'' +
- ", summary='" + summary + '\'' +
- ", operationId='" + operationId + '\'' +
- ", consumes=" + consumes +
- ", produces=" + produces +
- ", responses=" + responses +
- ", parameters=" + parameters +
- '}';
+ return "HttpVerb{" + "tags=" + getTags() + ", type='" + getType() + '\'' + ", summary='"
+ + getSummary() + '\'' + ", operationId='" + getOperationId() + '\'' + ", consumes="
+ + getConsumes() + ", produces=" + getProduces() + ", responses=" + getResponses()
+ + ", parameters=" + getParameters() + '}';
}
public void setParametersEnabled(boolean b) {
@@ -220,8 +210,9 @@ public class Api {
public boolean isBodyParametersEnabled() {
return bodyParametersEnabled;
}
+
public boolean isOpNotPatch() {
- return type.equalsIgnoreCase("patch") ? false : true;
+ return type.equalsIgnoreCase("patch") ? false : true;
}
public void setBodyParametersEnabled(boolean bodyParametersEnabled) {
@@ -282,7 +273,7 @@ public class Api {
private String description;
- private String version;
+ private String version;
public String getResponseCode() {
return responseCode;
@@ -302,15 +293,13 @@ public class Api {
@Override
public String toString() {
- return "Response{" +
- "responseCode='" + responseCode + '\'' +
- ", description='" + description + '\'' +
- '}';
+ return "Response{" + "responseCode='" + getResponseCode() + '\'' + ", description='"
+ + getDescription() + '\'' + '}';
}
- public void setVersion(String version) {
- this.version = version;
- }
+ public void setVersion(String version) {
+ this.version = version;
+ }
}
}
diff --git a/aai-schema-gen/src/main/java/org/onap/aai/schemagen/swagger/Definition.java b/aai-schema-gen/src/main/java/org/onap/aai/schemagen/swagger/Definition.java
index 4a52020..9df9842 100644
--- a/aai-schema-gen/src/main/java/org/onap/aai/schemagen/swagger/Definition.java
+++ b/aai-schema-gen/src/main/java/org/onap/aai/schemagen/swagger/Definition.java
@@ -8,7 +8,7 @@
* 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
+ * 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,
@@ -17,6 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.aai.schemagen.swagger;
import java.util.List;
@@ -61,11 +62,9 @@ public class Definition {
@Override
public String toString() {
- return "Definition{" +
- "definitionName='" + definitionName + '\'' +
- ", definitionDescription='" + definitionDescription + '\'' +
- ", propertyList=" + propertyList +
- '}';
+ return "Definition{" + "definitionName='" + getDefinitionName() + '\''
+ + ", definitionDescription='" + getDefinitionDescription() + '\'' + ", propertyList="
+ + getPropertyList() + '}';
}
public boolean isHasDescription() {
@@ -112,7 +111,8 @@ public class Definition {
private boolean hasPropertyReference;
- public Property(){}
+ public Property() {
+ }
public String getPropertyName() {
return propertyName;
@@ -140,11 +140,9 @@ public class Definition {
@Override
public String toString() {
- return "Property{" +
- "propertyName='" + propertyName + '\'' +
- ", propertyType='" + propertyType + '\'' +
- ", propertyReference='" + propertyReference + '\'' +
- '}';
+ return "Property{" + "propertyName='" + getPropertyName() + '\'' + ", propertyType='"
+ + getPropertyType() + '\'' + ", propertyReference='" + getPropertyReference() + '\''
+ + '}';
}
public boolean isHasType() {