aboutsummaryrefslogtreecommitdiffstats
path: root/cmso-service
diff options
context:
space:
mode:
Diffstat (limited to 'cmso-service')
-rw-r--r--cmso-service/etc/config/optimizer.properties12
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementDetailDAOImpl.java22
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/optimizer/CmsoOptimizerClient.java12
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/optimizer/OptimizerQuartzJob.java36
4 files changed, 40 insertions, 42 deletions
diff --git a/cmso-service/etc/config/optimizer.properties b/cmso-service/etc/config/optimizer.properties
index 541946e..aa79e8a 100644
--- a/cmso-service/etc/config/optimizer.properties
+++ b/cmso-service/etc/config/optimizer.properties
@@ -30,11 +30,11 @@
#-------------------------------------------------------------------------------
## Loopback
-cmso.optimizer.request.url=http://localhost:8080/cmso/v1/loopbacktest/optimize/schedule
-cmso.optimizer.status.url=http://localhost:8080/cmso/v1/loopbacktest/optimize/schedule
-cmso.optimizer.health.url=http://localhost:8080/cmso/v1/loopbacktest/optimize/schedule/health
+#cmso.optimizer.request.url=http://localhost:8080/cmso/v1/loopbacktest/optimize/schedule
+#cmso.optimizer.status.url=http://localhost:8080/cmso/v1/loopbacktest/optimize/schedule
+#cmso.optimizer.health.url=http://localhost:8080/cmso/v1/loopbacktest/optimize/schedule/health
## Local optimizer service
-#cmso.optimizer.request.url=http://127.0.0.1:7997/optimizer/v1/optimize/schedule
-#cmso.optimizer.status.url=http://127.0.0.1:7997/optimizer/v1/optimize/schedule
-#cmso.optimizer.health.url=http://127.0.0.1:7997/optimizer/v1/health?checkInterfaces=true
+cmso.optimizer.request.url=http://127.0.0.1:7997/optimizer/v1/optimize/schedule
+cmso.optimizer.status.url=http://127.0.0.1:7997/optimizer/v1/optimize/schedule
+cmso.optimizer.health.url=http://127.0.0.1:7997/optimizer/v1/health?checkInterfaces=true
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementDetailDAOImpl.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementDetailDAOImpl.java
index 028241c..2543c77 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementDetailDAOImpl.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementDetailDAOImpl.java
@@ -1,27 +1,27 @@
/*
* Copyright © 2017-2018 AT&T Intellectual Property.
* Modifications Copyright © 2018 IBM.
- *
+ *
* 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.
- *
- *
+ *
+ *
* Unless otherwise specified, all documentation contained herein is licensed
* under the Creative Commons License, Attribution 4.0 Intl. (the "License");
* you may not use this documentation except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* https://creativecommons.org/licenses/by/4.0/
- *
+ *
* Unless required by applicable law or agreed to in writing, documentation
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -65,11 +65,13 @@ public class ChangeManagementDetailDAOImpl implements ChangeManagementDetailDAO
+ " left outer join APPROVAL_TYPES at on sa.approval_types_uuid = at.uuid ");
sql.append(where);
sql.append(" order by uuid ");
- if (limit > 0)
+ if (limit > 0) {
sql.append("LIMIT " + limit);
+ }
- Query q = manager.createNativeQuery(sql.toString(), ChangeManagementDetail.class);
- List<ChangeManagementDetail> list = q.getResultList();
+ Query query = manager.createNativeQuery(sql.toString(), ChangeManagementDetail.class);
+ @SuppressWarnings("unchecked")
+ List<ChangeManagementDetail> list = query.getResultList();
return list;
}
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/CmsoOptimizerClient.java b/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/CmsoOptimizerClient.java
index 4db44f6..1c3505e 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/CmsoOptimizerClient.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/CmsoOptimizerClient.java
@@ -180,8 +180,7 @@ public class CmsoOptimizerClient {
debug.debug("Successfully scheduled optimization: " + schedule.getScheduleId());
// Scheduled with optimizer
break;
- case 400: // Bad request
- {
+ case 400: {
schedule.setOptimizerDateTimeMillis(System.currentTimeMillis());
schedule.setOptimizerStatus("HTTP Status: " + response.getStatus());
String message = response.readEntity(String.class);
@@ -287,8 +286,7 @@ public class CmsoOptimizerClient {
debug.debug("Successfully retrieved optimization: " + schedule.getScheduleId());
optimizerHandler.handleOptimizerResponse(optimizerResponse, schedule);
break;
- default: // Bad request
- {
+ default: {
schedule.setOptimizerDateTimeMillis(System.currentTimeMillis());
schedule.setOptimizerStatus("HTTP Status: " + response.getStatus());
String message = response.readEntity(String.class);
@@ -336,8 +334,7 @@ public class CmsoOptimizerClient {
return null;
}
- private List<OptimizerElementInfo> marshallElements(SchedulingData info)
- {
+ private List<OptimizerElementInfo> marshallElements(SchedulingData info) {
List<OptimizerElementInfo> list = new ArrayList<>();
List<ElementInfo> elementList = info.getElements();
for (ElementInfo element : elementList) {
@@ -345,7 +342,7 @@ public class CmsoOptimizerClient {
optElement.setElementData(element.getElementData());
optElement.setElementId(element.getElementId());
optElement.setGroupId(element.getGroupId());
- list.add(optElement );
+ list.add(optElement);
}
return list;
}
@@ -375,6 +372,7 @@ public class CmsoOptimizerClient {
/**
* Health check.
+ *
* @return
*/
public HealthCheckComponent healthCheck() {
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/OptimizerQuartzJob.java b/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/OptimizerQuartzJob.java
index 48d6e73..71a2092 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/OptimizerQuartzJob.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/OptimizerQuartzJob.java
@@ -66,10 +66,9 @@ public class OptimizerQuartzJob extends QuartzJobBean {
private static EELFLogger log = EELFManager.getInstance().getLogger(OptimizerQuartzJob.class);
private static EELFLogger debug = EELFManager.getInstance().getDebugLogger();
private static EELFLogger errors = EELFManager.getInstance().getErrorLogger();
- private static EELFLogger metrics = EELFManager.getInstance().getMetricsLogger();
@Autowired
- ScheduleDAO scheduleDAO;
+ ScheduleDAO scheduleDao;
@Autowired
PropertiesManagement pm;
@@ -88,20 +87,20 @@ public class OptimizerQuartzJob extends QuartzJobBean {
// return;
try {
- // This job will look at the schedules waiting to go to Optimizer or waiting on response from optimizer
+ // This job will look at the schedules waiting to go to Optimizer or waiting on response from
+ // optimizer
// (PendingSchedule, PendingOptimizer),
// schedule the request and update the status to PendingSchedule
// and update the state to OptimizationInProgress
- List<Schedule> schedules = scheduleDAO.findByDomainStatus(DomainsEnum.ChangeManagement.toString(),
- CMSStatusEnum.PendingSchedule.toString());
+ List<Schedule> schedules = scheduleDao.findByDomainStatus(DomainsEnum.ChangeManagement.toString(),
+ CMSStatusEnum.PendingSchedule.toString());
for (Schedule s : schedules) {
scheduleOptimization(s);
}
- List<Schedule> inProgressSchedules = scheduleDAO.findByDomainStatus(DomainsEnum.ChangeManagement.toString(),
- CMSStatusEnum.OptimizationInProgress.toString());
- for (Schedule s : inProgressSchedules)
- {
- scheduleOptimization(s);
+ List<Schedule> inProgressSchedules = scheduleDao.findByDomainStatus(DomainsEnum.ChangeManagement.toString(),
+ CMSStatusEnum.OptimizationInProgress.toString());
+ for (Schedule s : inProgressSchedules) {
+ scheduleOptimization(s);
}
} catch (Exception e) {
@@ -136,7 +135,7 @@ public class OptimizerQuartzJob extends QuartzJobBean {
default: {
throw new SchedulerException(
- "Invalid return from dispach service: " + url + " : " + response.toString());
+ "Invalid return from dispach service: " + url + " : " + response.toString());
}
}
} catch (Exception e) {
@@ -149,18 +148,17 @@ public class OptimizerQuartzJob extends QuartzJobBean {
}
/**
- * According to the documentation I read, Quartz would queue a job without
- * waiting for the completion of the job with @DisallowConcurrentExecution to
- * complete so that there would be a backlog of triggers to process
+ * According to the documentation I read, Quartz would queue a job without waiting for the
+ * completion of the job with @DisallowConcurrentExecution to complete so that there would be a
+ * backlog of triggers to process
*
- * This was designed to spin though these stale triggers. When this didn't work,
- * I discovered that the behavior is that Quartz will wait for the appropriate
- * interval after @DisallowConcurrentExecution jobs complete.
+ * This was designed to spin though these stale triggers. When this didn't work, I discovered that
+ * the behavior is that Quartz will wait for the appropriate interval
+ * after @DisallowConcurrentExecution jobs complete.
*
* I tested by adding a sleep for an interval > the trigger interval
*
- * QUartz appears to do what makes sense. Leaving this here in case issues
- * arise...
+ * QUartz appears to do what makes sense. Leaving this here in case issues arise...
*
*/
@SuppressWarnings("unused")