List of usage examples for org.apache.commons.httpclient HttpStatus SC_BAD_REQUEST
int SC_BAD_REQUEST
To view the source code for org.apache.commons.httpclient HttpStatus SC_BAD_REQUEST.
Click Source Link
From source file:org.apache.falcon.regression.AuthorizationTest.java
@Test(enabled = false) public void u1ScheduleU2SuspendProcess() throws Exception { bundles[0].submitFeedsScheduleProcess(prism); AssertUtil.checkStatus(clusterOC, EntityType.PROCESS, bundles[0].getProcessData(), Job.Status.RUNNING); //try to suspend process by U2 final ServiceResponse serviceResponse = prism.getProcessHelper().suspend(bundles[0].getProcessData(), MerlinConstants.USER2_NAME); AssertUtil.assertFailedWithStatus(serviceResponse, HttpStatus.SC_BAD_REQUEST, "Process scheduled by first user should not be suspended by second user"); }
From source file:org.apache.falcon.regression.AuthorizationTest.java
/** * U2Resume test cases.//from ww w.j a v a 2 s.com */ //disabled since, falcon does not have authorization https://issues.apache // .org/jira/browse/FALCON-388 @Test(enabled = false) public void u1SuspendU2ResumeFeed() throws Exception { String feed = bundles[0].getInputFeedFromBundle(); //submit, schedule and then suspend feed by User1 bundles[0].submitClusters(prism); AssertUtil.assertSucceeded(prism.getFeedHelper().submitAndSchedule(feed)); AssertUtil.assertSucceeded(prism.getFeedHelper().suspend(feed)); AssertUtil.checkStatus(clusterOC, EntityType.FEED, feed, Job.Status.SUSPENDED); //try to resume feed by User2 final ServiceResponse serviceResponse = prism.getFeedHelper().resume(feed, MerlinConstants.USER2_NAME); AssertUtil.assertFailedWithStatus(serviceResponse, HttpStatus.SC_BAD_REQUEST, "Feed suspended by first user should not be resumed by second user"); }
From source file:org.apache.falcon.regression.AuthorizationTest.java
@Test(enabled = false) public void u1SuspendU2ResumeProcess() throws Exception { //submit, schedule, suspend process by U1 bundles[0].submitFeedsScheduleProcess(prism); AssertUtil.assertSucceeded(prism.getProcessHelper().suspend(bundles[0].getProcessData())); AssertUtil.checkStatus(clusterOC, EntityType.PROCESS, bundles[0].getProcessData(), Job.Status.SUSPENDED); //try to resume process by U2 final ServiceResponse serviceResponse = prism.getProcessHelper().resume(bundles[0].getProcessData(), MerlinConstants.USER2_NAME); AssertUtil.assertFailedWithStatus(serviceResponse, HttpStatus.SC_BAD_REQUEST, "Process suspended by first user should not be resumed by second user"); }
From source file:org.apache.falcon.regression.AuthorizationTest.java
/** * U2Update test cases.//from ww w . jav a 2s .c o m */ //disabled since, falcon does not have authorization https://issues.apache // .org/jira/browse/FALCON-388 @Test(enabled = false) public void u1SubmitU2UpdateFeed() throws URISyntaxException, IOException, AuthenticationException, JAXBException, InterruptedException { FeedMerlin feed = new FeedMerlin(bundles[0].getInputFeedFromBundle()); //submit feed bundles[0].submitClusters(prism); AssertUtil.assertSucceeded(prism.getFeedHelper().submitEntity(feed.toString())); String definition = prism.getFeedHelper().getEntityDefinition(feed.toString()).getMessage(); Assert.assertTrue(definition.contains(feed.getName()) && !definition.contains("(feed) not found"), "Feed should be already submitted"); //update feed definition FeedMerlin newFeed = new FeedMerlin(feed); newFeed.setFeedPathValue(baseTestDir + "/randomPath" + MINUTE_DATE_PATTERN); //try to update feed by U2 final ServiceResponse serviceResponse = prism.getFeedHelper().update(feed.toString(), newFeed.toString(), MerlinConstants.USER2_NAME); AssertUtil.assertFailedWithStatus(serviceResponse, HttpStatus.SC_BAD_REQUEST, "Feed submitted by first user should not be updated by second user"); }
From source file:org.apache.falcon.regression.AuthorizationTest.java
@Test(enabled = false) public void u1ScheduleU2UpdateFeed() throws Exception { FeedMerlin feed = new FeedMerlin(bundles[0].getInputFeedFromBundle()); //submit and schedule feed bundles[0].submitClusters(prism);//from ww w .j a v a 2 s . co m AssertUtil.assertSucceeded(prism.getFeedHelper().submitAndSchedule(feed.toString())); AssertUtil.checkStatus(clusterOC, EntityType.FEED, feed.toString(), Job.Status.RUNNING); //update feed definition FeedMerlin newFeed = new FeedMerlin(feed); newFeed.setFeedPathValue(baseTestDir + "/randomPath" + MINUTE_DATE_PATTERN); //try to update feed by U2 final ServiceResponse serviceResponse = prism.getFeedHelper().update(feed.toString(), newFeed.toString(), MerlinConstants.USER2_NAME); AssertUtil.assertFailedWithStatus(serviceResponse, HttpStatus.SC_BAD_REQUEST, "Feed scheduled by first user should not be updated by second user"); }
From source file:org.apache.falcon.regression.AuthorizationTest.java
@Test(enabled = false) public void u1SubmitU2UpdateProcess() throws Exception { bundles[0].setProcessValidity("2010-01-02T01:00Z", "2010-01-02T01:04Z"); String processName = bundles[0].getProcessName(); //submit process bundles[0].submitBundle(prism);//from w ww .j a v a 2s . c o m String definition = prism.getProcessHelper().getEntityDefinition(bundles[0].getProcessData()).getMessage(); Assert.assertTrue(definition.contains(processName) && !definition.contains("(process) not found"), "Process should be already submitted"); //update process definition bundles[0].setProcessValidity("2010-01-02T01:00Z", "2020-01-02T01:04Z"); //try to update process by U2 final ServiceResponse serviceResponse = prism.getProcessHelper().update(bundles[0].getProcessData(), bundles[0].getProcessData(), MerlinConstants.USER2_NAME); AssertUtil.assertFailedWithStatus(serviceResponse, HttpStatus.SC_BAD_REQUEST, "Process submitted by first user should not be updated by second user"); }
From source file:org.apache.falcon.regression.AuthorizationTest.java
@Test(enabled = false) public void u1ScheduleU2UpdateProcess() throws Exception { bundles[0].setProcessValidity("2010-01-02T01:00Z", "2010-01-02T01:04Z"); //submit, schedule process by U1 bundles[0].submitFeedsScheduleProcess(prism); AssertUtil.checkStatus(clusterOC, EntityType.PROCESS, bundles[0].getProcessData(), Job.Status.RUNNING); //update process definition bundles[0].setProcessValidity("2010-01-02T01:00Z", "2020-01-02T01:04Z"); //try to update process by U2 final ServiceResponse serviceResponse = prism.getProcessHelper().update(bundles[0].getProcessData(), bundles[0].getProcessData(), MerlinConstants.USER2_NAME); AssertUtil.assertFailedWithStatus(serviceResponse, HttpStatus.SC_BAD_REQUEST, "Process scheduled by first user should not be updated by second user"); }
From source file:org.apache.falcon.regression.FeedSubmitTest.java
/** * Submit a feed with the path for location-data type empty. Feed submit should fail. * *//from w w w . ja v a 2s. co m * @throws Exception */ @Test(groups = { "singleCluster" }) public void submitFeedWithEmptyDataPath() throws Exception { FeedMerlin feedObj = new FeedMerlin(feed); feedObj.setLocation(LocationType.DATA, ""); ServiceResponse response = prism.getFeedHelper().submitEntity(feedObj.toString()); AssertUtil.assertFailedWithStatus(response, HttpStatus.SC_BAD_REQUEST, "Can not create a Path from an empty string"); }
From source file:org.apache.falcon.regression.FeedSubmitTest.java
/** * Submit a feed with no location type data. Feed submit should fail. * */*from ww w.ja v a 2 s.c om*/ * @throws Exception */ @Test(groups = { "singleCluster" }) public void submitFeedWithNoDataPath() throws Exception { FeedMerlin feedObj = new FeedMerlin(feed); feedObj.getLocations().getLocations().set(0, null); ServiceResponse response = prism.getFeedHelper().submitEntity(feedObj.toString()); AssertUtil.assertFailedWithStatus(response, HttpStatus.SC_BAD_REQUEST, "FileSystem based feed but it doesn't contain location type - data"); }
From source file:org.apache.falcon.regression.lineage.LineageApiTest.java
@Test public void testVerticesFilterBlankValue() throws Exception { Map<String, String> params = new TreeMap<>(); params.put("key", Vertex.FilterKey.name.toString()); params.put("value", ""); HttpResponse response = lineageHelper .runGetRequest(lineageHelper.getUrl(LineageHelper.URL.VERTICES, params)); String responseString = lineageHelper.getResponseString(response); LOGGER.info(responseString);/* w ww.j av a 2 s. com*/ Assert.assertEquals(response.getStatusLine().getStatusCode(), HttpStatus.SC_BAD_REQUEST, "The get request was a bad request"); Assert.assertTrue(responseString.contains(INVALID_ARGUMENT_STR), "Result should contain string Invalid argument"); }