@Test public void testGetException() { Status badRequest = new Status(StatusCode.BADREQUEST); Status conflict = new Status(StatusCode.CONFLICT); Status notAcceptable = new Status(StatusCode.NOTACCEPTABLE); Status notFound = new Status(StatusCode.NOTFOUND); Status internalError = new Status(StatusCode.INTERNALERROR); assertEquals(HttpURLConnection.HTTP_BAD_REQUEST, BaseHandler.getException(badRequest)); assertEquals(HttpURLConnection.HTTP_CONFLICT, BaseHandler.getException(conflict)); assertEquals(HttpURLConnection.HTTP_NOT_ACCEPTABLE, BaseHandler.getException(notAcceptable)); assertEquals(HttpURLConnection.HTTP_NOT_FOUND, BaseHandler.getException(notFound)); assertEquals(HttpURLConnection.HTTP_INTERNAL_ERROR, BaseHandler.getException(internalError)); }
protected static final int getException(Status status) { int result = HttpURLConnection.HTTP_INTERNAL_ERROR; assert !status.isSuccess(); StatusCode code = status.getCode(); logger.debug(" Execption code - {}, description - {}", code, status.getDescription()); if (code == StatusCode.BADREQUEST) { result = HttpURLConnection.HTTP_BAD_REQUEST; } else if (code == StatusCode.CONFLICT) { result = HttpURLConnection.HTTP_CONFLICT; } else if (code == StatusCode.NOTACCEPTABLE) { result = HttpURLConnection.HTTP_NOT_ACCEPTABLE; } else if (code == StatusCode.NOTFOUND) { result = HttpURLConnection.HTTP_NOT_FOUND; } else { result = HttpURLConnection.HTTP_INTERNAL_ERROR; } return result; }
BaseHandler { protected static final int getException(Status status) { int result = HttpURLConnection.HTTP_INTERNAL_ERROR; assert !status.isSuccess(); StatusCode code = status.getCode(); logger.debug(" Execption code - {}, description - {}", code, status.getDescription()); if (code == StatusCode.BADREQUEST) { result = HttpURLConnection.HTTP_BAD_REQUEST; } else if (code == StatusCode.CONFLICT) { result = HttpURLConnection.HTTP_CONFLICT; } else if (code == StatusCode.NOTACCEPTABLE) { result = HttpURLConnection.HTTP_NOT_ACCEPTABLE; } else if (code == StatusCode.NOTFOUND) { result = HttpURLConnection.HTTP_NOT_FOUND; } else { result = HttpURLConnection.HTTP_INTERNAL_ERROR; } return result; } }
BaseHandler { protected static final int getException(Status status) { int result = HttpURLConnection.HTTP_INTERNAL_ERROR; assert !status.isSuccess(); StatusCode code = status.getCode(); logger.debug(" Execption code - {}, description - {}", code, status.getDescription()); if (code == StatusCode.BADREQUEST) { result = HttpURLConnection.HTTP_BAD_REQUEST; } else if (code == StatusCode.CONFLICT) { result = HttpURLConnection.HTTP_CONFLICT; } else if (code == StatusCode.NOTACCEPTABLE) { result = HttpURLConnection.HTTP_NOT_ACCEPTABLE; } else if (code == StatusCode.NOTFOUND) { result = HttpURLConnection.HTTP_NOT_FOUND; } else { result = HttpURLConnection.HTTP_INTERNAL_ERROR; } return result; }  }
BaseHandler { protected static final int getException(Status status) { int result = HttpURLConnection.HTTP_INTERNAL_ERROR; assert !status.isSuccess(); StatusCode code = status.getCode(); logger.debug(" Execption code - {}, description - {}", code, status.getDescription()); if (code == StatusCode.BADREQUEST) { result = HttpURLConnection.HTTP_BAD_REQUEST; } else if (code == StatusCode.CONFLICT) { result = HttpURLConnection.HTTP_CONFLICT; } else if (code == StatusCode.NOTACCEPTABLE) { result = HttpURLConnection.HTTP_NOT_ACCEPTABLE; } else if (code == StatusCode.NOTFOUND) { result = HttpURLConnection.HTTP_NOT_FOUND; } else { result = HttpURLConnection.HTTP_INTERNAL_ERROR; } return result; }  IContainerManager getContainerManager(); void unsetContainerManager(IContainerManager s); void setContainerManager(IContainerManager s); IForwardingRulesManager getForwardingRulesManager(); void unsetForwardingRulesManager(IForwardingRulesManager s); void setForwardingRulesManager(IForwardingRulesManager s); OVSDBConfigService getOVSDBConfigService(); void unsetOVSDBConfigService(OVSDBConfigService s); void setOVSDBConfigService(OVSDBConfigService s); IConnectionServiceInternal getConnectionService(); void unsetConnectionService(IConnectionServiceInternal s); void setConnectionService(IConnectionServiceInternal s); INeutronPortCRUD getNeutronPortCRUD(); void unsetNeutronPortCRUD(INeutronPortCRUD s); void setNeutronPortCRUD(INeutronPortCRUD s); INeutronSubnetCRUD getNeutronSubnetCRUD(); void unsetNeutronSubnetCRUD(INeutronSubnetCRUD s); void setNeutronSubnetCRUD(INeutronSubnetCRUD s); INeutronNetworkCRUD getNeutronNetworkCRUD(); void unsetNeutronNetworkCRUD(INeutronNetworkCRUD s); void setNeutronNetworkCRUD(INeutronNetworkCRUD s); }
BaseHandler { protected static final int getException(Status status) { int result = HttpURLConnection.HTTP_INTERNAL_ERROR; assert !status.isSuccess(); StatusCode code = status.getCode(); logger.debug(" Execption code - {}, description - {}", code, status.getDescription()); if (code == StatusCode.BADREQUEST) { result = HttpURLConnection.HTTP_BAD_REQUEST; } else if (code == StatusCode.CONFLICT) { result = HttpURLConnection.HTTP_CONFLICT; } else if (code == StatusCode.NOTACCEPTABLE) { result = HttpURLConnection.HTTP_NOT_ACCEPTABLE; } else if (code == StatusCode.NOTFOUND) { result = HttpURLConnection.HTTP_NOT_FOUND; } else { result = HttpURLConnection.HTTP_INTERNAL_ERROR; } return result; }  IContainerManager getContainerManager(); void unsetContainerManager(IContainerManager s); void setContainerManager(IContainerManager s); IForwardingRulesManager getForwardingRulesManager(); void unsetForwardingRulesManager(IForwardingRulesManager s); void setForwardingRulesManager(IForwardingRulesManager s); OVSDBConfigService getOVSDBConfigService(); void unsetOVSDBConfigService(OVSDBConfigService s); void setOVSDBConfigService(OVSDBConfigService s); IConnectionServiceInternal getConnectionService(); void unsetConnectionService(IConnectionServiceInternal s); void setConnectionService(IConnectionServiceInternal s); INeutronPortCRUD getNeutronPortCRUD(); void unsetNeutronPortCRUD(INeutronPortCRUD s); void setNeutronPortCRUD(INeutronPortCRUD s); INeutronSubnetCRUD getNeutronSubnetCRUD(); void unsetNeutronSubnetCRUD(INeutronSubnetCRUD s); void setNeutronSubnetCRUD(INeutronSubnetCRUD s); INeutronNetworkCRUD getNeutronNetworkCRUD(); void unsetNeutronNetworkCRUD(INeutronNetworkCRUD s); void setNeutronNetworkCRUD(INeutronNetworkCRUD s);  }