policyNotifier.publish(notification);
}
- } catch (PfModelException e) {
+ } catch (PfModelException | RuntimeException e) {
logger.warn("failed to remove expired PDPs", e);
}
}
publish(notification);
- } catch (PfModelException e) {
+ } catch (PfModelException | RuntimeException e) {
logger.warn("cannot update deployment status", e);
}
}
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019,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.
import javax.ws.rs.core.Response.Status;
import org.apache.commons.lang3.tuple.Pair;
import org.onap.policy.models.base.PfModelException;
+import org.onap.policy.models.base.PfModelRuntimeException;
import org.onap.policy.models.pdp.concepts.Pdps;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
final Pair<Status, Pdps> pair = provider.fetchPdpGroupHealthStatus();
return addLoggingHeaders(addVersionControlHeaders(Response.status(pair.getLeft())), requestId)
.entity(pair.getRight()).build();
- } catch (final PfModelException exp) {
+ } catch (final PfModelException | PfModelRuntimeException exp) {
LOGGER.info("pdpGroup health check failed", exp);
return addLoggingHeaders(
addVersionControlHeaders(Response.status(exp.getErrorResponse().getResponseCode())), requestId)
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019,2021 Nordix Foundation.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property.
+ * Modifications Copyright (C) 2019, 2021 AT&T Intellectual Property.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import javax.ws.rs.core.Response.Status;
import org.apache.commons.lang3.tuple.Pair;
import org.onap.policy.models.base.PfModelException;
+import org.onap.policy.models.base.PfModelRuntimeException;
import org.onap.policy.models.pdp.concepts.PdpGroups;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
final Pair<Status, PdpGroups> pair = provider.fetchPdpGroupDetails();
return addLoggingHeaders(addVersionControlHeaders(Response.status(pair.getLeft())), requestId)
.entity(pair.getRight()).build();
- } catch (final PfModelException exp) {
+ } catch (final PfModelException | PfModelRuntimeException exp) {
LOGGER.info("group query failed", exp);
return addLoggingHeaders(
addVersionControlHeaders(Response.status(exp.getErrorResponse().getResponseCode())), requestId)
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019-2021 Nordix Foundation.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property.
+ * Modifications Copyright (C) 2019, 2021 AT&T Intellectual Property.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import javax.ws.rs.core.Response.Status;
import org.apache.commons.lang3.tuple.Pair;
import org.onap.policy.models.base.PfModelException;
+import org.onap.policy.models.base.PfModelRuntimeException;
import org.onap.policy.models.pap.concepts.PdpGroupStateChangeResponse;
import org.onap.policy.models.pdp.enums.PdpState;
import org.slf4j.Logger;
final Pair<Status, PdpGroupStateChangeResponse> pair = provider.changeGroupState(groupName, state);
return addLoggingHeaders(addVersionControlHeaders(Response.status(pair.getLeft())), requestId)
.entity(pair.getRight()).build();
- } catch (final PfModelException exp) {
+ } catch (final PfModelException | PfModelRuntimeException exp) {
LOGGER.info("group state-change failed", exp);
return addLoggingHeaders(
addVersionControlHeaders(Response.status(exp.getErrorResponse().getResponseCode())), requestId)
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Response;
import org.onap.policy.models.base.PfModelException;
+import org.onap.policy.models.base.PfModelRuntimeException;
import org.onap.policy.models.pdp.persistence.provider.PdpFilterParameters;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
.endTime(convertEpochtoInstant(endTime))
.build()))
.build();
- } catch (final PfModelException exp) {
+ } catch (final PfModelException | PfModelRuntimeException exp) {
LOGGER.info(GET_STATISTICS_ERR_MSG, exp);
return addLoggingHeaders(
addVersionControlHeaders(Response.status(exp.getErrorResponse().getResponseCode())), requestId)
.endTime(convertEpochtoInstant(endTime))
.build()))
.build();
- } catch (final PfModelException exp) {
+ } catch (final PfModelException | PfModelRuntimeException exp) {
LOGGER.info(GET_STATISTICS_ERR_MSG, exp);
return addLoggingHeaders(
addVersionControlHeaders(Response.status(exp.getErrorResponse().getResponseCode())), requestId)
.endTime(convertEpochtoInstant(endTime))
.build()))
.build();
- } catch (final PfModelException exp) {
+ } catch (final PfModelException | PfModelRuntimeException exp) {
LOGGER.info(GET_STATISTICS_ERR_MSG, exp);
return addLoggingHeaders(
addVersionControlHeaders(Response.status(exp.getErrorResponse().getResponseCode())), requestId)
.endTime(convertEpochtoInstant(endTime))
.build()))
.build();
- } catch (final PfModelException exp) {
+ } catch (final PfModelException | PfModelRuntimeException exp) {
LOGGER.info(GET_STATISTICS_ERR_MSG, exp);
return addLoggingHeaders(
addVersionControlHeaders(Response.status(exp.getErrorResponse().getResponseCode())), requestId)
LOGGER.info("Initial pdpGroup already exists in DB, skipping create - {} from {}",
pdpGroupsFromDb, groupsJson);
}
- } catch (final PfModelException | CoderException exp) {
+ } catch (final PfModelException | CoderException | RuntimeException exp) {
throw new PolicyPapException(exp);
}
}
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.policy.models.base.PfModelException;
+import org.onap.policy.models.base.PfModelRuntimeException;
import org.onap.policy.models.pdp.concepts.Pdp;
import org.onap.policy.models.pdp.concepts.PdpGroup;
import org.onap.policy.models.pdp.concepts.PdpMessage;
assertThatCode(map::removeExpiredPdps).doesNotThrowAnyException();
}
+ @Test
+ public void testRemoveExpiredPdps_DaoRtEx() throws Exception {
+ when(dao.getFilteredPdpGroups(any())).thenThrow(makeRuntimeException());
+
+ assertThatCode(map::removeExpiredPdps).doesNotThrowAnyException();
+ }
+
@Test
public void testRemoveFromSubgroup() throws Exception {
PdpGroup group = makeGroup(MY_GROUP);
return new PfModelException(Status.BAD_REQUEST, "expected exception");
}
+ protected PfModelRuntimeException makeRuntimeException() {
+ return new PfModelRuntimeException(Status.BAD_REQUEST, "expected exception");
+ }
+
@Test
public void testMakePdpRequests() {
// this should invoke the real method without throwing an exception