//Aai return bad response while checking names uniqueness
catch (exception : ExceptionWithRequestInfo) {
- Logger.error("Failed to check name uniqueness in AAI. VID will try again later", exception)
+ Logger.error(EELFLoggerDelegate.errorLogger, "Failed to check name uniqueness in AAI. VID will try again later", exception)
throw TryAgainException(exception);
}
//Vid reached to max retries while trying to find unique name in AAI
catch (exception : MaxRetriesException) {
- Logger.error("Failed to find unused name in AAI", exception)
+ Logger.error(EELFLoggerDelegate.errorLogger, "Failed to find unused name in AAI", exception)
throw AbortingException(exception);
}
}
try {
asyncInstantiationBL.updateServiceInfo(jobId) { x -> x.serviceInstanceName = serviceInstanceName }
} catch (e: Exception) {
- LOGGER.error("Failed updating service name {} in serviceInfo", serviceInstanceName, e)
+ LOGGER.error(EELFLoggerDelegate.errorLogger, "Failed updating service name {} in serviceInfo", serviceInstanceName, e)
}
return serviceInstanceName
fun handleResponse(sharedData: JobSharedData, msoResponse: RestObject<RequestReferencesContainer>, actionDescription: String): MsoResult {
return if (msoResponse.statusCode in 200..399) {
val msoResourceIds = MsoResourceIds(msoResponse.get().requestReferences.requestId, msoResponse.get().requestReferences.instanceId)
- LOGGER.debug("Successfully sent $actionDescription. Request id: ${msoResourceIds.requestId}")
+ LOGGER.debug(EELFLoggerDelegate.debugLogger, "Successfully sent $actionDescription. Request id: ${msoResourceIds.requestId}")
asyncInstantiationBL.addResourceInfo(sharedData, Job.JobStatus.IN_PROGRESS, msoResourceIds.instanceId)
MsoResult(Job.JobStatus.COMPLETED_WITH_NO_ACTION, msoResourceIds)
} else {
- LOGGER.debug("Failed to $actionDescription. Details: ${msoResponse.raw}")
+ LOGGER.debug(EELFLoggerDelegate.debugLogger, "Failed to $actionDescription. Details: ${msoResponse.raw}")
asyncInstantiationBL.addFailedResourceInfo(sharedData, msoResponse)
MsoResult(Job.JobStatus.FAILED)
}
jobStatus = comulateStatusAndUpdatePropertyIfFinal(jobStatus)
try {
- Logger.debug("job: ${this.javaClass.simpleName} ${sharedData.jobUuid} $actionPhase ${getActionType()} $internalState $jobStatus $childJobs")
+ Logger.debug(EELFLoggerDelegate.debugLogger, "job: ${this.javaClass.simpleName} ${sharedData.jobUuid} $actionPhase ${getActionType()} $internalState $jobStatus $childJobs")
} catch (e:Exception) { /* do nothing. Just failed to log...*/}
if (shallStopJob(jobStatus)) {
}
val (nextActionPhase, nextInternalState) = calcNextInternalState(jobStatus, internalState, actionPhase)
- Logger.debug("next state for job ${sharedData.jobUuid} is $nextInternalState")
+ Logger.debug(EELFLoggerDelegate.debugLogger, "next state for job ${sharedData.jobUuid} is $nextInternalState")
actionPhase = nextActionPhase
internalState = nextInternalState
}
jobStatus = getExternalInProgressStatus()
- Logger.debug("next status for job ${sharedData.jobUuid} is $jobStatus")
+ Logger.debug(EELFLoggerDelegate.debugLogger, "next status for job ${sharedData.jobUuid} is $jobStatus")
// if (internalState.immediate) return call() //shortcut instead of execute another command
return NextCommand(jobStatus, this)
}
JobStatus.IN_PROGRESS
}
catch (exception: AbortingException) {
- Logger.error("caught AbortingException. Set job status to FAILED")
+ Logger.error(EELFLoggerDelegate.errorLogger, "caught AbortingException. Set job status to FAILED")
JobStatus.FAILED;
}
}
try {
val requests = auditService.retrieveRequestsFromMsoByServiceIdAndRequestTypeAndScope(serviceInstanceId, requestType, scope)
if (requests.isEmpty() || requests[0].requestId == null) {
- LOGGER.error("Failed to retrieve requestId with type: $type, scope: $scope for service instanceId $serviceInstanceId ")
+ LOGGER.error(EELFLoggerDelegate.errorLogger, "Failed to retrieve requestId with type: $type, scope: $scope for service instanceId $serviceInstanceId ")
return Job.JobStatus.FAILED
}
val createMyselfCommand = planResumeMyselfRestCall(requests[0].requestId, sharedData.userId)
return executeAndHandleMsoInstanceRequest(createMyselfCommand)
} catch (exception: Exception) {
- LOGGER.error("Failed to resume instanceId $serviceInstanceId ", exception)
+ LOGGER.error(EELFLoggerDelegate.errorLogger, "Failed to resume instanceId $serviceInstanceId ", exception)
return Job.JobStatus.FAILED
}
}
val replaceMyselfCommand = planReplaceMyselfRestCall(commandParentData)
return executeAndHandleMsoInstanceRequest(replaceMyselfCommand)
} catch (exception: Exception) {
- LOGGER.error("Failed to replace instanceId ${getRequest().instanceId} ", exception)
+ LOGGER.error(EELFLoggerDelegate.errorLogger, "Failed to replace instanceId ${getRequest().instanceId} ", exception)
return Job.JobStatus.FAILED
}
}
try {
childJobs = pushChildrenJobsToBroker(vfModules.filter { filterModuleByNeedToCreateBase(it) }, dataForChild, JobType.VolumeGroupInstantiation)
} catch (e: AsdcCatalogException) {
- LOGGER.error("Failed to retrieve service definitions from SDC, for VfModule is BaseModule.. Error: " + e.message , e)
+ LOGGER.error(EELFLoggerDelegate.errorLogger, "Failed to retrieve service definitions from SDC, for VfModule is BaseModule.. Error: " + e.message , e)
//return Job.JobStatus.FAILED
throw e;
}
Trigger createTrigger() {
int minutes = new Random(System.nanoTime()).nextInt(59);
int hours = 6;
- logger.info("trigger for DeleteOldJobs is {}:{} ", hours, minutes);
+ logger.info(EELFLoggerDelegate.debugLogger, "trigger for DeleteOldJobs is {}:{} ", hours, minutes);
return TriggerBuilder.newTrigger()
.withIdentity("DeleteOldJobsTrigger")
@Override
protected void executeInternal(JobExecutionContext context) {
- LOGGER.info("delete old final jobs that has finished before {} seconds", secondsAgo);
+ LOGGER.info(EELFLoggerDelegate.debugLogger, "delete old final jobs that has finished before {} seconds", secondsAgo);
jobsBrokerService.deleteOldFinalJobs(secondsAgo);
}
final JobCommand jobCommand = jobCommandFactory.toCommand(job);
nextCommand = jobCommand.call();
} catch (Exception e) {
- LOGGER.error("error while executing job from queue: {}", e);
+ LOGGER.error(EELFLoggerDelegate.errorLogger, "error while executing job from queue: {}", e);
nextCommand = new NextCommand(FAILED);
}
package org.onap.vid.job.impl;
+import static org.onap.vid.job.Job.JobStatus.CREATING;
+import static org.onap.vid.job.Job.JobStatus.FINAL_STATUS;
+import static org.onap.vid.job.Job.JobStatus.IN_PROGRESS;
+import static org.onap.vid.job.Job.JobStatus.PENDING_RESOURCE;
+import static org.onap.vid.job.Job.JobStatus.RESOURCE_IN_PROGRESS;
+
+import java.sql.Timestamp;
+import java.time.LocalDateTime;
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+import java.util.Optional;
+import java.util.UUID;
+import java.util.stream.Collectors;
+import javax.annotation.PostConstruct;
import org.apache.commons.lang3.StringUtils;
import org.hibernate.SessionFactory;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
-import javax.annotation.PostConstruct;
-import java.sql.Timestamp;
-import java.time.LocalDateTime;
-import java.util.*;
-import java.util.stream.Collectors;
-
-import static org.onap.vid.job.Job.JobStatus.*;
-
@Service
public class JobsBrokerServiceInDatabaseImpl implements JobsBrokerService {
Integer age = jobDao.getAge();
jobDao.setAge(age + 1);
- logger.debug(EELFLoggerDelegate.debugLogger, "{}/{}", jobDao.getStatus(), jobDao.getType());
+ logger.debug(EELFLoggerDelegate.debugLogger, "pushing back jobDao {} of {}: {}/{}",
+ StringUtils.substring(String.valueOf(jobDao.getUuid()), 0, 8),
+ StringUtils.substring(String.valueOf(jobDao.getTemplateId()), 0, 8),
+ jobDao.getStatus(), jobDao.getType());
dataAccessService.saveDomainObject(jobDao, DaoUtils.getPropsMap());
}
"underDevelopment"
};
+ String [] testClassesToRunAlways = new String [] {
+ "LoggerFormatTest"
+ };
+
String [] classes1 = new String [] {
"AsyncInstantiationALaCarteApiTest"
};
if (methodClass.contains("org.onap.vid.api.Base")) return true;
+ for (c: testClassesToRunAlways) {
+ if (methodClass.endsWith(c)) return true; // repeat in any selectPart value
+ }
+
for (c: classes1) {
if (methodClass.endsWith(c)) return selectPart==1;
}