diff options
Diffstat (limited to 'adapters/mso-vfc-adapter/src/main/java')
4 files changed, 7 insertions, 15 deletions
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/CXFConfiguration.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/CXFConfiguration.java index ea1c3805d1..656a246afc 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/CXFConfiguration.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/CXFConfiguration.java @@ -21,22 +21,20 @@ package org.onap.so.adapters.vfc; import java.util.Arrays; -import javax.xml.ws.Endpoint; import org.apache.cxf.Bus; import org.apache.cxf.endpoint.Server; import org.apache.cxf.feature.LoggingFeature; import org.apache.cxf.jaxrs.JAXRSServerFactoryBean; import org.apache.cxf.jaxrs.swagger.Swagger2Feature; -import org.apache.cxf.jaxws.EndpointImpl; import org.apache.cxf.transport.servlet.CXFServlet; -import org.onap.so.adapters.vfc.rest.HealthCheckHandler; import org.onap.so.adapters.vfc.rest.VfcAdapterRest; import org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; + import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; @@ -49,9 +47,6 @@ public class CXFConfiguration { @Autowired private VfcAdapterRest vfcAdapterRest; - - @Autowired - private HealthCheckHandler healthCheckHandler; @Autowired private JaxRsFilterLogging jaxRsFilterLogging; @@ -68,7 +63,7 @@ public class CXFConfiguration { public Server rsServer() { JAXRSServerFactoryBean endpoint = new JAXRSServerFactoryBean(); endpoint.setBus(bus); - endpoint.setServiceBeans(Arrays.<Object>asList(vfcAdapterRest, healthCheckHandler)); + endpoint.setServiceBeans(Arrays.<Object>asList(vfcAdapterRest)); endpoint.setAddress("/"); endpoint.setFeatures(Arrays.asList(createSwaggerFeature(), new LoggingFeature())); endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(mapper),jaxRsFilterLogging)); diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/RequestDBConfig.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/RequestDBConfig.java index 2ff66d2c25..8db210f62a 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/RequestDBConfig.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/RequestDBConfig.java @@ -25,7 +25,7 @@ import javax.persistence.EntityManagerFactory; import javax.sql.DataSource; import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder; +import org.springframework.boot.jdbc.DataSourceBuilder; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder; import org.springframework.context.annotation.Bean; diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/VfcManager.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/VfcManager.java index 2dbc444bc3..86aba2f84b 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/VfcManager.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/VfcManager.java @@ -351,7 +351,8 @@ public class VfcManager { ValidateUtil.assertObjectNotNull(jobId); // Step 1: query the current resource operation status ResourceOperationStatus status = new ResourceOperationStatus(nsOperationKey.getServiceId(), nsOperationKey.getOperationId(), nsOperationKey.getNodeTemplateUUID()); - status = resourceOperationStatusRepository.findOne(Example.of(status)); + status = resourceOperationStatusRepository.findOne(Example.of(status)) + .orElseThrow( () -> new ApplicationException(404,"Cannot Find Operation Status")); // Step 2: start query LOGGER.info("query ns status -> begin"); String url = getUrl(jobId, CommonConstant.Step.QUERY); @@ -438,7 +439,8 @@ public class VfcManager { RestfulResponse scaleRsp = restfulUtil.send(url, methodType, scaleReq); ResourceOperationStatus status = new ResourceOperationStatus(segInput.getNsOperationKey().getServiceId(), segInput.getNsOperationKey().getOperationId(), segInput.getNsOperationKey().getNodeTemplateUUID()); - ResourceOperationStatus nsOperInfo = resourceOperationStatusRepository.findOne(Example.of(status)); + ResourceOperationStatus nsOperInfo = resourceOperationStatusRepository.findOne(Example.of(status)) + .orElseThrow( () -> new ApplicationException(404,"Cannot Find Operation Status")); ValidateUtil.assertObjectNotNull(scaleRsp); if(!HttpCode.isSucess(scaleRsp.getStatus())) { LOGGER.error("update segment operation status : fail to scale ns"); diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java index f6bf8b9fbf..bb7fa70bda 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java @@ -43,7 +43,6 @@ import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.util.EntityUtils; import org.onap.so.adapters.vfc.model.RestfulResponse; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoAlarmLogger; import org.onap.so.logger.MsoLogger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; @@ -66,8 +65,6 @@ public class RestfulUtil { */ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, RestfulUtil.class); - private static final MsoAlarmLogger ALARMLOGGER = new MsoAlarmLogger(); - private static final int DEFAULT_TIME_OUT = 60000; private static final String ONAP_IP = "ONAP_IP"; @@ -204,12 +201,10 @@ public class RestfulUtil { private static void logError(String errMsg, Throwable t) { LOGGER.error(MessageEnum.RA_NS_EXC, VFC_ADAPTER, "", MsoLogger.ErrorCode.AvailabilityError, errMsg, t); - ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, errMsg); } private static void logError(String errMsg) { LOGGER.error(MessageEnum.RA_NS_EXC, VFC_ADAPTER, "", MsoLogger.ErrorCode.AvailabilityError, errMsg); - ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, errMsg); } private static RestfulResponse createResponse(int statusCode, String content) { |