List of usage examples for org.apache.commons.httpclient HttpStatus SC_CONFLICT
int SC_CONFLICT
To view the source code for org.apache.commons.httpclient HttpStatus SC_CONFLICT.
Click Source Link
From source file:com.agile_coder.poker.server.stories.steps.SubmitASecondEstimateSteps.java
@Then("the second estimate is rejected") public void validate() { assertEquals(HttpStatus.SC_CONFLICT, result); }
From source file:com.agile_coder.poker.server.stories.steps.SubmitAfterRevealSteps.java
@Then("it is rejected") public void validate() { assertEquals(HttpStatus.SC_CONFLICT, result); }
From source file:com.agile_coder.poker.server.rest.EstimateRequestHandler.java
@PUT public Response addEstimate(@PathParam("session") final int session, @PathParam("name") String name, @PathParam("estimate") String estimate) { Session sess = SessionManager.getSession(session); try {/*from www . ja v a2s . c o m*/ Estimate estimateVal; if (isInteger(estimate)) { estimateVal = Estimate.fromInt(Integer.valueOf(estimate)); } else { estimateVal = Estimate.valueOf(estimate.toUpperCase()); } sess.addEstimate(name, estimateVal); } catch (SubmitException e) { return Response.serverError().status(HttpStatus.SC_CONFLICT).build(); } catch (IllegalArgumentException e) { return Response.serverError().status(HttpStatus.SC_CONFLICT).build(); } return Response.noContent().build(); }
From source file:com.agile_coder.poker.server.rest.EstimateRequestHandlerTest.java
@Test public void duplicateEstimate() { int sess = SessionManager.createSession(); final String estimate2 = "5"; EstimateRequestHandler handler = new EstimateRequestHandler(); handler.addEstimate(sess, NAME, ESTIMATE); Response resp = handler.addEstimate(sess, NAME, estimate2); assertEquals(HttpStatus.SC_CONFLICT, resp.getStatus()); }
From source file:net.sf.sail.webapp.domain.webservice.http.HttpGetRequestTest.java
public void testIsValidResponseStatus_shouldThrowHttpStatusCodeException() throws Exception { EasyMock.expect(method.getStatusText()).andReturn("whatever").anyTimes(); EasyMock.expect(method.getResponseBodyAsString()).andReturn("whatever").anyTimes(); EasyMock.replay(method);/*from ww w . j ava2 s .c o m*/ try { request.isValidResponseStatus(method, HttpStatus.SC_CONFLICT); fail("Expected HttpStatusCodeException to be thrown"); } catch (HttpStatusCodeException e) { } EasyMock.verify(method); }
From source file:com.bbva.arq.devops.ae.mirrorgate.jenkins.plugin.service.DefaultMirrorGateService.java
@Override public MirrorGateResponse publishBuildData(BuildDTO request) { try {/* w ww . jav a2 s. com*/ MirrorGateResponse callResponse = buildRestCall().makeRestCallPost( MirrorGateUtils.getMirrorGateAPIUrl() + "/api/builds", MirrorGateUtils.convertObjectToJson(request), MirrorGateUtils.getMirrorGateUser(), MirrorGateUtils.getMirrorGatePassword()); if (callResponse.getResponseCode() != HttpStatus.SC_CREATED) { LOG.log(Level.SEVERE, "MirrorGate: Build Publisher post may have failed. Response: {0}", callResponse.getResponseCode()); } return callResponse; } catch (IOException e) { LOG.log(Level.SEVERE, "MirrorGate: Error posting to mirrorGate", e); return new MirrorGateResponse(HttpStatus.SC_CONFLICT, ""); } }
From source file:net.sf.sail.webapp.domain.webservice.http.HttpGetCurnitMapRequestTest.java
public void testIsValidResponseStatus_shouldThrowCurnitMapNotFoundException() throws Exception { EasyMock.expect(method.getStatusText()).andReturn("whatever").anyTimes(); EasyMock.expect(method.getResponseBodyAsString()).andReturn("whatever").anyTimes(); EasyMock.replay(method);/*from ww w . jav a 2s . c o m*/ try { request.isValidResponseStatus(method, HttpStatus.SC_CONFLICT); fail("Expected CurnitMapNotFoundException to be thrown"); } catch (CurnitMapNotFoundException e) { } EasyMock.verify(method); }
From source file:com.agile_coder.poker.server.rest.EstimateRequestHandlerTest.java
@Test public void afterReveal() { int sess = SessionManager.createSession(); Session session = SessionManager.getSession(sess); session.reveal();// w w w. j a v a2 s.c o m EstimateRequestHandler handler = new EstimateRequestHandler(); Response resp = handler.addEstimate(sess, NAME, ESTIMATE); assertEquals(HttpStatus.SC_CONFLICT, resp.getStatus()); }
From source file:com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult.java
public void conflict(Localizable message) { this.message = message; httpCode = HttpStatus.SC_CONFLICT; }
From source file:com.owncloud.android.operations.CreateFolderOperation.java
/** * Performs the operation/*from ww w .j a v a 2 s . co m*/ * * @param client Client object to communicate with the remote ownCloud server. */ @Override protected RemoteOperationResult run(WebdavClient client) { RemoteOperationResult result = null; MkColMethod mkcol = null; try { mkcol = new MkColMethod(client.getBaseUri() + WebdavUtils.encodePath(mRemotePath)); int status = client.executeMethod(mkcol, READ_TIMEOUT, CONNECTION_TIMEOUT); if (!mkcol.succeeded() && mkcol.getStatusCode() == HttpStatus.SC_CONFLICT && mCreateFullPath) { result = createParentFolder(getParentPath(), client); status = client.executeMethod(mkcol, READ_TIMEOUT, CONNECTION_TIMEOUT); // second (and last) try } if (mkcol.succeeded()) { // Save new directory in local database OCFile newDir = new OCFile(mRemotePath); newDir.setMimetype("DIR"); long parentId = mStorageManager.getFileByPath(getParentPath()).getFileId(); newDir.setParentId(parentId); newDir.setModificationTimestamp(System.currentTimeMillis()); mStorageManager.saveFile(newDir); } result = new RemoteOperationResult(mkcol.succeeded(), status, mkcol.getResponseHeaders()); Log_OC.d(TAG, "Create directory " + mRemotePath + ": " + result.getLogMessage()); client.exhaustResponse(mkcol.getResponseBodyAsStream()); } catch (Exception e) { result = new RemoteOperationResult(e); Log_OC.e(TAG, "Create directory " + mRemotePath + ": " + result.getLogMessage(), e); } finally { if (mkcol != null) mkcol.releaseConnection(); } return result; }