-/**\r
- * ============LICENSE_START=======================================================\r
- * org.onap.aai\r
- * ================================================================================\r
- * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.\r
- * Copyright © 2017-2018 Amdocs\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-package org.onap.aai.datarouter.exception;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-\r
-import javax.ws.rs.core.Response;\r
-\r
-public class DataRouterExceptionTest {\r
-\r
- @Test\r
- public void testDataRouterError(){\r
- DataRouterError error1 = DataRouterError.DL_PARSE_100;\r
- Assert.assertEquals("DL-100", error1.getId());\r
- Assert.assertNotNull(error1.getMessage());\r
- Assert.assertEquals(Response.Status.BAD_REQUEST, error1.getHttpStatus());\r
- }\r
-\r
- @Test\r
- public void testBaseDataRouterException(){\r
- BaseDataRouterException exp1 = new BaseDataRouterException("id-1");\r
- Assert.assertEquals(exp1.getId(), "id-1");\r
-\r
- BaseDataRouterException exp2 = new BaseDataRouterException("id-1", "test-error");\r
- Assert.assertEquals(exp2.getId(), "id-1");\r
-\r
- BaseDataRouterException exp3 = new BaseDataRouterException("id-1", "test-error", new Throwable());\r
- Assert.assertEquals(exp3.getId(), "id-1");\r
- }\r
-}\r
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017-2018 Amdocs
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.aai.datarouter.exception;
+
+import javax.ws.rs.core.Response.Status;
+
+public class DataRouterException extends Exception {
+
+ private static final long serialVersionUID = 8162385108397238865L;
+
+ private Status httpStatus;
+
+ public DataRouterException() {
+ }
+
+ public DataRouterException(String message, Status httpStatus) {
+ super(message);
+ this.setHttpStatus(httpStatus);
+ }
+
+ public DataRouterException(Throwable cause) {
+ super(cause);
+ }
+
+ public DataRouterException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public DataRouterException(String message, Throwable cause, boolean enableSuppression,
+ boolean writableStackTrace) {
+ super(message, cause, enableSuppression, writableStackTrace);
+ }
+
+ public Status getHttpStatus() {
+ return httpStatus;
+ }
+
+ public void setHttpStatus(Status httpStatus) {
+ this.httpStatus = httpStatus;
+ }
+}