diff options
author | Jerry Flood <jflood@att.com> | 2019-03-31 08:32:37 -0400 |
---|---|---|
committer | Jerry Flood <jflood@att.com> | 2019-03-31 08:41:13 -0400 |
commit | 80b3f339cadb72558feb0cadb249ce7046ce60ae (patch) | |
tree | 4a8b569c19959659ac628061e6ba386b3d6c1565 /cmso-service/src | |
parent | 9acaa2f04c92b6ffb0ae11a0f7b41aa260f2371d (diff) |
Commit 4 for Define OPtimizer API mS
Multiple commits required due to commit size limitation.
Change-Id: I351c5c47d628c253e84059d6e699f5a24748883f
Issue-ID: OPTFRA-437
Signed-off-by: Jerry Flood <jflood@att.com>
Diffstat (limited to 'cmso-service/src')
3 files changed, 34 insertions, 36 deletions
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")
|