diff options
author | Vodafone <onap@vodafone.com> | 2019-04-09 15:18:21 +0530 |
---|---|---|
committer | Oren Kleks <orenkle@amdocs.com> | 2019-04-10 08:31:51 +0000 |
commit | c4e0ca667a62902b8d681ee5ecb1dc60a1e2b83e (patch) | |
tree | 158022f9c7bde4106b3ae765520d4b946a4bbc7d /openecomp-be/lib/openecomp-sdc-externaltesting-lib/openecomp-sdc-externaltesting-api/src | |
parent | ab5c816e1578d8f0dba231e0026e5175a84c31c3 (diff) |
VSP Compliance Check for Compute Flavor-BE
Change-Id: Ife3eb83ab49e50fde1b0eb128e7e1abd5043432f
Issue-ID: SDC-2051
Co-authored-by: jguistwite@iconectiv.com
Signed-off-by: Vodafone <onap@vodafone.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-externaltesting-lib/openecomp-sdc-externaltesting-api/src')
6 files changed, 100 insertions, 35 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-externaltesting-lib/openecomp-sdc-externaltesting-api/src/main/java/org/openecomp/core/externaltesting/api/ClientConfiguration.java b/openecomp-be/lib/openecomp-sdc-externaltesting-lib/openecomp-sdc-externaltesting-api/src/main/java/org/openecomp/core/externaltesting/api/ClientConfiguration.java new file mode 100644 index 0000000000..9269e8bf22 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-externaltesting-lib/openecomp-sdc-externaltesting-api/src/main/java/org/openecomp/core/externaltesting/api/ClientConfiguration.java @@ -0,0 +1,29 @@ +/* + * Copyright © 2019 iconectiv + * + * 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.openecomp.core.externaltesting.api; + +import lombok.Data; + +@Data +public class ClientConfiguration { + /** + * Enable/disable state for the feature. Client can use this + * to show/hide menu items. + */ + private boolean enabled; + +} diff --git a/openecomp-be/lib/openecomp-sdc-externaltesting-lib/openecomp-sdc-externaltesting-api/src/main/java/org/openecomp/core/externaltesting/api/ExternalTestingManager.java b/openecomp-be/lib/openecomp-sdc-externaltesting-lib/openecomp-sdc-externaltesting-api/src/main/java/org/openecomp/core/externaltesting/api/ExternalTestingManager.java index dc9b09c767..ac2f7fcafa 100644 --- a/openecomp-be/lib/openecomp-sdc-externaltesting-lib/openecomp-sdc-externaltesting-api/src/main/java/org/openecomp/core/externaltesting/api/ExternalTestingManager.java +++ b/openecomp-be/lib/openecomp-sdc-externaltesting-lib/openecomp-sdc-externaltesting-api/src/main/java/org/openecomp/core/externaltesting/api/ExternalTestingManager.java @@ -25,7 +25,12 @@ public interface ExternalTestingManager { * Return the configuration of this feature that we want to * expose to the client. Treated as a JSON blob for flexibility. */ - String getConfig(); + ClientConfiguration getConfig(); + + /** + * For testing purposes, set the client configuration. + */ + ClientConfiguration setConfig(ClientConfiguration config); /** * Build a tree of all test cases for the client including all @@ -35,9 +40,16 @@ public interface ExternalTestingManager { TestTreeNode getTestCasesAsTree(); /** - * Get a list of testing endpoints with name and description. + * Get a list of testing endpoints. + */ + List<RemoteTestingEndpointDefinition> getEndpoints(); + + + /** + * For functional testing purposes, allow the endpoint configuration + * to be provisioned to the BE. */ - List<VtpNameDescriptionPair> getEndpoints(); + List<RemoteTestingEndpointDefinition> setEndpoints(List<RemoteTestingEndpointDefinition> endpoints); /** * Get a list of scenarios from and endpoint. diff --git a/openecomp-be/lib/openecomp-sdc-externaltesting-lib/openecomp-sdc-externaltesting-api/src/main/java/org/openecomp/core/externaltesting/api/RemoteTestingEndpointDefinition.java b/openecomp-be/lib/openecomp-sdc-externaltesting-lib/openecomp-sdc-externaltesting-api/src/main/java/org/openecomp/core/externaltesting/api/RemoteTestingEndpointDefinition.java new file mode 100644 index 0000000000..0d5c30d593 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-externaltesting-lib/openecomp-sdc-externaltesting-api/src/main/java/org/openecomp/core/externaltesting/api/RemoteTestingEndpointDefinition.java @@ -0,0 +1,46 @@ +/* + * Copyright © 2019 iconectiv + * + * 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.openecomp.core.externaltesting.api; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; + +import java.util.regex.Pattern; + +@Data +public class RemoteTestingEndpointDefinition { + private boolean enabled; + private String title; + private String url; + private String id; + private String apiKey; + private String scenarioFilter; + + // a compact way to specify and endpoint to ease docker configuration. + @JsonIgnore + private String config; + + private Pattern scenarioFilterPattern; + + @JsonIgnore + public Pattern getScenarioFilterPattern() { + if ((scenarioFilterPattern == null) && (scenarioFilter != null)) { + scenarioFilterPattern = Pattern.compile(scenarioFilter); + } + return scenarioFilterPattern; + } +} diff --git a/openecomp-be/lib/openecomp-sdc-externaltesting-lib/openecomp-sdc-externaltesting-api/src/main/java/org/openecomp/core/externaltesting/api/TestTreeNode.java b/openecomp-be/lib/openecomp-sdc-externaltesting-lib/openecomp-sdc-externaltesting-api/src/main/java/org/openecomp/core/externaltesting/api/TestTreeNode.java index 42fa330d33..1b75772476 100644 --- a/openecomp-be/lib/openecomp-sdc-externaltesting-lib/openecomp-sdc-externaltesting-api/src/main/java/org/openecomp/core/externaltesting/api/TestTreeNode.java +++ b/openecomp-be/lib/openecomp-sdc-externaltesting-lib/openecomp-sdc-externaltesting-api/src/main/java/org/openecomp/core/externaltesting/api/TestTreeNode.java @@ -47,18 +47,4 @@ public class TestTreeNode extends VtpNameDescriptionPair { public TestTreeNode(String name, String description) { super(name, description); } - - public void addTest(VtpTestCase test) { - if (tests == null) { - tests = new ArrayList<>(); - } - tests.add(test); - } - - public void addChild(TestTreeNode child) { - if (children == null) { - children = new ArrayList<>(); - } - children.add(child); - } } diff --git a/openecomp-be/lib/openecomp-sdc-externaltesting-lib/openecomp-sdc-externaltesting-api/src/main/java/org/openecomp/core/externaltesting/errors/ExternalTestingException.java b/openecomp-be/lib/openecomp-sdc-externaltesting-lib/openecomp-sdc-externaltesting-api/src/main/java/org/openecomp/core/externaltesting/errors/ExternalTestingException.java index 33fa0f4477..3df64a40eb 100644 --- a/openecomp-be/lib/openecomp-sdc-externaltesting-lib/openecomp-sdc-externaltesting-api/src/main/java/org/openecomp/core/externaltesting/errors/ExternalTestingException.java +++ b/openecomp-be/lib/openecomp-sdc-externaltesting-lib/openecomp-sdc-externaltesting-api/src/main/java/org/openecomp/core/externaltesting/errors/ExternalTestingException.java @@ -26,21 +26,21 @@ public class ExternalTestingException extends RuntimeException { private static final long serialVersionUID = -4357810130868566088L; - private final String title; - private final int code; + private final String messageCode; + private final int httpStatus; private final String detail; - public ExternalTestingException(String title, int code, String detail) { - super(title); - this.title = title; - this.code = code; + public ExternalTestingException(String messageCode, int httpStatus, String detail) { + super(messageCode); + this.messageCode = messageCode; + this.httpStatus = httpStatus; this.detail = detail; } - public ExternalTestingException(String title, int code, String detail, Throwable parent) { - super(title, parent); - this.title = title; - this.code = code; + public ExternalTestingException(String messageCode, int httpStatus, String detail, Throwable parent) { + super(messageCode, parent); + this.messageCode = messageCode; + this.httpStatus = httpStatus; this.detail = detail; } diff --git a/openecomp-be/lib/openecomp-sdc-externaltesting-lib/openecomp-sdc-externaltesting-api/src/test/java/org/openecomp/core/externaltesting/api/ExecutionRequestTests.java b/openecomp-be/lib/openecomp-sdc-externaltesting-lib/openecomp-sdc-externaltesting-api/src/test/java/org/openecomp/core/externaltesting/api/ExecutionRequestTests.java index b10d3079d2..bfa07ecc0c 100644 --- a/openecomp-be/lib/openecomp-sdc-externaltesting-lib/openecomp-sdc-externaltesting-api/src/test/java/org/openecomp/core/externaltesting/api/ExecutionRequestTests.java +++ b/openecomp-be/lib/openecomp-sdc-externaltesting-lib/openecomp-sdc-externaltesting-api/src/test/java/org/openecomp/core/externaltesting/api/ExecutionRequestTests.java @@ -98,13 +98,5 @@ public class ExecutionRequestTests { Assert.assertEquals(2, tree.getChildren().size()); Assert.assertEquals(0, tree.getTests().size()); - - TestTreeNode manual = new TestTreeNode("root", "Root"); - - manual.addChild(new TestTreeNode("child", "child")); - manual.addTest(new VtpTestCase()); - Assert.assertEquals(1, manual.getChildren().size()); - Assert.assertEquals(1, manual.getTests().size()); - } } |