this.outStream = outStream;
// Editor parameter parsing
- final ApexEditorParameterParser parser = new ApexEditorParameterParser();
+ final var parser = new ApexEditorParameterParser();
try {
// Get and check the parameters
*/
public static void main(final String[] args) {
try {
- final ApexEditorMain editorMain = new ApexEditorMain(args, System.out);
+ final var editorMain = new ApexEditorMain(args, System.out);
editorMain.init();
} catch (final Exception e) {
LOGGER.error("start failed", e);
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2020 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.
throw new ApexEditorParameterException("invalid command line arguments specified : " + e.getMessage());
}
- final ApexEditorParameters parameters = new ApexEditorParameters();
+ final var parameters = new ApexEditorParameters();
final String[] remainingArgs = commandLine.getArgs();
if (commandLine.getArgs().length > 0) {
* @return the help
*/
public String getHelp(final String mainClassName) {
- final StringWriter stringWriter = new StringWriter();
- final PrintWriter stringPrintWriter = new PrintWriter(stringWriter);
+ final var stringWriter = new StringWriter();
+ final var stringPrintWriter = new PrintWriter(stringWriter);
- final HelpFormatter helpFormatter = new HelpFormatter();
+ final var helpFormatter = new HelpFormatter();
helpFormatter.printHelp(stringPrintWriter, COMMAND_HELP_MAX_LINE_WIDTH, mainClassName + " [options...] ", null,
options, 0, 1, "");
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2020-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.
* @return the string
*/
public String validate() {
- String validationMessage = "";
- validationMessage += validatePort();
- validationMessage += validateTimeToLive();
- validationMessage += validateUrl();
- validationMessage += validateUploadUrl();
- validationMessage += validateUploadUserid();
-
- return validationMessage;
+ return validatePort() + validateTimeToLive() + validateUrl() + validateUploadUrl() + validateUploadUserid();
}
/**
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2020 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.
return new ApexApiResult(Result.FAILED, "Session ID must be set to -1 to create sessions: " + sessionId);
}
- ApexApiResult result = new ApexApiResult();
+ var result = new ApexApiResult();
SESSION_HANDLER.createSession(result);
return result;
}
private ApexApiResult processRestCommand(final RestCommandType commandType, final RestCommand command) {
LOGGER.entry(commandType);
try {
- ApexApiResult result = new ApexApiResult();
+ var result = new ApexApiResult();
RestSession session = SESSION_HANDLER.getSession(sessionId, result);
if (session == null) {
return result;
final String jsonString) {
LOGGER.entry(commandType, jsonString);
try {
- ApexApiResult result = new ApexApiResult();
+ var result = new ApexApiResult();
RestSession session = SESSION_HANDLER.getSession(sessionId, result);
if (session == null) {
return result;
final String name, final String version) {
LOGGER.entry(commandType, name, version);
try {
- ApexApiResult result = new ApexApiResult();
+ var result = new ApexApiResult();
RestSession session = SESSION_HANDLER.getSession(sessionId, result);
if (session == null) {
return result;
* handling.
*/
protected static int createCorruptSession() {
- final ApexEditorRestResource apexEditorRestResource = new ApexEditorRestResource();
+ final var apexEditorRestResource = new ApexEditorRestResource();
final ApexApiResult result = apexEditorRestResource.createSession();
final int corruptSessionId = Integer.parseInt(result.getMessages().get(0));
session.editModel();
- final BeanContextAlbum jsonbean = RestUtils.getJsonParameters(jsonString, BeanContextAlbum.class);
+ final var jsonbean = RestUtils.getJsonParameters(jsonString, BeanContextAlbum.class);
ApexApiResult result = session.getApexModelEdited().createContextAlbum(jsonbean.getName(),
jsonbean.getVersion(), jsonbean.getScope(), Boolean.toString(jsonbean.getWriteable()),
session.editModel();
- final BeanContextAlbum jsonbean = RestUtils.getJsonParameters(jsonString, BeanContextAlbum.class);
+ final var jsonbean = RestUtils.getJsonParameters(jsonString, BeanContextAlbum.class);
ApexApiResult result = session.getApexModelEdited().updateContextAlbum(jsonbean.getName(),
jsonbean.getVersion(), jsonbean.getScope(), Boolean.toString(jsonbean.getWriteable()),
session.editModel();
- final BeanContextSchema jsonbean = RestUtils.getJsonParameters(jsonString, BeanContextSchema.class);
+ final var jsonbean = RestUtils.getJsonParameters(jsonString, BeanContextSchema.class);
ApexApiResult result = session.getApexModelEdited().createContextSchema(jsonbean.getName(),
jsonbean.getVersion(), jsonbean.getSchemaFlavour(), jsonbean.getSchemaDefinition(), jsonbean.getUuid(),
jsonbean.getDescription());
session.editModel();
- final BeanContextSchema jsonbean = RestUtils.getJsonParameters(jsonString, BeanContextSchema.class);
+ final var jsonbean = RestUtils.getJsonParameters(jsonString, BeanContextSchema.class);
ApexApiResult result = session.getApexModelEdited().updateContextSchema(jsonbean.getName(),
jsonbean.getVersion(), jsonbean.getSchemaFlavour(), jsonbean.getSchemaDefinition(), jsonbean.getUuid(),
private ApexApiResult createEvent(final RestSession session, final String jsonString) {
LOGGER.entry(jsonString);
- final BeanEvent jsonbean = RestUtils.getJsonParameters(jsonString, BeanEvent.class);
+ final var jsonbean = RestUtils.getJsonParameters(jsonString, BeanEvent.class);
session.editModel();
* @return result the result of the parameter creation operation
*/
private ApexApiResult createEventParameters(final RestSession session, final BeanEvent jsonbean) {
- ApexApiResult result = new ApexApiResult();
+ var result = new ApexApiResult();
if (jsonbean.getParameters() == null || jsonbean.getParameters().isEmpty()) {
return result;
private ApexApiResult updateEvent(final RestSession session, final String jsonString) {
LOGGER.entry(jsonString);
- final BeanEvent jsonbean = RestUtils.getJsonParameters(jsonString, BeanEvent.class);
+ final var jsonbean = RestUtils.getJsonParameters(jsonString, BeanEvent.class);
if (blank2Null(jsonbean.getName()) == null || blank2Null(jsonbean.getVersion()) == null) {
LOGGER.exit("Event/Update" + NOT_OK);
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019-2020 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.
private ApexApiResult createModel(final RestSession session, final String jsonString) {
LOGGER.entry(jsonString);
- final BeanModel jsonbean = RestUtils.getJsonParameters(jsonString, BeanModel.class);
+ final var jsonbean = RestUtils.getJsonParameters(jsonString, BeanModel.class);
session.editModel();
private ApexApiResult updateModel(final RestSession session, final String jsonString) {
LOGGER.entry(jsonString);
- final BeanModel jsonbean = RestUtils.getJsonParameters(jsonString, BeanModel.class);
+ final var jsonbean = RestUtils.getJsonParameters(jsonString, BeanModel.class);
session.editModel();
private String addKeyInfo2Message(final RestSession session, final String message) {
final Gson gson = new GsonBuilder().serializeNulls().enableComplexMapKeySerialization().create();
- JsonObject jsonObject = gson.fromJson(message, JsonObject.class);
+ var jsonObject = gson.fromJson(message, JsonObject.class);
if (jsonObject == null) {
return message;
}
String version = readFieldFromJsonObject(jsonObject, VERSION, null);
if (name == null && version == null) {
- JsonObject newJsonObject = getSubJsonObject(jsonObject);
+ var newJsonObject = getSubJsonObject(jsonObject);
if (newJsonObject != null) {
jsonObject = newJsonObject;
public ApexApiResult createPolicy(final RestSession session, final String jsonString) {
LOGGER.entry(jsonString);
- final BeanPolicy jsonbean = RestUtils.getJsonParameters(jsonString, BeanPolicy.class);
+ final var jsonbean = RestUtils.getJsonParameters(jsonString, BeanPolicy.class);
session.editModel();
* can be retrieved using {@link ApexApiResult#getMessages()}
*/
private ApexApiResult createPolicyContent(RestSession session, BeanPolicy jsonbean) {
- ApexApiResult result = new ApexApiResult();
+ var result = new ApexApiResult();
if (jsonbean.getStates() == null || jsonbean.getStates().isEmpty()) {
result.setResult(Result.FAILED);
private ApexApiResult createStateContextReferences(final RestSession session, final String policyName,
final String policyVersion, final String stateName, final BeanState stateBean) {
- ApexApiResult result = new ApexApiResult();
+ var result = new ApexApiResult();
final BeanKeyRef[] contextReferences = stateBean.getContexts();
if (contextReferences == null || contextReferences.length == 0) {
private ApexApiResult createStateFinalizers(final RestSession session, final String policyName,
final String policyVersion, final String stateName, final BeanState stateBean) {
- ApexApiResult result = new ApexApiResult();
+ var result = new ApexApiResult();
final Map<String, BeanLogic> finalizers = stateBean.getFinalizers();
if (finalizers == null || finalizers.isEmpty()) {
private ApexApiResult createStateOutputs(final RestSession session, final String policyName,
final String policyVersion, final String stateName, final BeanState stateBean) {
- ApexApiResult result = new ApexApiResult();
+ var result = new ApexApiResult();
final Map<String, BeanStateOutput> stateOutputs = stateBean.getStateOutputs();
if (stateOutputs == null || stateOutputs.isEmpty()) {
private ApexApiResult createStateTaskReferences(final RestSession session, final String policyName,
final String policyVersion, final String stateName, final BeanState stateBean) {
- ApexApiResult result = new ApexApiResult();
+ var result = new ApexApiResult();
final Map<String, BeanStateTaskRef> taskMap = stateBean.getTasks();
if (taskMap == null || taskMap.isEmpty()) {
LOGGER.entry(jsonString);
- final BeanPolicy jsonbean = RestUtils.getJsonParameters(jsonString, BeanPolicy.class);
+ final var jsonbean = RestUtils.getJsonParameters(jsonString, BeanPolicy.class);
if (blank2Null(jsonbean.getName()) == null || blank2Null(jsonbean.getVersion()) == null) {
LOGGER.exit("Task/Update" + NOT_OK);
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2020 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.
}
@SuppressWarnings("unchecked")
- Map<String, Object> apexEngineServiceParameterMap = (Map<String, Object>) toscaServiceTemplate
+ var apexEngineServiceParameterMap = (Map<String, Object>) toscaServiceTemplate
.getToscaTopologyTemplate().getPoliciesAsMap().values().iterator().next().getProperties()
.get(ENGINE_SERVICE_PARAMETERS);
ToscaPolicy ap = toscaServiceTemplate.getToscaTopologyTemplate().getPoliciesAsMap().values().iterator().next();
@SuppressWarnings("unchecked")
- Map<String, Object> apexEngineServiceParameterMap = (Map<String, Object>) ap.getProperties()
- .get(ENGINE_SERVICE_PARAMETERS);
+ var apexEngineServiceParameterMap = (Map<String, Object>) ap.getProperties().get(ENGINE_SERVICE_PARAMETERS);
Object decoded = null;
try {
apexEngineServiceParameterMap.put(POLICY_TYPE_IMPL, decoded);
- ApexApiResult result = new ApexApiResult();
+ var result = new ApexApiResult();
try {
result.addMessage(new StandardYamlCoder().encode(toscaServiceTemplate));
} catch (CoderException e) {
package org.onap.policy.gui.editors.apex.rest.handling;
import com.google.gson.GsonBuilder;
-import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonNull;
import com.google.gson.JsonObject;
return JsonNull.INSTANCE;
}
if (val.isJsonPrimitive() && ((JsonPrimitive) val).isString()) {
- final String v = ((JsonPrimitive) val).getAsString();
+ final var v = ((JsonPrimitive) val).getAsString();
if (v == null || "".equals(v)) {
return JsonNull.INSTANCE;
}
}
if (val.isJsonArray()) {
- final JsonArray arr = val.getAsJsonArray();
+ final var arr = val.getAsJsonArray();
for (int i = 0; i < arr.size(); i++) {
arr.set(i, blank2null(arr.get(i)));
}
}
if (val.isJsonObject()) {
- final JsonObject o = val.getAsJsonObject();
+ final var o = val.getAsJsonObject();
for (final Entry<String, JsonElement> e : o.entrySet()) {
e.setValue(blank2null(e.getValue()));
}
* @return a map of the JSON strings
*/
public static Map<String, String> getJsonParameters(final String jsonString) {
- final GsonBuilder gb = new GsonBuilder();
+ final var gb = new GsonBuilder();
gb.serializeNulls().enableComplexMapKeySerialization();
- final JsonObject jsonObject = gb.create().fromJson(jsonString, JsonObject.class);
+ final var jsonObject = gb.create().fromJson(jsonString, JsonObject.class);
final Map<String, String> jsonMap = new TreeMap<>();
for (final Entry<String, JsonElement> jsonEntry : jsonObject.entrySet()) {
* @return a map of the JSON strings
*/
public static <C extends BeanBase> C getJsonParameters(final String jsonString, final Class<C> clz) {
- final GsonBuilder gb = new GsonBuilder();
+ final var gb = new GsonBuilder();
gb.serializeNulls().enableComplexMapKeySerialization();
- final JsonObject jsonObject = gb.create().fromJson(jsonString, JsonObject.class);
+ final var jsonObject = gb.create().fromJson(jsonString, JsonObject.class);
for (final Entry<String, JsonElement> jsonEntry : jsonObject.entrySet()) {
final JsonElement val = jsonEntry.getValue();
} else {
return null;
}
- final StreamSource source = new StreamSource(new StringReader(jsonString));
+ final var source = new StreamSource(new StringReader(jsonString));
final JAXBElement<C> rootElement = unmarshaller.unmarshal(source, clz);
return rootElement.getValue();
}
* @return the JSO nfrom concept
*/
public static String getJsonfromConcept(final Object object) {
- final GsonBuilder gb = new GsonBuilder();
+ final var gb = new GsonBuilder();
gb.serializeNulls().enableComplexMapKeySerialization();
return gb.create().toJson(object);
}
private ApexApiResult createTask(final RestSession session, final String jsonString) {
LOGGER.entry(jsonString);
- final BeanTask jsonbean = RestUtils.getJsonParameters(jsonString, BeanTask.class);
+ final var jsonbean = RestUtils.getJsonParameters(jsonString, BeanTask.class);
session.editModel();
* @return the result of the operation
*/
private ApexApiResult createInputFields(final RestSession session, final BeanTask jsonbean) {
- ApexApiResult result = new ApexApiResult();
+ var result = new ApexApiResult();
if (jsonbean.getInputFields() == null || jsonbean.getInputFields().isEmpty()) {
return result;
* @return the result of the operation
*/
private ApexApiResult createOutputFields(final RestSession session, final BeanTask jsonbean) {
- ApexApiResult result = new ApexApiResult();
+ var result = new ApexApiResult();
if (jsonbean.getOutputFields() == null || jsonbean.getOutputFields().isEmpty()) {
return result;
* @return the result of the operation
*/
private ApexApiResult createTaskLogic(final RestSession session, final BeanTask jsonbean) {
- ApexApiResult result = new ApexApiResult();
+ var result = new ApexApiResult();
if (jsonbean.getTaskLogic() == null) {
return result;
* @return the result of the operation
*/
private ApexApiResult createTaskParameters(final RestSession session, final BeanTask jsonbean) {
- ApexApiResult result = new ApexApiResult();
+ var result = new ApexApiResult();
if (jsonbean.getParameters() == null || jsonbean.getParameters().isEmpty()) {
return result;
* @return the result of the operation
*/
private ApexApiResult createContextReferences(final RestSession session, final BeanTask jsonbean) {
- ApexApiResult result = new ApexApiResult();
+ var result = new ApexApiResult();
if (jsonbean.getContexts() == null || jsonbean.getContexts().length == 0) {
return result;
private ApexApiResult updateTask(final RestSession session, final String jsonString) {
LOGGER.entry(jsonString);
- final BeanTask jsonbean = RestUtils.getJsonParameters(jsonString, BeanTask.class);
+ final var jsonbean = RestUtils.getJsonParameters(jsonString, BeanTask.class);
if (blank2Null(jsonbean.getName()) == null || blank2Null(jsonbean.getVersion()) == null) {
LOGGER.exit("Task/Update" + NOT_OK);
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2020-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.
package org.onap.policy.gui.editors.apex.rest.handling.bean;
-import java.lang.reflect.Field;
import java.lang.reflect.Method;
/**
// Use field approach
if (field != null) {
try {
- final Field f = this.getClass().getDeclaredField(field);
+ final var f = this.getClass().getDeclaredField(field);
f.trySetAccessible();
return (String) (f.get(this));
} catch (final Exception e) {
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2020 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.
}
- final UploadPolicyRequestDto uploadPolicyRequestDto = new UploadPolicyRequestDto();
+ final var uploadPolicyRequestDto = new UploadPolicyRequestDto();
uploadPolicyRequestDto.setUserId(ApexEditorMain.getParameters().getUploadUserid());
uploadPolicyRequestDto
.setFileData(Base64.getEncoder().encodeToString(toscaServiceTemplate.getBytes(StandardCharsets.UTF_8)));
String.format("%s.%s.%s", policyModelUuid, policyModelKey.getName(), policyModelKey.getVersion()));
try {
- final Response response = ClientBuilder.newClient().target(ApexEditorMain.getParameters().getUploadUrl())
+ final var response = ClientBuilder.newClient().target(ApexEditorMain.getParameters().getUploadUrl())
.request(MediaType.APPLICATION_JSON)
.post(Entity.entity(uploadPolicyRequestDto, MediaType.APPLICATION_JSON));
if (response.getStatus() == 201) {
- final ApexApiResult apexApiResult = new ApexApiResult(Result.SUCCESS);
+ final var apexApiResult = new ApexApiResult(Result.SUCCESS);
String.format("uploading Policy '%s' to URL '%s' with userId '%s' was successful",
policyModelKey.getId(), ApexEditorMain.getParameters().getUploadUrl(),
ApexEditorMain.getParameters().getUploadUserid());
LOGGER.exit("Model/Upload: OK");
return apexApiResult;
} else {
- final ApexApiResult apexApiResult = new ApexApiResult(Result.FAILED);
+ final var apexApiResult = new ApexApiResult(Result.FAILED);
apexApiResult.addMessage(
String.format("uploading Policy '%s' to URL '%s' with userId '%s' failed with status %s",
policyModelKey.getId(), ApexEditorMain.getParameters().getUploadUrl(),
return apexApiResult;
}
} catch (Exception e) {
- final ApexApiResult apexApiResult = new ApexApiResult(Result.FAILED);
+ final var apexApiResult = new ApexApiResult(Result.FAILED);
apexApiResult
.addMessage(String.format("uploading Policy '%s' to URL '%s' with userId '%s' failed with error %s",
policyModelKey.getId(), ApexEditorMain.getParameters().getUploadUrl(),
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2020 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.
*/
private String runEditor(final String[] args) throws InterruptedException {
ParameterService.clear();
- final ByteArrayOutputStream outBaStream = new ByteArrayOutputStream();
- final PrintStream outStream = new PrintStream(outBaStream);
+ final var outBaStream = new ByteArrayOutputStream();
+ final var outStream = new PrintStream(outBaStream);
- final ApexEditorMain editorMain = new ApexEditorMain(args, outStream);
+ final var editorMain = new ApexEditorMain(args, outStream);
// This test must be started in a thread because we want to intercept the output
// in cases where the editor is
// started infinitely
- final Runnable testThread = new Runnable() {
+ final var testThread = new Runnable() {
@Override
public void run() {
editorMain.init();
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2020 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.
// Start the editor
editorMain = new ApexEditorMain(EDITOR_MAIN_ARGS, System.out);
// prevent a stray stdin value from killing the editor
- final ByteArrayInputStream input = new ByteArrayInputStream("".getBytes());
+ final var input = new ByteArrayInputStream("".getBytes());
System.setIn(input);
// Init the editor in a separate thread
- final Runnable testThread = new Runnable() {
+ final var testThread = new Runnable() {
@Override
public void run() {
editorMain.init();
import java.util.concurrent.TimeUnit;
import lombok.Getter;
import lombok.ToString;
-import org.onap.policy.common.parameters.ValidationResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public PdpMonitoringMain(final String[] args) {
// Server parameter parsing
- final PdpMonitoringServerParameterParser parser = new PdpMonitoringServerParameterParser();
+ final var parser = new PdpMonitoringServerParameterParser();
try {
// Get and check the parameters
}
// Validate the parameters
- final ValidationResult validationResult = parameters.validate();
+ final var validationResult = parameters.validate();
if (!validationResult.isValid()) {
throw new PdpMonitoringServerParameterException(
PDP_MONITORING_PREFIX + this + ") parameters invalid, " + validationResult.getResult() + '\n'
*/
public static void main(final String[] args) {
try {
- final PdpMonitoringMain main = new PdpMonitoringMain(args);
+ final var main = new PdpMonitoringMain(args);
main.init();
} catch (final Exception e) {
LOGGER.error("start failed", e);
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2020 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.
throw new PdpMonitoringServerParameterException("invalid command line arguments specified", e);
}
- final PdpMonitoringServerParameters parameters = new PdpMonitoringServerParameters();
+ final var parameters = new PdpMonitoringServerParameters();
final String[] remainingArgs = commandLine.getArgs();
if (commandLine.getArgs().length > 0) {
* @return help string
*/
public String getHelp(final String mainClassName) {
- final StringWriter stringWriter = new StringWriter();
- final PrintWriter stringPrintWriter = new PrintWriter(stringWriter);
+ final var stringWriter = new StringWriter();
+ final var stringPrintWriter = new PrintWriter(stringWriter);
final HelpFormatter helpFormatter = new HelpFormatter();
helpFormatter.printHelp(stringPrintWriter, 120, mainClassName + " [options...] ", "", options, 0, 0, "");
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2020-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.
@QueryParam("username") final String username, @QueryParam("password") final String password,
@QueryParam("id") final String id) throws HttpClientConfigException, CoderException {
- PdpGroups pdpGroups = getHttpClient(useHttps, hostname, port, username, password, "policy/pap/v1/pdps").get()
+ var pdpGroups = getHttpClient(useHttps, hostname, port, username, password, "policy/pap/v1/pdps").get()
.readEntity(PdpGroups.class);
String groupName;
String subGroup;
.filter(instance -> instance.getInstanceId().equals(instanceId)))
.filter(Objects::nonNull).findFirst().orElseThrow();
- final StatisticsResponse responseObject = new StatisticsResponse();
+ final var responseObject = new StatisticsResponse();
// Engine Service data
responseObject.setEngineId(pdp.getInstanceId());
private HttpClient getHttpClient(String useHttps, String hostname, int port, String username, String password,
String basePath) throws HttpClientConfigException {
- BusTopicParams busParams = new BusTopicParams();
+ var busParams = new BusTopicParams();
busParams.setClientName("pdp-monitoring");
busParams.setHostname(hostname);
busParams.setManaged(false);
public void testMonitoringForeverStart() {
final String[] eventArgs = {"-t", "-1"};
- PdpMonitoringMain monRestMain = new PdpMonitoringMain(eventArgs);
+ var monRestMain = new PdpMonitoringMain(eventArgs);
Thread monThread = new Thread() {
@Override
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2020 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.
@Test
public void test() {
- PdpMonitoringServerParameters parameters = new PdpMonitoringServerParameters();
+ var parameters = new PdpMonitoringServerParameters();
parameters.setPort(12345);
assertEquals(12345, parameters.getPort());
}