diff options
author | Zhaoxing <meng.zhaoxing1@zte.com.cn> | 2017-09-28 16:44:06 +0800 |
---|---|---|
committer | Fu Jinhua <fu.jinhua@zte.com.cn> | 2017-09-28 08:58:17 +0000 |
commit | ca57c4bc2ce48c52f10bf6ef816492cf044430e0 (patch) | |
tree | af1f05a4eb9d89e200296f82dfaf8efde42de606 /activiti-extension/src/main/java/org/onap/workflow/activitiext/common | |
parent | 4d813ced540b70cefd212f9b082bce474b3c2977 (diff) |
Add unit test for vfc-nfvo-wfengine
Change-Id: Ib6c9151f5aeae55e7f9055a8d5e33fb0b51a8474
Issue-id: VFC-454
Signed-off-by: Zhaoxing <meng.zhaoxing1@zte.com.cn>
Diffstat (limited to 'activiti-extension/src/main/java/org/onap/workflow/activitiext/common')
-rw-r--r-- | activiti-extension/src/main/java/org/onap/workflow/activitiext/common/ConstString.java | 99 | ||||
-rw-r--r-- | activiti-extension/src/main/java/org/onap/workflow/activitiext/common/EnumModuleUrl.java | 56 | ||||
-rw-r--r-- | activiti-extension/src/main/java/org/onap/workflow/activitiext/common/Parameter.java | 33 | ||||
-rw-r--r-- | activiti-extension/src/main/java/org/onap/workflow/activitiext/common/RestInfo.java (renamed from activiti-extension/src/main/java/org/onap/workflow/activitiext/common/Config.java) | 79 | ||||
-rw-r--r-- | activiti-extension/src/main/java/org/onap/workflow/activitiext/common/ServiceType.java (renamed from activiti-extension/src/main/java/org/onap/workflow/activitiext/common/MsbClientConfig.java) | 50 |
5 files changed, 252 insertions, 65 deletions
diff --git a/activiti-extension/src/main/java/org/onap/workflow/activitiext/common/ConstString.java b/activiti-extension/src/main/java/org/onap/workflow/activitiext/common/ConstString.java new file mode 100644 index 0000000..17f715e --- /dev/null +++ b/activiti-extension/src/main/java/org/onap/workflow/activitiext/common/ConstString.java @@ -0,0 +1,99 @@ +/** + * Copyright 2017 ZTE Corporation. + * + * 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.workflow.activitiext.common; + +/** + * + * @author 10222158 + * + */ +public class ConstString { + + /** + * http method type : get + */ + public static final String HTTP_GET = "GET"; + + /** + * http method type : post + */ + public static final String HTTP_POST = "POST"; + + /** + * http method type : delete + */ + public static final String HTTP_DELETE = "DELETE"; + + /** + * http method type : put + */ + public static final String HTTP_PUT = "PUT"; + + /** + * parameter position : in the uri path + */ + public static final String PARAMETER_POSITION_PATH = "path"; + + /** + * parameter positoin : after the uri + */ + public static final String PARAMETER_POSITION_QUERY = "query"; + + /** + * parameter positoin : in the request body + */ + public static final String PARAMETER_POSITION_BODY = "body"; + + /** + * parameter type : string + */ + public static final String PARAMETER_VALUE_SOURCE_STRING = "String"; + + /** + * parameter type : plan + */ + public static final String PARAMETER_VALUE_SOURCE_PLAN = "Plan"; + + /** + * parameter type : Topology + */ + public static final String PARAMETER_VALUE_SOURCE_TOPOLOGY = "Topology"; + + /** + * parameter type : Variable + */ + public static final String PARAMETER_VALUE_SOURCE_VARIABLE = "Variable"; + + /** + * parameter type : Definition + */ + public static final String PARAMETER_VALUE_SOURCE_DEFINITION = "Definition"; + + /** + * + */ + public static final String PARAMETER_VALUE = "value"; + + /** + * + */ + public static final String PARAMETER_VALUESOURCE = "valueSource"; + + /** + * + */ + public static final String CSARID_EXPRESSION = "csarId"; +} diff --git a/activiti-extension/src/main/java/org/onap/workflow/activitiext/common/EnumModuleUrl.java b/activiti-extension/src/main/java/org/onap/workflow/activitiext/common/EnumModuleUrl.java new file mode 100644 index 0000000..efc4dff --- /dev/null +++ b/activiti-extension/src/main/java/org/onap/workflow/activitiext/common/EnumModuleUrl.java @@ -0,0 +1,56 @@ +/** + * Copyright 2017 [ZTE] and others. + * + * 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.workflow.activitiext.common; + +import org.apache.commons.lang3.StringUtils; +import org.onap.workflow.activitiext.restservicetask.PropertyUtil; +import org.onap.workflow.utils.MsbUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * + */ +public class EnumModuleUrl { + + private static final Logger logger = LoggerFactory.getLogger(EnumModuleUrl.class); + + public static String getApiRootDomain() { + return "/openoapi/catalog/v1"; + } + + public static String getBaseUrl(ServiceType type) { + String baseUrl = ""; + String publishUrl =""; + try { + publishUrl = MsbUtils.getServiceAddress("catalog", "v1"); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + if(StringUtils.isNotEmpty(publishUrl)) + { + baseUrl = publishUrl; + }else{ + + baseUrl = PropertyUtil.getBasePath() + getApiRootDomain(); + } + logger.info("baseUrl is" + baseUrl); + + return baseUrl; + } +} diff --git a/activiti-extension/src/main/java/org/onap/workflow/activitiext/common/Parameter.java b/activiti-extension/src/main/java/org/onap/workflow/activitiext/common/Parameter.java new file mode 100644 index 0000000..6aa97a0 --- /dev/null +++ b/activiti-extension/src/main/java/org/onap/workflow/activitiext/common/Parameter.java @@ -0,0 +1,33 @@ +/** + * Copyright 2017 [ZTE] and others. + * + * 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.workflow.activitiext.common; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@NoArgsConstructor +@AllArgsConstructor +@JsonIgnoreProperties(ignoreUnknown = true) +public class Parameter { + + private String position; + private String type; + private String name; + private String value; + private String valueSource; +} diff --git a/activiti-extension/src/main/java/org/onap/workflow/activitiext/common/Config.java b/activiti-extension/src/main/java/org/onap/workflow/activitiext/common/RestInfo.java index 62ee72a..18c376b 100644 --- a/activiti-extension/src/main/java/org/onap/workflow/activitiext/common/Config.java +++ b/activiti-extension/src/main/java/org/onap/workflow/activitiext/common/RestInfo.java @@ -1,39 +1,40 @@ -/**
- * Copyright 2017 ZTE Corporation.
- *
- * 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.workflow.activitiext.common;
-
-import org.onap.workflow.activitiext.ActivitiExtAppConfig;
-
-public class Config {
-
- private static Config instance = new Config();
-
- private ActivitiExtAppConfig appconfig;
-
- public static Config getInstance(){
- return instance;
- }
-
- public ActivitiExtAppConfig getAppconfig() {
- return appconfig;
- }
-
- public void setAppconfig(ActivitiExtAppConfig config) {
- this.appconfig = config;
- }
-
-}
+/** + * Copyright 2017 ZTE Corporation. + * + * 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.workflow.activitiext.common; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@NoArgsConstructor +@AllArgsConstructor +@JsonIgnoreProperties(ignoreUnknown = true) +public class RestInfo { + + private String name; + private String version; + private String url; + private String path; + private String method; + private String accept; + private String contentType; + private String requestBody; + private String realUri; + +} diff --git a/activiti-extension/src/main/java/org/onap/workflow/activitiext/common/MsbClientConfig.java b/activiti-extension/src/main/java/org/onap/workflow/activitiext/common/ServiceType.java index 338a1ff..c6c3d20 100644 --- a/activiti-extension/src/main/java/org/onap/workflow/activitiext/common/MsbClientConfig.java +++ b/activiti-extension/src/main/java/org/onap/workflow/activitiext/common/ServiceType.java @@ -1,26 +1,24 @@ -/**
- * Copyright 2017 ZTE Corporation.
- *
- * 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.workflow.activitiext.common;
-
-import lombok.Data;
-
-@Data
-public class MsbClientConfig {
-
- private String msbSvrIp;
- private Integer msbSvrPort;
-}
+/** + * Copyright 2017 ZTE Corporation. + * + * 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.workflow.activitiext.common; + +/** + * @author 10175158 + * + */ +public enum ServiceType { + catalog +} |