aboutsummaryrefslogtreecommitdiffstats
path: root/participant/participant-impl/participant-impl-simulator/src/main
diff options
context:
space:
mode:
authorrameshiyer27 <ramesh.murugan.iyer@est.tech>2022-07-28 11:58:19 +0100
committerrameshiyer27 <ramesh.murugan.iyer@est.tech>2022-07-29 08:47:55 +0100
commitfda6280b8d38e24d15fc0710cc7d0c213f90779b (patch)
tree667846be886ff6f8d443de1973b90439f72b5bc3 /participant/participant-impl/participant-impl-simulator/src/main
parentc1c9b09f1b7200f814110bd7dab7f45630b3e184 (diff)
Add module for AC Element implementation
Refactored unused participant simulator module to implement AC element microservice for ACM testing purposes. Empty spring project added. Business logics will be added as a separate review on top of this structure. Issue-ID: POLICY-4312 Signed-off-by: zrrmmua <ramesh.murugan.iyer@est.tech> Change-Id: I8fc280083ce4b759ed9ab23b223cf1555176ef62
Diffstat (limited to 'participant/participant-impl/participant-impl-simulator/src/main')
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/ParticipantSimulatorApplication.java46
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/config/AafConfiguration.java46
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/config/ParticipantConfig.java61
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/config/SecurityConfig.java39
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/config/SpringFoxConfig.java45
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/config/YamlConfiguration.java43
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/main/handler/AutomationCompositionElementHandler.java112
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/main/parameters/ParticipantSimulatorParameters.java45
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/main/rest/AbstractRestController.java130
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/main/rest/GlobalControllerExceptionHandler.java45
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/main/rest/ParticipantErrorController.java97
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/main/rest/ParticipantSimulatorAafFilter.java38
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/simulation/SimulationProvider.java113
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/simulation/rest/SimulationElementController.java188
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/simulation/rest/SimulationParticipantController.java181
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/resources/config/application.yaml37
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/resources/version.txt4
17 files changed, 0 insertions, 1270 deletions
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/ParticipantSimulatorApplication.java b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/ParticipantSimulatorApplication.java
deleted file mode 100644
index ea94795fb..000000000
--- a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/ParticipantSimulatorApplication.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.acm.participant.simulator;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.context.properties.ConfigurationPropertiesScan;
-import org.springframework.context.annotation.ComponentScan;
-
-/**
- * Starter.
- *
- */
-// @formatter:off
-@SpringBootApplication
-@ConfigurationPropertiesScan("org.onap.policy.clamp.acm.participant.simulator.main.parameters")
-@ComponentScan({
- "org.onap.policy.clamp.acm.participant.simulator",
- "org.onap.policy.clamp.acm.participant.intermediary",
- "org.onap.policy.clamp.acm.common.rest"
-})
-//@formatter:on
-public class ParticipantSimulatorApplication {
-
- public static void main(String[] args) {
- SpringApplication.run(ParticipantSimulatorApplication.class, args);
- }
-}
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/config/AafConfiguration.java b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/config/AafConfiguration.java
deleted file mode 100644
index 101e7fac2..000000000
--- a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/config/AafConfiguration.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP CLAMP
- * ================================================================================
- * Copyright (C) 2017-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.policy.clamp.acm.participant.simulator.config;
-
-import javax.servlet.Filter;
-import org.onap.policy.clamp.acm.participant.simulator.main.rest.ParticipantSimulatorAafFilter;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Profile;
-
-@Configuration
-@Profile("clamp-aaf-authentication")
-public class AafConfiguration {
-
- /**
- * Method to return Aaf filter.
- *
- * @return Filter
- */
- @Bean
- public Filter aafFilter() {
- return new ParticipantSimulatorAafFilter();
- }
-
-}
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/config/ParticipantConfig.java b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/config/ParticipantConfig.java
deleted file mode 100644
index 92ced99d7..000000000
--- a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/config/ParticipantConfig.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.acm.participant.simulator.config;
-
-import org.onap.policy.clamp.acm.participant.intermediary.api.ParticipantIntermediaryApi;
-import org.onap.policy.clamp.acm.participant.simulator.main.handler.AutomationCompositionElementHandler;
-import org.onap.policy.clamp.common.acm.rest.RequestResponseLoggingFilter;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.web.servlet.FilterRegistrationBean;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-@Configuration
-public class ParticipantConfig {
-
- /**
- * logging Filter configuration.
- *
- * @return FilterRegistrationBean
- */
- @Bean
- public FilterRegistrationBean<RequestResponseLoggingFilter> loggingFilter() {
- FilterRegistrationBean<RequestResponseLoggingFilter> registrationBean = new FilterRegistrationBean<>();
-
- registrationBean.setFilter(new RequestResponseLoggingFilter());
- registrationBean.addUrlPatterns("/onap/participantsim/v2/*");
-
- return registrationBean;
- }
-
- /**
- * Register AutomationCompositionElementListener.
- *
- * @param intermediaryApi the ParticipantIntermediaryApi
- * @param acElementHandler the AutomationComposition Element Handler
- */
- @Autowired
- public void registerAutomationCompositionElementListener(ParticipantIntermediaryApi intermediaryApi,
- AutomationCompositionElementHandler acElementHandler) {
- intermediaryApi.registerAutomationCompositionElementListener(acElementHandler);
- acElementHandler.setIntermediaryApi(intermediaryApi);
- }
-}
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/config/SecurityConfig.java b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/config/SecurityConfig.java
deleted file mode 100644
index c41c6e1b3..000000000
--- a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/config/SecurityConfig.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.acm.participant.simulator.config;
-
-import org.springframework.context.annotation.Configuration;
-import org.springframework.security.config.annotation.web.builders.HttpSecurity;
-import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
-
-@Configuration
-public class SecurityConfig extends WebSecurityConfigurerAdapter {
-
- @Override
- protected void configure(HttpSecurity http) throws Exception {
- // @formatter:off
- http.authorizeRequests()
- .antMatchers().authenticated()
- .anyRequest().authenticated()
- .and().httpBasic().and().csrf().disable();
- // @formatter:on
- }
-}
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/config/SpringFoxConfig.java b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/config/SpringFoxConfig.java
deleted file mode 100644
index d9909818f..000000000
--- a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/config/SpringFoxConfig.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.acm.participant.simulator.config;
-
-import org.onap.policy.clamp.acm.participant.simulator.simulation.rest.SimulationElementController;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import springfox.documentation.builders.PathSelectors;
-import springfox.documentation.builders.RequestHandlerSelectors;
-import springfox.documentation.spi.DocumentationType;
-import springfox.documentation.spring.web.plugins.Docket;
-
-@Configuration
-public class SpringFoxConfig {
-
- /**
- * Docket Spring Fox Config.
- *
- * @return Docket
- */
- @Bean
- public Docket api() {
- return new Docket(DocumentationType.SWAGGER_2).select()
- .apis(RequestHandlerSelectors.basePackage(SimulationElementController.class.getPackageName()))
- .paths(PathSelectors.any()).build();
- }
-}
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/config/YamlConfiguration.java b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/config/YamlConfiguration.java
deleted file mode 100644
index 718697786..000000000
--- a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/config/YamlConfiguration.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.acm.participant.simulator.config;
-
-import java.util.List;
-import org.onap.policy.clamp.common.acm.rest.CoderHttpMesageConverter;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.http.MediaType;
-import org.springframework.http.converter.HttpMessageConverter;
-import org.springframework.http.converter.StringHttpMessageConverter;
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
-
-@Configuration
-public class YamlConfiguration implements WebMvcConfigurer {
-
- @Override
- public void extendMessageConverters(List<HttpMessageConverter<?>> converters) {
- converters.add(new CoderHttpMesageConverter<>("yaml"));
- converters.add(new CoderHttpMesageConverter<>("json"));
-
- StringHttpMessageConverter converter = new StringHttpMessageConverter();
- converter.setSupportedMediaTypes(List.of(MediaType.TEXT_PLAIN));
- converters.add(converter);
- }
-}
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/main/handler/AutomationCompositionElementHandler.java b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/main/handler/AutomationCompositionElementHandler.java
deleted file mode 100644
index 9e30c8809..000000000
--- a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/main/handler/AutomationCompositionElementHandler.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.acm.participant.simulator.main.handler;
-
-import java.time.Instant;
-import java.util.UUID;
-import lombok.Setter;
-import org.onap.policy.clamp.acm.participant.intermediary.api.AutomationCompositionElementListener;
-import org.onap.policy.clamp.acm.participant.intermediary.api.ParticipantIntermediaryApi;
-import org.onap.policy.clamp.models.acm.concepts.AcElementStatistics;
-import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
-import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
-import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
-import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
-import org.onap.policy.models.base.PfModelException;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Component;
-
-/**
- * This class handles implementation of automationCompositionElement updates.
- */
-@Component
-public class AutomationCompositionElementHandler implements AutomationCompositionElementListener {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(AutomationCompositionElementHandler.class);
-
- @Setter
- private ParticipantIntermediaryApi intermediaryApi;
-
- /**
- * Callback method to handle a automation composition element state change.
- *
- * @param automationCompositionElementId the ID of the automation composition element
- * @param currentState the current state of the automation composition element
- * @param newState the state to which the automation composition element is changing to
- * @throws PfModelException in case of an exception
- */
- @Override
- public void automationCompositionElementStateChange(ToscaConceptIdentifier automationCompositionId,
- UUID automationCompositionElementId, AutomationCompositionState currentState,
- AutomationCompositionOrderedState newState) throws PfModelException {
- switch (newState) {
- case UNINITIALISED:
- intermediaryApi.updateAutomationCompositionElementState(automationCompositionId,
- automationCompositionElementId, newState, AutomationCompositionState.UNINITIALISED,
- ParticipantMessageType.AUTOMATION_COMPOSITION_STATE_CHANGE);
- break;
- case PASSIVE:
- intermediaryApi.updateAutomationCompositionElementState(automationCompositionId,
- automationCompositionElementId, newState, AutomationCompositionState.PASSIVE,
- ParticipantMessageType.AUTOMATION_COMPOSITION_STATE_CHANGE);
- break;
- case RUNNING:
- intermediaryApi.updateAutomationCompositionElementState(automationCompositionId,
- automationCompositionElementId, newState, AutomationCompositionState.RUNNING,
- ParticipantMessageType.AUTOMATION_COMPOSITION_STATE_CHANGE);
- break;
- default:
- LOGGER.debug("Unknown orderedstate {}", newState);
- break;
- }
- }
-
- /**
- * Callback method to handle an update on a automation composition element.
- *
- * @param element the information on the automation composition element
- * @param acElementDefinition toscaNodeTemplate
- * @throws PfModelException in case of an exception
- */
- @Override
- public void automationCompositionElementUpdate(ToscaConceptIdentifier automationCompositionId,
- AutomationCompositionElement element, ToscaNodeTemplate acElementDefinition) throws PfModelException {
- intermediaryApi.updateAutomationCompositionElementState(automationCompositionId, element.getId(),
- element.getOrderedState(), AutomationCompositionState.PASSIVE,
- ParticipantMessageType.AUTOMATION_COMPOSITION_UPDATE);
- }
-
- @Override
- public void handleStatistics(UUID automationCompositionElementId) throws PfModelException {
- var acElement = intermediaryApi.getAutomationCompositionElement(automationCompositionElementId);
- if (acElement != null) {
- var acElementStatistics = new AcElementStatistics();
- acElementStatistics.setState(acElement.getState());
- acElementStatistics.setTimeStamp(Instant.now());
- intermediaryApi.updateAutomationCompositionElementStatistics(automationCompositionElementId,
- acElementStatistics);
- }
- }
-
-}
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/main/parameters/ParticipantSimulatorParameters.java b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/main/parameters/ParticipantSimulatorParameters.java
deleted file mode 100644
index 8549e4c7b..000000000
--- a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/main/parameters/ParticipantSimulatorParameters.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.acm.participant.simulator.main.parameters;
-
-import javax.validation.Valid;
-import javax.validation.constraints.NotNull;
-import lombok.Getter;
-import lombok.Setter;
-import org.onap.policy.clamp.acm.participant.intermediary.parameters.ParticipantIntermediaryParameters;
-import org.onap.policy.clamp.acm.participant.intermediary.parameters.ParticipantParameters;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.validation.annotation.Validated;
-
-/**
- * Class to hold all parameters needed for the participant simulator.
- *
- */
-@Validated
-@Getter
-@Setter
-@ConfigurationProperties(prefix = "participant")
-public class ParticipantSimulatorParameters implements ParticipantParameters {
-
- @Valid
- @NotNull
- private ParticipantIntermediaryParameters intermediaryParameters;
-}
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/main/rest/AbstractRestController.java b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/main/rest/AbstractRestController.java
deleted file mode 100644
index 4db07c953..000000000
--- a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/main/rest/AbstractRestController.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.acm.participant.simulator.main.rest;
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.BasicAuthDefinition;
-import io.swagger.annotations.Info;
-import io.swagger.annotations.SecurityDefinition;
-import io.swagger.annotations.SwaggerDefinition;
-import io.swagger.annotations.Tag;
-import java.net.HttpURLConnection;
-import java.util.UUID;
-import javax.ws.rs.core.MediaType;
-import lombok.AccessLevel;
-import lombok.Getter;
-import org.onap.policy.clamp.acm.participant.simulator.simulation.SimulationProvider;
-import org.springframework.http.HttpHeaders;
-import org.springframework.web.bind.annotation.RequestMapping;
-
-/**
- * Common superclass to provide REST endpoints for the participant simulator.
- */
-// @formatter:off
-@RequestMapping(
- value = "/v2",
- produces = {
- MediaType.APPLICATION_JSON,
- AbstractRestController.APPLICATION_YAML
- }
-)
-@Api(value = "Participant Simulator API")
-@SwaggerDefinition(
- info = @Info(
- description = "Participant Simulator",
- version = "v1.0",
- title = "Participant Simulator"
- ),
- consumes = {MediaType.APPLICATION_JSON, AbstractRestController.APPLICATION_YAML},
- produces = {MediaType.APPLICATION_JSON, AbstractRestController.APPLICATION_YAML},
- schemes = {SwaggerDefinition.Scheme.HTTP, SwaggerDefinition.Scheme.HTTPS},
- tags = {
- @Tag(name = "participantsim", description = "Participant Simulator")
- },
- securityDefinition = @SecurityDefinition(basicAuthDefinitions = {@BasicAuthDefinition(key = "basicAuth")}))
-// @formatter:on
-public abstract class AbstractRestController {
- public static final String APPLICATION_YAML = "application/yaml";
-
- public static final String EXTENSION_NAME = "interface info";
-
- public static final String API_VERSION_NAME = "api-version";
- public static final String API_VERSION = "1.0.0";
-
- public static final String LAST_MOD_NAME = "last-mod-release";
- public static final String LAST_MOD_RELEASE = "Dublin";
-
- public static final String VERSION_MINOR_NAME = "X-MinorVersion";
- public static final String VERSION_MINOR_DESCRIPTION =
- "Used to request or communicate a MINOR version back from the client"
- + " to the server, and from the server back to the client";
-
- public static final String VERSION_PATCH_NAME = "X-PatchVersion";
- public static final String VERSION_PATCH_DESCRIPTION = "Used only to communicate a PATCH version in a response for"
- + " troubleshooting purposes only, and will not be provided by" + " the client on request";
-
- public static final String VERSION_LATEST_NAME = "X-LatestVersion";
- public static final String VERSION_LATEST_DESCRIPTION = "Used only to communicate an API's latest version";
-
- public static final String REQUEST_ID_NAME = "X-ONAP-RequestID";
- public static final String REQUEST_ID_HDR_DESCRIPTION = "Used to track REST transactions for logging purpose";
- public static final String REQUEST_ID_PARAM_DESCRIPTION = "RequestID for http transaction";
-
- public static final String AUTHORIZATION_TYPE = "basicAuth";
-
- public static final int AUTHENTICATION_ERROR_CODE = HttpURLConnection.HTTP_UNAUTHORIZED;
- public static final int AUTHORIZATION_ERROR_CODE = HttpURLConnection.HTTP_FORBIDDEN;
- public static final int SERVER_ERROR_CODE = HttpURLConnection.HTTP_INTERNAL_ERROR;
-
- public static final String AUTHENTICATION_ERROR_MESSAGE = "Authentication Error";
- public static final String AUTHORIZATION_ERROR_MESSAGE = "Authorization Error";
- public static final String SERVER_ERROR_MESSAGE = "Internal Server Error";
-
- // The provider for simulation requests
- @Getter(AccessLevel.PROTECTED)
- private SimulationProvider simulationProvider;
-
- /**
- * create a Rest Controller.
- *
- * @param simulationProvider the provider for the simulation participant
- */
- protected AbstractRestController(SimulationProvider simulationProvider) {
- this.simulationProvider = simulationProvider;
- }
-
- /**
- * Get the common headers for responses.
- *
- * @param requestId the request ID
- *
- * @return the headers
- */
- protected HttpHeaders getCommonHeaders(UUID requestId) {
- HttpHeaders commonHeaders = new HttpHeaders();
- commonHeaders.add(VERSION_MINOR_NAME, API_VERSION.split("\\.")[1]);
- commonHeaders.add(VERSION_PATCH_NAME, API_VERSION.split("\\.")[2]);
- commonHeaders.add(VERSION_LATEST_NAME, API_VERSION);
- commonHeaders.add(REQUEST_ID_NAME, (requestId != null ? requestId.toString() : null));
-
- return commonHeaders;
- }
-}
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/main/rest/GlobalControllerExceptionHandler.java b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/main/rest/GlobalControllerExceptionHandler.java
deleted file mode 100644
index 69714137f..000000000
--- a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/main/rest/GlobalControllerExceptionHandler.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * Modifications Copyright (C) 2021 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.acm.participant.simulator.main.rest;
-
-import org.onap.policy.clamp.common.acm.exception.AutomationCompositionException;
-import org.onap.policy.clamp.models.acm.messages.rest.SimpleResponse;
-import org.onap.policy.clamp.models.acm.rest.RestUtils;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.RestControllerAdvice;
-
-@RestControllerAdvice
-public class GlobalControllerExceptionHandler {
-
- /**
- * Handle AutomationCompositionException.
- *
- * @param ex AutomationCompositionException
- * @return ResponseEntity
- */
- @ExceptionHandler(AutomationCompositionException.class)
- public ResponseEntity<SimpleResponse> handleBadRequest(AutomationCompositionException ex) {
- return RestUtils.toSimpleResponse(ex);
- }
-}
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/main/rest/ParticipantErrorController.java b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/main/rest/ParticipantErrorController.java
deleted file mode 100644
index e32c57254..000000000
--- a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/main/rest/ParticipantErrorController.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * Modifications Copyright (C) 2021 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.acm.participant.simulator.main.rest;
-
-import java.util.Map;
-import javax.servlet.RequestDispatcher;
-import javax.servlet.http.HttpServletRequest;
-import org.onap.policy.clamp.models.acm.messages.rest.SimpleResponse;
-import org.onap.policy.clamp.models.acm.messages.rest.TypedSimpleResponse;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.web.error.ErrorAttributeOptions;
-import org.springframework.boot.web.servlet.error.ErrorAttributes;
-import org.springframework.boot.web.servlet.error.ErrorController;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.MediaType;
-import org.springframework.http.ResponseEntity;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.context.request.ServletWebRequest;
-
-@Controller
-public class ParticipantErrorController implements ErrorController {
-
- private final ErrorAttributes errorAttributes;
-
- @Value("${server.error.path}")
- private String path;
-
- /**
- * Constructor.
- *
- * @param errorAttributes ErrorAttributes
- */
- public ParticipantErrorController(ErrorAttributes errorAttributes) {
- this.errorAttributes = errorAttributes;
- }
-
- protected HttpStatus getStatus(HttpServletRequest request) {
- Integer statusCode = (Integer) request.getAttribute(RequestDispatcher.ERROR_STATUS_CODE);
- if (statusCode == null) {
- return HttpStatus.INTERNAL_SERVER_ERROR;
- }
- try {
- return HttpStatus.valueOf(statusCode);
- } catch (Exception ex) {
- return HttpStatus.INTERNAL_SERVER_ERROR;
- }
- }
-
- /**
- * Handle Errors not handled to GlobalControllerExceptionHandler.
- *
- * @param request HttpServletRequest
- * @return ResponseEntity
- */
- @RequestMapping(value = "${server.error.path}", produces = MediaType.APPLICATION_JSON_VALUE)
- public ResponseEntity<TypedSimpleResponse<SimpleResponse>> handleError(HttpServletRequest request) {
- Map<String, Object> map = this.errorAttributes.getErrorAttributes(new ServletWebRequest(request),
- ErrorAttributeOptions.defaults());
-
- var sb = new StringBuilder();
- final Object error = map.get("error");
- if (error != null) {
- sb.append(error.toString() + " ");
- }
- final Object message = map.get("message");
- if (message != null) {
- sb.append(message.toString());
- }
-
- TypedSimpleResponse<SimpleResponse> resp = new TypedSimpleResponse<>();
- resp.setErrorDetails(sb.toString());
-
- return ResponseEntity.status(getStatus(request)).body(resp);
-
- }
-}
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/main/rest/ParticipantSimulatorAafFilter.java b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/main/rest/ParticipantSimulatorAafFilter.java
deleted file mode 100644
index 3008d2d17..000000000
--- a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/main/rest/ParticipantSimulatorAafFilter.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.acm.participant.simulator.main.rest;
-
-import org.onap.policy.common.endpoints.http.server.aaf.AafGranularAuthFilter;
-import org.onap.policy.common.utils.resources.MessageConstants;
-
-/**
- * Class to manage AAF filters for the participant simulator component.
- */
-public class ParticipantSimulatorAafFilter extends AafGranularAuthFilter {
-
- public static final String AAF_NODETYPE = MessageConstants.POLICY_CLAMP + "-participant-simulator";
- public static final String AAF_ROOT_PERMISSION = DEFAULT_NAMESPACE + "." + AAF_NODETYPE;
-
- @Override
- public String getPermissionTypeRoot() {
- return AAF_ROOT_PERMISSION;
- }
-}
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/simulation/SimulationProvider.java b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/simulation/SimulationProvider.java
deleted file mode 100644
index 73ae80e29..000000000
--- a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/simulation/SimulationProvider.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.acm.participant.simulator.simulation;
-
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-import org.onap.policy.clamp.acm.participant.intermediary.api.ParticipantIntermediaryApi;
-import org.onap.policy.clamp.common.acm.exception.AutomationCompositionException;
-import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
-import org.onap.policy.clamp.models.acm.concepts.AutomationCompositions;
-import org.onap.policy.clamp.models.acm.concepts.Participant;
-import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
-import org.onap.policy.clamp.models.acm.messages.rest.TypedSimpleResponse;
-import org.springframework.stereotype.Service;
-
-/**
- * This provider class simulation of participants and automation composition elements.
- */
-@Service
-public class SimulationProvider {
-
- private final ParticipantIntermediaryApi intermediaryApi;
-
- /**
- * Create a participant simulation provider.
- *
- * @param intermediaryApi the intermediary to use for talking to the CLAMP runtime
- */
- public SimulationProvider(ParticipantIntermediaryApi intermediaryApi) {
- this.intermediaryApi = intermediaryApi;
- }
-
- /**
- * Get the automation compositions.
- *
- * @param name the automationComposition, null to get all
- * @param version the automationComposition, null to get all
- * @return the automation compositions
- * @throws AutomationCompositionException on errors getting the automation compositions
- */
- public AutomationCompositions getAutomationCompositions(String name, String version)
- throws AutomationCompositionException {
- return intermediaryApi.getAutomationCompositions(name, version);
- }
-
- /**
- * Get the simulated automation composition elements.
- *
- * @param name the automationCompositionElement, null to get all
- * @param version the automationCompositionElement, null to get all
- * @return the automation composition elements
- */
- public Map<UUID, AutomationCompositionElement> getAutomationCompositionElements(String name, String version) {
- return intermediaryApi.getAutomationCompositionElements(name, version);
- }
-
- /**
- * Update the given automation composition element in the simulator.
- *
- * @param element the automation composition element to update
- * @return response simple response returned
- */
- public TypedSimpleResponse<AutomationCompositionElement> updateAutomationCompositionElement(
- AutomationCompositionElement element) {
- TypedSimpleResponse<AutomationCompositionElement> response = new TypedSimpleResponse<>();
- response.setResponse(intermediaryApi.updateAutomationCompositionElementState(null, element.getId(),
- element.getOrderedState(), element.getState(), ParticipantMessageType.AUTOMATION_COMPOSITION_STATE_CHANGE));
- return response;
- }
-
- /**
- * Get the current simulated participants.
- *
- * @param name the participant, null to get all
- * @param version the participant, null to get all
- * @return the list of participants
- */
- public List<Participant> getParticipants(String name, String version) {
- return intermediaryApi.getParticipants(name, version);
- }
-
- /**
- * Update a simulated participant.
- *
- * @param participant the participant to update
- * @return TypedSimpleResponse simple response
- */
- public TypedSimpleResponse<Participant> updateParticipant(Participant participant) {
- TypedSimpleResponse<Participant> response = new TypedSimpleResponse<>();
- response.setResponse(
- intermediaryApi.updateParticipantState(participant.getDefinition(), participant.getParticipantState()));
- return response;
- }
-}
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/simulation/rest/SimulationElementController.java b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/simulation/rest/SimulationElementController.java
deleted file mode 100644
index 277638220..000000000
--- a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/simulation/rest/SimulationElementController.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.acm.participant.simulator.simulation.rest;
-
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
-import io.swagger.annotations.Authorization;
-import io.swagger.annotations.Extension;
-import io.swagger.annotations.ExtensionProperty;
-import io.swagger.annotations.ResponseHeader;
-import java.util.Map;
-import java.util.UUID;
-import org.onap.policy.clamp.acm.participant.simulator.main.rest.AbstractRestController;
-import org.onap.policy.clamp.acm.participant.simulator.simulation.SimulationProvider;
-import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
-import org.onap.policy.clamp.models.acm.concepts.AutomationCompositions;
-import org.onap.policy.clamp.models.acm.messages.rest.TypedSimpleResponse;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestHeader;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * Class to provide REST end points for participant simulator to query/update details of automationCompositionElements.
- */
-@RestController
-public class SimulationElementController extends AbstractRestController {
-
- /**
- * Constructor.
- *
- * @param simulationProvider the Simulation Provider
- */
- public SimulationElementController(SimulationProvider simulationProvider) {
- super(simulationProvider);
- }
-
- /**
- * Queries details of all automation composition element within the simulator.
- *
- * @param requestId request ID used in ONAP logging
- * @param name the name of the Automation Composition element to get, null to get all
- * @param version the version of the Automation Composition element to get, null to get all
- * @return the automation composition elements
- */
- // @formatter:off
- @GetMapping("/elements/{name}/{version}")
- @ApiOperation(
- value = "Query details of the requested simulated automation composition elements",
- notes = "Queries details of the requested simulated automation composition elements, "
- + "returning all automation composition element details",
- response = AutomationCompositions.class,
- tags = {
- "Clamp Automation Composition Participant Simulator API"
- },
- authorizations = @Authorization(value = AUTHORIZATION_TYPE),
- responseHeaders = {
- @ResponseHeader(
- name = VERSION_MINOR_NAME, description = VERSION_MINOR_DESCRIPTION,
- response = String.class),
- @ResponseHeader(name = VERSION_PATCH_NAME, description = VERSION_PATCH_DESCRIPTION,
- response = String.class),
- @ResponseHeader(name = VERSION_LATEST_NAME, description = VERSION_LATEST_DESCRIPTION,
- response = String.class),
- @ResponseHeader(name = REQUEST_ID_NAME, description = REQUEST_ID_HDR_DESCRIPTION,
- response = UUID.class)},
- extensions = {
- @Extension
- (
- name = EXTENSION_NAME,
- properties = {
- @ExtensionProperty(name = API_VERSION_NAME, value = API_VERSION),
- @ExtensionProperty(name = LAST_MOD_NAME, value = LAST_MOD_RELEASE)
- }
- )
- }
- )
- @ApiResponses(
- value = {
- @ApiResponse(code = AUTHENTICATION_ERROR_CODE, message = AUTHENTICATION_ERROR_MESSAGE),
- @ApiResponse(code = AUTHORIZATION_ERROR_CODE, message = AUTHORIZATION_ERROR_MESSAGE),
- @ApiResponse(code = SERVER_ERROR_CODE, message = SERVER_ERROR_MESSAGE)
- }
- )
- // @formatter:on
- public ResponseEntity<Map<UUID, AutomationCompositionElement>> elements(
- @RequestHeader(name = REQUEST_ID_NAME, required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
- @ApiParam(value = "Automation composition element name", required = true) @PathVariable("name") String name,
- @ApiParam(
- value = "Automation composition element version",
- required = true) @PathVariable("version") String version) {
-
- return ResponseEntity
- .ok()
- .headers(super.getCommonHeaders(requestId))
- .body(getSimulationProvider().getAutomationCompositionElements(name, version));
- }
-
- /**
- * Updates a automation composition element in the simulator.
- *
- * @param requestId request ID used in ONAP logging
- * @param body the body of a automation composition element
- * @return a response
- */
- // @formatter:off
- @PutMapping("/elements")
- @ApiOperation(
- value = "Updates simulated automation composition elements",
- notes = "Updates simulated automation composition elements, "
- + "returning the updated automation composition definition IDs",
- response = TypedSimpleResponse.class,
- tags = {
- "Clamp Automation Composition Participant Simulator API"
- },
- authorizations = @Authorization(value = AUTHORIZATION_TYPE),
- responseHeaders = {
- @ResponseHeader(
- name = VERSION_MINOR_NAME,
- description = VERSION_MINOR_DESCRIPTION,
- response = String.class),
- @ResponseHeader(
- name = VERSION_PATCH_NAME,
- description = VERSION_PATCH_DESCRIPTION,
- response = String.class),
- @ResponseHeader(
- name = VERSION_LATEST_NAME,
- description = VERSION_LATEST_DESCRIPTION,
- response = String.class),
- @ResponseHeader(
- name = REQUEST_ID_NAME,
- description = REQUEST_ID_HDR_DESCRIPTION,
- response = UUID.class)
- },
- extensions = {
- @Extension
- (
- name = EXTENSION_NAME,
- properties = {
- @ExtensionProperty(name = API_VERSION_NAME, value = API_VERSION),
- @ExtensionProperty(name = LAST_MOD_NAME, value = LAST_MOD_RELEASE)
- }
- )
- }
- )
- @ApiResponses(
- value = {
- @ApiResponse(code = AUTHENTICATION_ERROR_CODE, message = AUTHENTICATION_ERROR_MESSAGE),
- @ApiResponse(code = AUTHORIZATION_ERROR_CODE, message = AUTHORIZATION_ERROR_MESSAGE),
- @ApiResponse(code = SERVER_ERROR_CODE, message = SERVER_ERROR_MESSAGE)
- }
- )
- // @formatter:on
- public ResponseEntity<TypedSimpleResponse<AutomationCompositionElement>> update(
- @RequestHeader(name = REQUEST_ID_NAME, required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
- @ApiParam(
- value = "Body of a automation composition element",
- required = true) @RequestBody AutomationCompositionElement body) {
-
- return ResponseEntity
- .ok()
- .headers(super.getCommonHeaders(requestId))
- .body(getSimulationProvider().updateAutomationCompositionElement(body));
- }
-}
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/simulation/rest/SimulationParticipantController.java b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/simulation/rest/SimulationParticipantController.java
deleted file mode 100644
index 02e56aa6e..000000000
--- a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/acm/participant/simulator/simulation/rest/SimulationParticipantController.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.acm.participant.simulator.simulation.rest;
-
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
-import io.swagger.annotations.Authorization;
-import io.swagger.annotations.Extension;
-import io.swagger.annotations.ExtensionProperty;
-import io.swagger.annotations.ResponseHeader;
-import java.util.List;
-import java.util.UUID;
-import org.onap.policy.clamp.acm.participant.simulator.main.rest.AbstractRestController;
-import org.onap.policy.clamp.acm.participant.simulator.simulation.SimulationProvider;
-import org.onap.policy.clamp.models.acm.concepts.Participant;
-import org.onap.policy.clamp.models.acm.messages.rest.TypedSimpleResponse;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestHeader;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * Class to provide REST end points for participant simulator to query/update details of all participants.
- */
-@RestController
-public class SimulationParticipantController extends AbstractRestController {
-
- /**
- * Constructor.
- *
- * @param simulationProvider the Simulation Provider
- */
- public SimulationParticipantController(SimulationProvider simulationProvider) {
- super(simulationProvider);
- }
-
- /**
- * Queries details of all participants within the simulator.
- *
- * @param requestId request ID used in ONAP logging
- * @param name the name of the participant to get, null to get all
- * @param version the version of the participant to get, null to get all
- * @return the participants
- */
- // @formatter:off
- @GetMapping("/participants/{name}/{version}")
- @ApiOperation(value = "Query details of the requested simulated participants",
- notes = "Queries details of the requested simulated participants, "
- + "returning all participant details",
- response = List.class,
- tags = {
- "Clamp Automation Composition Participant Simulator API"
- },
- authorizations = @Authorization(value = AUTHORIZATION_TYPE),
- responseHeaders = {
- @ResponseHeader(
- name = VERSION_MINOR_NAME, description = VERSION_MINOR_DESCRIPTION,
- response = String.class),
- @ResponseHeader(name = VERSION_PATCH_NAME, description = VERSION_PATCH_DESCRIPTION,
- response = String.class),
- @ResponseHeader(name = VERSION_LATEST_NAME, description = VERSION_LATEST_DESCRIPTION,
- response = String.class),
- @ResponseHeader(name = REQUEST_ID_NAME, description = REQUEST_ID_HDR_DESCRIPTION,
- response = UUID.class)},
- extensions = {
- @Extension
- (
- name = EXTENSION_NAME,
- properties = {
- @ExtensionProperty(name = API_VERSION_NAME, value = API_VERSION),
- @ExtensionProperty(name = LAST_MOD_NAME, value = LAST_MOD_RELEASE)
- }
- )
- }
- )
- @ApiResponses(
- value = {
- @ApiResponse(code = AUTHENTICATION_ERROR_CODE, message = AUTHENTICATION_ERROR_MESSAGE),
- @ApiResponse(code = AUTHORIZATION_ERROR_CODE, message = AUTHORIZATION_ERROR_MESSAGE),
- @ApiResponse(code = SERVER_ERROR_CODE, message = SERVER_ERROR_MESSAGE)
- }
- )
- // @formatter:on
- public ResponseEntity<List<Participant>> participants(
- @RequestHeader(name = REQUEST_ID_NAME, required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
- @ApiParam(value = "Participant name", required = true) @PathVariable("name") String name,
- @ApiParam(value = "Participant version", required = true) @PathVariable("version") String version) {
-
- return ResponseEntity
- .ok()
- .headers(super.getCommonHeaders(requestId))
- .body(getSimulationProvider().getParticipants(name, version));
- }
-
- /**
- * Updates a participant in the simulator.
- *
- * @param requestId request ID used in ONAP logging
- * @param body the body of a participant
- * @return a response
- */
- // @formatter:off
- @PutMapping("/participants")
- @ApiOperation(
- value = "Updates simulated participants",
- notes = "Updates simulated participants, returning the updated automation composition definition IDs",
- response = TypedSimpleResponse.class,
- tags = {
- "Clamp Automation Composition Participant Simulator API"
- },
- authorizations = @Authorization(value = AUTHORIZATION_TYPE),
- responseHeaders = {
- @ResponseHeader(
- name = VERSION_MINOR_NAME,
- description = VERSION_MINOR_DESCRIPTION,
- response = String.class),
- @ResponseHeader(
- name = VERSION_PATCH_NAME,
- description = VERSION_PATCH_DESCRIPTION,
- response = String.class),
- @ResponseHeader(
- name = VERSION_LATEST_NAME,
- description = VERSION_LATEST_DESCRIPTION,
- response = String.class),
- @ResponseHeader(
- name = REQUEST_ID_NAME,
- description = REQUEST_ID_HDR_DESCRIPTION,
- response = UUID.class)
- },
- extensions = {
- @Extension
- (
- name = EXTENSION_NAME,
- properties = {
- @ExtensionProperty(name = API_VERSION_NAME, value = API_VERSION),
- @ExtensionProperty(name = LAST_MOD_NAME, value = LAST_MOD_RELEASE)
- }
- )
- }
- )
- @ApiResponses(
- value = {
- @ApiResponse(code = AUTHENTICATION_ERROR_CODE, message = AUTHENTICATION_ERROR_MESSAGE),
- @ApiResponse(code = AUTHORIZATION_ERROR_CODE, message = AUTHORIZATION_ERROR_MESSAGE),
- @ApiResponse(code = SERVER_ERROR_CODE, message = SERVER_ERROR_MESSAGE)
- }
- )
- // @formatter:on
- public ResponseEntity<TypedSimpleResponse<Participant>> update(
- @RequestHeader(name = REQUEST_ID_NAME, required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
- @ApiParam(value = "Body of a participant", required = true) @RequestBody Participant body) {
-
- return ResponseEntity
- .ok()
- .headers(super.getCommonHeaders(requestId))
- .body(getSimulationProvider().updateParticipant(body));
- }
-}
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/resources/config/application.yaml b/participant/participant-impl/participant-impl-simulator/src/main/resources/config/application.yaml
deleted file mode 100644
index e20f0ebf5..000000000
--- a/participant/participant-impl/participant-impl-simulator/src/main/resources/config/application.yaml
+++ /dev/null
@@ -1,37 +0,0 @@
-spring:
- security:
- user:
- name: runtimeUser
- password: zb!XztG34
-
-server:
- port: 8084
- servlet:
- context-path: /onap/participantsim
- error:
- path: /error
-
-participant:
- intermediaryParameters:
- reportingTimeIntervalMs: 60000
- description: Participant Description
- participantId:
- name: org.onap.PM_CDS_Blueprint
- version: 1.0.0
- participantType:
- name: org.onap.PM_CDS_Blueprint
- version: 1.0.0
- clampAutomationCompositionTopics:
- topicSources:
- -
- topic: POLICY-ACRUNTIME-PARTICIPANT
- servers:
- - ${topicServer:localhost}
- topicCommInfrastructure: dmaap
- fetchTimeout: 15000
- topicSinks:
- -
- topic: POLICY-ACRUNTIME-PARTICIPANT
- servers:
- - ${topicServer:localhost}
- topicCommInfrastructure: dmaap
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/resources/version.txt b/participant/participant-impl/participant-impl-simulator/src/main/resources/version.txt
deleted file mode 100644
index 5fcdcab5a..000000000
--- a/participant/participant-impl/participant-impl-simulator/src/main/resources/version.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-ONAP Tosca defined automation composition Participant
-Version: ${project.version}
-Built (UTC): ${maven.build.timestamp}
-ONAP https://wiki.onap.org