* ONAP Policy API
* ================================================================================
* Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2020 Bell Canada.
+ * Modifications Copyright (C) 2020-2021 Bell Canada.
* ================================================================================
* 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.api.main.rest;
+import lombok.AccessLevel;
import lombok.Getter;
+import lombok.NoArgsConstructor;
/**
* Class to hold statistical data for API access.
*
* @author Chenfei Gao (cgao@research.att.com)
*/
-public class ApiStatisticsManager {
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class ApiStatisticsManager {
@Getter
private static long totalApiCallCount;
@Getter
private static long policyTypeDeleteFailureCount;
- private ApiStatisticsManager() {
- throw new IllegalStateException("Instantiation of the class is not allowed");
- }
-
/**
* Method to update the total api call count.
*
* ONAP Policy API
* ================================================================================
* Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2021 Bell Canada. 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.
* @author Chenfei Gao (cgao@research.att.com)
*/
@ToString
+@Getter
+@Setter
public class StatisticsReport {
-
- @Getter
- @Setter
private int code;
-
- @Getter
- @Setter
private long totalApiCallCount;
-
- @Getter
- @Setter
private long apiCallSuccessCount;
-
- @Getter
- @Setter
private long apiCallFailureCount;
-
- @Getter
- @Setter
private long totalPolicyGetCount;
-
- @Getter
- @Setter
private long totalPolicyPostCount;
-
- @Getter
- @Setter
private long totalPolicyTypeGetCount;
-
- @Getter
- @Setter
private long totalPolicyTypePostCount;
-
- @Getter
- @Setter
private long policyGetSuccessCount;
-
- @Getter
- @Setter
private long policyGetFailureCount;
-
- @Getter
- @Setter
private long policyPostSuccessCount;
-
- @Getter
- @Setter
private long policyPostFailureCount;
-
- @Getter
- @Setter
private long policyTypeGetSuccessCount;
-
- @Getter
- @Setter
private long policyTypeGetFailureCount;
-
- @Getter
- @Setter
private long policyTypePostSuccessCount;
-
- @Getter
- @Setter
private long policyTypePostFailureCount;
}
* ================================================================================
* Copyright (C) 2018 Samsung Electronics Co., Ltd. All rights reserved.
* Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2021 Bell Canada. 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.api.main.startstop;
+import lombok.Getter;
+import lombok.Setter;
import org.onap.policy.api.main.exception.PolicyApiException;
import org.onap.policy.api.main.parameters.ApiParameterGroup;
import org.onap.policy.api.main.rest.ApiRestController;
private static final Logger LOGGER = LoggerFactory.getLogger(ApiActivator.class);
+ @Getter
private final ApiParameterGroup apiParameterGroup;
+ @Getter
+ @Setter
private static boolean alive = false;
private RestServer restServer;
}
}
- /**
- * Get the parameters used by the activator.
- *
- * @return the parameters of the activator
- */
- public ApiParameterGroup getParameterGroup() {
- return apiParameterGroup;
- }
-
/**
* Method to register the parameters to Common Parameter Service.
*
ParameterService.deregister(apiParameterGroup.getName());
}
}
-
- /**
- * Returns the alive status of api service.
- *
- * @return the alive
- */
- public static boolean isAlive() {
- return alive;
- }
-
- /**
- * Change the alive status of api service.
- *
- * @param status the status
- */
- public static void setAlive(final boolean status) {
- alive = status;
- }
}
\ No newline at end of file
* ================================================================================
* Copyright (C) 2018 Samsung Electronics Co., Ltd. All rights reserved.
* Modifications Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
+ * Modifications Copyright (C) 2020-2021 Bell Canada. All rights reserved.
* Modifications Copyright (C) 2021 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
package org.onap.policy.api.main.startstop;
import java.util.Arrays;
+import lombok.Getter;
import org.onap.policy.api.main.exception.PolicyApiException;
import org.onap.policy.api.main.exception.PolicyApiRuntimeException;
import org.onap.policy.api.main.parameters.ApiParameterGroup;
private ApiActivator activator;
// The parameters read in from JSON
+ @Getter
private ApiParameterGroup parameterGroup;
/**
LOGGER.info(successMsg);
}
- /**
- * Get the parameters specified in JSON.
- *
- * @return the parameters
- */
- public ApiParameterGroup getParameters() {
- return parameterGroup;
- }
-
/**
* Shut down Execution.
*
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Samsung Electronics Co., Ltd. All rights reserved.
* Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2021 Bell Canada. 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 ApiParameterGroup parGroup = new ApiParameterHandler().getParameters(arguments);
final ApiActivator activator = new ApiActivator(parGroup);
activator.initialize();
- assertTrue(activator.getParameterGroup().isValid());
- assertEquals(CommonTestData.API_GROUP_NAME, activator.getParameterGroup().getName());
+ assertTrue(activator.getApiParameterGroup().isValid());
+ assertEquals(CommonTestData.API_GROUP_NAME, activator.getApiParameterGroup().getName());
activator.terminate();
}
}
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Samsung Electronics Co., Ltd. All rights reserved.
* Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
+ * Modifications Copyright (C) 2020-2021 Bell Canada. 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.
"src/test/resources/parameters/ApiConfigParametersXXX.json", NetworkUtil.allocPort());
final String[] apiConfigParameters = {"-c", "src/test/resources/parameters/ApiConfigParametersXXX.json"};
final Main main = new Main(apiConfigParameters);
- assertTrue(main.getParameters().isValid());
- assertEquals(CommonTestData.API_GROUP_NAME, main.getParameters().getName());
+ assertTrue(main.getParameterGroup().isValid());
+ assertEquals(CommonTestData.API_GROUP_NAME, main.getParameterGroup().getName());
main.shutdown();
}