throw new HttpException(rc, "Status Code=" + rc + ", Status Line=" + responseListener.getReason() + ", Response=" + responseListener.getResponseBody());
/** * URL with context path and index.html reference * * <pre> * http://localhost:9999/bigdata/index.html * </pre> * * This URL does NOT get mapped to anything (404). */ public void test_webapp_structure_contextPath_indexHtml() throws Exception { try { doGET(m_serviceURL + "/index.html"); } catch (HttpException ex) { assertEquals(404, ex.getStatusCode()); } }
/** * Variant for wrap and throw provides improved traces. * * @param cause */ public HttpException(final HttpException cause) { this(cause.statusCode, cause.getMessage()); }
return; default: throw new HttpException(listener.getStatus(), "status=" + listener.getStatus() + ", reason" + listener.getReason()); switch (ex.getStatusCode()) { case 404: // GONE throw new RemoteTransactionNotFoundException(txId,
return true; default: throw new HttpException(listener.getStatus(), "status=" + listener.getStatus() + ", reason" + listener.getReason()); switch (ex.getStatusCode()) { case 404: // GONE throw new RemoteTransactionNotFoundException(txId,
/** * Verify fail create properties if * properties are not compatible. */ public void test_getPreparedPropertiesCompatibility() throws Exception { String namespace = "newNamespace"; Properties properties = new Properties(); properties.put(RemoteRepository.OPTION_CREATE_KB_NAMESPACE, namespace); final Properties p = m_mgr.getPreparedProperties(namespace, properties); properties.put("com.bigdata.rdf.sail.truthMaintenance", "true"); properties.put("com.bigdata.rdf.store.AbstractTripleStore.quads", "true"); try { m_mgr.getPreparedProperties(namespace, properties); fail("Expecting: " + HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } catch (HttpException ex) { assertEquals(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, ex.getStatusCode()); } }
return; default: throw new HttpException(listener.getStatus(), "status=" + listener.getStatus() + ", reason" + listener.getReason()); switch (ex.getStatusCode()) { case 404: // GONE throw new RemoteTransactionNotFoundException(txId,
/** * Throw an exception if the status code does not indicate success. * * @param response * The response. * * @return The response. * * @throws IOException */ private static JettyResponseListener checkResponseCode(final String url, final JettyResponseListener response) throws IOException { final int rc = response.getStatus(); if (rc < 200 || rc >= 300) { throw new HttpException(rc, "StatusCode=" + rc + ", StatusLine=" + response.getReason() + ", headers=" + response.getHeaders().toString() + ", ResponseBody=" + response.getResponseBody()); } if (log.isDebugEnabled()) { /* * write out the status list, headers, etc. */ log.debug("*** Response ***"); log.debug("Status Line: " + response.getReason()); } return response; }
/** * URL with context path and index.html reference * * <pre> * http://localhost:9999/bigdata/index.html * </pre> * * This URL does NOT get mapped to anything (404). */ public void test_webapp_structure_contextPath_indexHtml() throws Exception { try { doGET(m_serviceURL + "/index.html"); } catch (HttpException ex) { assertEquals(404, ex.getStatusCode()); } }
/** * Throw an exception if the status code does not indicate success. * * @param response * The response. * * @return The response. * * @throws IOException */ private static JettyResponseListener checkResponseCode(final String url, final JettyResponseListener response) throws IOException { final int rc = response.getStatus(); if (rc < 200 || rc >= 300) { throw new HttpException(rc, "StatusCode=" + rc + ", StatusLine=" + response.getReason() + ", headers=" + response.getHeaders().toString() + ", ResponseBody=" + response.getResponseBody()); } if (log.isDebugEnabled()) { /* * write out the status list, headers, etc. */ log.debug("*** Response ***"); log.debug("Status Line: " + response.getReason()); } return response; }
/** * Test verifies rejecting an incorrect string as a namespace name. * * @throws Exception */ public void test_create03() throws Exception { final List<String> incorrectNamespaces = Arrays.asList("", "te.st"); for(String incorrectNamespace:incorrectNamespaces){ try { doTestCreate(incorrectNamespace); fail("Expecting: " + HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } catch (HttpException ex) { assertEquals(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, ex.getStatusCode()); } } }
return new RemoteTx(singleTxResponse(response)); default: throw new HttpException(listener.getStatus(), "status=" + listener.getStatus() + ", reason" + listener.getReason());
/** * URL with context path and index.html reference * * <pre> * http://localhost:9999/bigdata/index.html * </pre> * * This URL does NOT get mapped to anything (404). */ public void test_webapp_structure_contextPath_indexHtml() throws Exception { try { doGET(m_serviceURL + "/index.html"); } catch (HttpException ex) { assertEquals(404, ex.getStatusCode()); } }
/** * URL with context path and index.html reference * * <pre> * http://localhost:9999/bigdata/index.html * </pre> * * This URL does NOT get mapped to anything (404). */ public void test_webapp_structure_contextPath_indexHtml() throws Exception { try { doGET(m_serviceURL + "/index.html"); } catch (HttpException ex) { assertEquals(404, ex.getStatusCode()); } }
found = true; } catch (HttpException ex) { if (ex.getStatusCode() == HttpServletResponse.SC_NOT_FOUND) { found = false;
/** * Verify fail create properties if * properties are not compatible. */ public void test_getPreparedPropertiesCompatibility() throws Exception { String namespace = "newNamespace"; Properties properties = new Properties(); properties.put(RemoteRepository.OPTION_CREATE_KB_NAMESPACE, namespace); final Properties p = m_mgr.getPreparedProperties(namespace, properties); properties.put("com.bigdata.rdf.sail.truthMaintenance", "true"); properties.put("com.bigdata.rdf.store.AbstractTripleStore.quads", "true"); try { m_mgr.getPreparedProperties(namespace, properties); fail("Expecting: " + HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } catch (HttpException ex) { assertEquals(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, ex.getStatusCode()); } }
} catch (HttpException ex) { assertEquals(404, ex.getStatusCode());
/** * Test verifies rejecting an incorrect string as a namespace name. * * @throws Exception */ public void test_create03() throws Exception { final List<String> incorrectNamespaces = Arrays.asList("", "te.st"); for(String incorrectNamespace:incorrectNamespaces){ try { doTestCreate(incorrectNamespace); fail("Expecting: " + HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } catch (HttpException ex) { assertEquals(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, ex.getStatusCode()); } } }
switch (ex.getStatusCode()) { case 404: // GONE throw new RemoteTransactionNotFoundException(txId,
} catch (HttpException ex) { assertEquals(404,ex.getStatusCode()); assertEquals(HttpServletResponse.SC_CONFLICT, ex.getStatusCode()); } catch (HttpException ex) { assertEquals(BigdataServlet.HTTP_NOTFOUND, ex.getStatusCode()); } catch (HttpException ex) { assertEquals(BigdataServlet.HTTP_NOTFOUND, ex.getStatusCode()); } catch (HttpException ex) { assertEquals(BigdataServlet.HTTP_NOTFOUND, ex.getStatusCode()); } finally { if (result != null) } catch (HttpException ex) { assertEquals(BigdataServlet.HTTP_NOTFOUND, ex.getStatusCode());