http://git-wip-us.apache.org/repos/asf/camel/blob/b51280c8/components/camel-box/src/test/java/org/apache/camel/component/box/IBoxCollaborationsManagerIntegrationTest.java ---------------------------------------------------------------------- diff --git a/components/camel-box/src/test/java/org/apache/camel/component/box/IBoxCollaborationsManagerIntegrationTest.java b/components/camel-box/src/test/java/org/apache/camel/component/box/IBoxCollaborationsManagerIntegrationTest.java deleted file mode 100644 index 2bcb34e..0000000 --- a/components/camel-box/src/test/java/org/apache/camel/component/box/IBoxCollaborationsManagerIntegrationTest.java +++ /dev/null @@ -1,153 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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. - */ - -/* - * Camel Api Route test generated by camel-component-util-maven-plugin - * Generated on: Tue Jun 24 22:42:08 PDT 2014 - */ -package org.apache.camel.component.box; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.box.boxjavalibv2.dao.BoxCollaboration; -import com.box.boxjavalibv2.dao.BoxCollaborationRole; -import com.box.boxjavalibv2.requests.requestobjects.BoxCollabRequestObject; -import com.box.boxjavalibv2.requests.requestobjects.BoxGetAllCollabsRequestObject; - -import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.component.box.internal.BoxApiCollection; -import org.apache.camel.component.box.internal.IBoxCollaborationsManagerApiMethod; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Test class for com.box.boxjavalibv2.resourcemanagers.IBoxCollaborationsManager APIs. - */ -public class IBoxCollaborationsManagerIntegrationTest extends AbstractBoxTestSupport { - - private static final Logger LOG = LoggerFactory.getLogger(IBoxCollaborationsManagerIntegrationTest.class); - private static final String PATH_PREFIX = BoxApiCollection.getCollection().getApiName(IBoxCollaborationsManagerApiMethod.class).getName(); - - private BoxCollaboration createCollaboration() throws InterruptedException { - final Map<String, Object> headers = new HashMap<String, Object>(); - // parameter type is String - headers.put("CamelBox.folderId", testFolderId); - // parameter type is com.box.boxjavalibv2.requests.requestobjects.BoxCollabRequestObject - final BoxCollabRequestObject collabObject = BoxCollabRequestObject.createCollabObject(testFolderId, null, - "camel.t...@localhost.com", BoxCollaborationRole.VIEWER); - headers.put("CamelBox.collabRequest", collabObject); - - BoxCollaboration result = requestBodyAndHeaders("direct://CREATECOLLABORATION", - null, headers); - assertNotNull("createCollaboration result", result); - // wait a moment for collaboration to register - Thread.sleep(2000); - return result; - } - - private void deleteCollaboration(String collabId) throws Exception { - - final Map<String, Object> headers = new HashMap<String, Object>(); - // parameter type is String - headers.put("CamelBox.collabId", collabId); - // parameter type is com.box.restclientv2.requestsbase.BoxDefaultRequestObject -// headers.put("CamelBox.defaultRequest", null); - requestBodyAndHeaders("direct://DELETECOLLABORATION", null, headers); - } - - @Test - public void testGetAllCollaborations() throws Exception { - // using com.box.boxjavalibv2.requests.requestobjects.BoxGetAllCollabsRequestObject message body for single parameter "getAllCollabsRequest" - final BoxGetAllCollabsRequestObject collabRequest = - BoxGetAllCollabsRequestObject.getAllCollaborationsRequestObject(BoxCollaboration.STATUS_PENDING); - - List result = requestBody("direct://GETALLCOLLABORATIONS", collabRequest); - assertNotNull("getAllCollaborations: ", result); - LOG.debug("getAllCollaborations: " + result); - } - - @Test - public void testGetCollaboration() throws Exception { - final BoxCollaboration collaboration = createCollaboration(); - - try { - final Map<String, Object> headers = new HashMap<String, Object>(); - // parameter type is String - headers.put("CamelBox.collabId", collaboration.getId()); - // parameter type is com.box.restclientv2.requestsbase.BoxDefaultRequestObject - headers.put("CamelBox.defaultRequest", null); - - BoxCollaboration result = requestBodyAndHeaders("direct://GETCOLLABORATION", null, headers); - assertNotNull("getCollaboration result", result); - LOG.debug("getCollaboration: " + result); - } finally { - deleteCollaboration(collaboration.getId()); - } - } - - @Test - public void testUpdateCollaboration() throws Exception { - final BoxCollaboration collaboration = createCollaboration(); - - try { - final Map<String, Object> headers = new HashMap<String, Object>(); - // parameter type is String - headers.put("CamelBox.collabId", collaboration.getId()); - // parameter type is com.box.boxjavalibv2.requests.requestobjects.BoxCollabRequestObject - final BoxCollabRequestObject requestObject = BoxCollabRequestObject.updateCollabObjects( - BoxCollaborationRole.EDITOR); - headers.put("CamelBox.collabRequest", requestObject); - - BoxCollaboration result = requestBodyAndHeaders("direct://UPDATECOLLABORATION", null, headers); - assertNotNull("updateCollaboration result", result); - LOG.debug("updateCollaboration: " + result); - } finally { - deleteCollaboration(collaboration.getId()); - } - } - - @Override - protected RouteBuilder createRouteBuilder() throws Exception { - return new RouteBuilder() { - public void configure() { - // test route for createCollaboration - from("direct://CREATECOLLABORATION") - .to("box://" + PATH_PREFIX + "/createCollaboration"); - - // test route for deleteCollaboration - from("direct://DELETECOLLABORATION") - .to("box://" + PATH_PREFIX + "/deleteCollaboration"); - - // test route for getAllCollaborations - from("direct://GETALLCOLLABORATIONS") - .to("box://" + PATH_PREFIX + "/getAllCollaborations?inBody=getAllCollabsRequest"); - - // test route for getCollaboration - from("direct://GETCOLLABORATION") - .to("box://" + PATH_PREFIX + "/getCollaboration"); - - // test route for updateCollaboration - from("direct://UPDATECOLLABORATION") - .to("box://" + PATH_PREFIX + "/updateCollaboration"); - - } - }; - } -}
http://git-wip-us.apache.org/repos/asf/camel/blob/b51280c8/components/camel-box/src/test/java/org/apache/camel/component/box/IBoxCommentsManagerIntegrationTest.java ---------------------------------------------------------------------- diff --git a/components/camel-box/src/test/java/org/apache/camel/component/box/IBoxCommentsManagerIntegrationTest.java b/components/camel-box/src/test/java/org/apache/camel/component/box/IBoxCommentsManagerIntegrationTest.java deleted file mode 100644 index 2b48517..0000000 --- a/components/camel-box/src/test/java/org/apache/camel/component/box/IBoxCommentsManagerIntegrationTest.java +++ /dev/null @@ -1,143 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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. - */ - -/* - * Camel Api Route test generated by camel-component-util-maven-plugin - * Generated on: Tue Jun 24 22:42:08 PDT 2014 - */ -package org.apache.camel.component.box; - -import java.util.HashMap; -import java.util.Map; - -import com.box.boxjavalibv2.dao.BoxComment; -import com.box.boxjavalibv2.dao.BoxResourceType; -import com.box.boxjavalibv2.requests.requestobjects.BoxCommentRequestObject; -import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.component.box.internal.BoxApiName; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Test class for com.box.boxjavalibv2.resourcemanagers.IBoxCommentsManager APIs. - */ -public class IBoxCommentsManagerIntegrationTest extends AbstractBoxTestSupport { - - private static final Logger LOG = LoggerFactory.getLogger(IBoxCommentsManagerIntegrationTest.class); - private static final String PATH_PREFIX = BoxApiName.COMMENTS.getName(); - - private BoxComment addComment() throws InterruptedException { - final BoxCommentRequestObject requestObject = - BoxCommentRequestObject.addCommentRequestObject(BoxResourceType.FILE, testFileId, "Camel was here!"); - - BoxComment result = requestBody("direct://ADDCOMMENT", requestObject); - assertNotNull("addComment result", result); - Thread.sleep(2000); - return result; - } - - @Test - public void testAddComment1() throws Exception { - final Map<String, Object> headers = new HashMap<String, Object>(); - // parameter type is String - headers.put("CamelBox.commentedItemId", testFileId); - // parameter type is com.box.boxjavalibv2.dao.IBoxType - headers.put("CamelBox.commentedItemType", BoxResourceType.FILE); - // parameter type is String - headers.put("CamelBox.message", "Camel was here!"); - - BoxComment result = requestBodyAndHeaders("direct://ADDCOMMENT_1", null, headers); - assertNotNull("addComment result", result); - LOG.debug("addComment: " + result); - - deleteComment(result.getId()); - } - - public void deleteComment(String commentId) throws Exception { - final Map<String, Object> headers = new HashMap<String, Object>(); - // parameter type is String - headers.put("CamelBox.commentId", commentId); - // parameter type is com.box.restclientv2.requestsbase.BoxDefaultRequestObject -// headers.put("CamelBox.defaultRequest", null); - requestBodyAndHeaders("direct://DELETECOMMENT", null, headers); - } - - @Test - public void testGetComment() throws Exception { - final BoxComment comment = addComment(); - try { - final Map<String, Object> headers = new HashMap<String, Object>(); - // parameter type is String - headers.put("CamelBox.commentId", comment.getId()); - // parameter type is com.box.restclientv2.requestsbase.BoxDefaultRequestObject -// headers.put("CamelBox.defaultRequest", null); - BoxComment result = requestBodyAndHeaders("direct://GETCOMMENT", null, headers); - - LOG.debug("getComment: " + result); - } finally { - deleteComment(comment.getId()); - } - } - - @Test - public void testUpdateComment() throws Exception { - final BoxComment comment = addComment(); - try { - final Map<String, Object> headers = new HashMap<String, Object>(); - // parameter type is String - headers.put("CamelBox.commentId", comment.getId()); - // parameter type is com.box.boxjavalibv2.requests.requestobjects.BoxCommentRequestObject - final BoxCommentRequestObject requestObject = - BoxCommentRequestObject.updateCommentRequestObject("Camel was here, again!"); - headers.put("CamelBox.commentRequest", requestObject); - BoxComment result = requestBodyAndHeaders("direct://UPDATECOMMENT", null, headers); - - LOG.debug("updateComment: " + result); - } finally { - deleteComment(comment.getId()); - } - } - - @Override - protected RouteBuilder createRouteBuilder() throws Exception { - return new RouteBuilder() { - public void configure() { - // test route for addComment - from("direct://ADDCOMMENT") - .to("box://" + PATH_PREFIX + "/addComment?inBody=commentRequest"); - - // test route for addComment - from("direct://ADDCOMMENT_1") - .to("box://" + PATH_PREFIX + "/addComment"); - - // test route for deleteComment - from("direct://DELETECOMMENT") - .to("box://" + PATH_PREFIX + "/deleteComment"); - - // test route for getComment - from("direct://GETCOMMENT") - .to("box://" + PATH_PREFIX + "/getComment"); - - // test route for updateComment - from("direct://UPDATECOMMENT") - .to("box://" + PATH_PREFIX + "/updateComment"); - - } - }; - } -} http://git-wip-us.apache.org/repos/asf/camel/blob/b51280c8/components/camel-box/src/test/java/org/apache/camel/component/box/IBoxEventsManagerIntegrationTest.java ---------------------------------------------------------------------- diff --git a/components/camel-box/src/test/java/org/apache/camel/component/box/IBoxEventsManagerIntegrationTest.java b/components/camel-box/src/test/java/org/apache/camel/component/box/IBoxEventsManagerIntegrationTest.java deleted file mode 100644 index 8096fc1..0000000 --- a/components/camel-box/src/test/java/org/apache/camel/component/box/IBoxEventsManagerIntegrationTest.java +++ /dev/null @@ -1,77 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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. - */ - -/* - * Camel Api Route test generated by camel-component-util-maven-plugin - * Generated on: Tue Jun 24 22:42:08 PDT 2014 - */ -package org.apache.camel.component.box; - -import com.box.boxjavalibv2.dao.BoxCollection; -import com.box.boxjavalibv2.dao.BoxEventCollection; -import com.box.boxjavalibv2.requests.requestobjects.BoxEventRequestObject; -import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.component.box.internal.BoxApiCollection; -import org.apache.camel.component.box.internal.IBoxEventsManagerApiMethod; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Test class for com.box.boxjavalibv2.resourcemanagers.IBoxEventsManager APIs. - */ -public class IBoxEventsManagerIntegrationTest extends AbstractBoxTestSupport { - - private static final Logger LOG = LoggerFactory.getLogger(IBoxEventsManagerIntegrationTest.class); - private static final String PATH_PREFIX = BoxApiCollection.getCollection().getApiName(IBoxEventsManagerApiMethod.class).getName(); - - @Test - public void testGetEventOptions() throws Exception { - // using com.box.restclientv2.requestsbase.BoxDefaultRequestObject message body for single parameter "defaultRequest" - BoxCollection result = requestBody("direct://GETEVENTOPTIONS", null); - - assertNotNull("getEventOptions result", result); - LOG.debug("getEventOptions: " + result); - } - - @Test - public void testGetEvents() throws Exception { - // using com.box.boxjavalibv2.requests.requestobjects.BoxEventRequestObject message body for single parameter "eventRequest" - final BoxEventRequestObject requestObject = - BoxEventRequestObject.getEventsRequestObject(BoxEventRequestObject.STREAM_POSITION_NOW); - BoxEventCollection result = requestBody("direct://GETEVENTS", requestObject); - - assertNotNull("getEvents result", result); - LOG.debug("getEvents: " + result); - } - - @Override - protected RouteBuilder createRouteBuilder() throws Exception { - return new RouteBuilder() { - public void configure() { - // test route for getEventOptions - from("direct://GETEVENTOPTIONS") - .to("box://" + PATH_PREFIX + "/getEventOptions?inBody=defaultRequest"); - - // test route for getEvents - from("direct://GETEVENTS") - .to("box://" + PATH_PREFIX + "/getEvents?inBody=eventRequest"); - - } - }; - } -} http://git-wip-us.apache.org/repos/asf/camel/blob/b51280c8/components/camel-box/src/test/java/org/apache/camel/component/box/IBoxFilesManagerIntegrationTest.java ---------------------------------------------------------------------- diff --git a/components/camel-box/src/test/java/org/apache/camel/component/box/IBoxFilesManagerIntegrationTest.java b/components/camel-box/src/test/java/org/apache/camel/component/box/IBoxFilesManagerIntegrationTest.java deleted file mode 100644 index 44e4a7a..0000000 --- a/components/camel-box/src/test/java/org/apache/camel/component/box/IBoxFilesManagerIntegrationTest.java +++ /dev/null @@ -1,447 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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. - */ - -/* - * Camel Api Route test generated by camel-component-util-maven-plugin - * Generated on: Tue Jun 24 22:42:08 PDT 2014 - */ -package org.apache.camel.component.box; - -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.HashMap; -import java.util.Map; - -import com.box.boxjavalibv2.dao.BoxFile; -import com.box.boxjavalibv2.dao.BoxPreview; -import com.box.boxjavalibv2.dao.BoxSharedLinkAccess; -import com.box.boxjavalibv2.exceptions.BoxServerException; -import com.box.boxjavalibv2.filetransfer.IFileTransferListener; -import com.box.boxjavalibv2.jsonentities.BoxSharedLinkRequestEntity; -import com.box.boxjavalibv2.requests.requestobjects.BoxFileRequestObject; -import com.box.boxjavalibv2.requests.requestobjects.BoxImageRequestObject; -import com.box.boxjavalibv2.requests.requestobjects.BoxItemCopyRequestObject; -import com.box.boxjavalibv2.requests.requestobjects.BoxSharedLinkRequestObject; -import com.box.restclientv2.requestsbase.BoxFileUploadRequestObject; -import org.apache.camel.CamelExecutionException; -import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.component.box.internal.BoxApiName; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Test class for com.box.boxjavalibv2.resourcemanagers.IBoxFilesManager APIs. - */ -public class IBoxFilesManagerIntegrationTest extends AbstractBoxTestSupport { - - private static final Logger LOG = LoggerFactory.getLogger(IBoxFilesManagerIntegrationTest.class); - private static final String PATH_PREFIX = BoxApiName.FILES.getName(); - private static final BoxImageRequestObject BOX_IMAGE_REQUEST_OBJECT = BoxImageRequestObject.previewRequestObject(); - private static final String PNG_EXTENSION = "png"; - private static final String TEST_UPLOAD_FILE = "/log4j.properties"; - private static final String PREVIEW_UNAVAILABLE = "Requested preview unavailable"; - - public BoxFile copyFile() throws Exception { - final Map<String, Object> headers = new HashMap<String, Object>(); - // parameter type is String - headers.put("CamelBox.fileId", testFileId); - // parameter type is com.box.boxjavalibv2.requests.requestobjects.BoxItemCopyRequestObject - final BoxItemCopyRequestObject requestObject = - BoxItemCopyRequestObject.copyItemRequestObject("0"); - requestObject.setName(CAMEL_TEST_FILE); - headers.put("CamelBox.itemCopyRequest", requestObject); - BoxFile result = requestBodyAndHeaders("direct://COPYFILE", null, headers); - - assertNotNull("copyFile result", result); - LOG.debug("copyFile: " + result); - - return result; - } - - @Test - public void testCreateSharedLink() throws Exception { - final BoxFile boxFile = copyFile(); - - try { - final Map<String, Object> headers = new HashMap<String, Object>(); - // parameter type is String - headers.put("CamelBox.fileId", boxFile.getId()); - // parameter type is com.box.boxjavalibv2.requests.requestobjects.BoxSharedLinkRequestObject - final BoxSharedLinkRequestEntity sharedLink = new BoxSharedLinkRequestEntity(BoxSharedLinkAccess.OPEN); - final BoxSharedLinkRequestObject requestObject = - BoxSharedLinkRequestObject.createSharedLinkRequestObject(sharedLink); - headers.put("CamelBox.sharedLinkRequest", requestObject); - - BoxFile result = requestBodyAndHeaders("direct://CREATESHAREDLINK", null, headers); - - assertNotNull("createSharedLink result", result); - LOG.debug("createSharedLink: " + result); - } finally { - deleteFile(boxFile.getId()); - } - } - - public void deleteFile(String fileId) throws Exception { - final Map<String, Object> headers = new HashMap<String, Object>(); - // parameter type is String - headers.put("CamelBox.fileId", fileId); - // parameter type is com.box.restclientv2.requestsbase.BoxDefaultRequestObject - headers.put("CamelBox.defaultRequest", null); - requestBodyAndHeaders("direct://DELETEFILE", null, headers); - } - - @Test - public void testDownloadFile() throws Exception { - final Map<String, Object> headers = new HashMap<String, Object>(); - // parameter type is String - headers.put("CamelBox.fileId", testFileId); - // parameter type is com.box.restclientv2.requestsbase.BoxDefaultRequestObject -// headers.put("CamelBox.defaultRequest", null); - InputStream result = requestBodyAndHeaders("direct://DOWNLOADFILE", null, headers); - - assertNotNull("downloadFile result", result); - LOG.debug("downloadFile: " + result); - result.close(); - } - - @Test - public void testDownloadFile1() throws Exception { - final Map<String, Object> headers = new HashMap<String, Object>(); - // parameter type is String - headers.put("CamelBox.fileId", testFileId); - // parameter type is java.io.File - final File tempFile = File.createTempFile("CamelTest", "download"); - headers.put("CamelBox.destination", tempFile); - // parameter type is com.box.boxjavalibv2.filetransfer.IFileTransferListener - final FileTransferListener fileTransferListener = new FileTransferListener(); - headers.put("CamelBox.listener", fileTransferListener); - // parameter type is com.box.restclientv2.requestsbase.BoxDefaultRequestObject -// headers.put("CamelBox.defaultRequest", null); - - requestBodyAndHeaders("direct://DOWNLOADFILE_1", null, headers); - - assertTransferSuccess(fileTransferListener); - assertTrue("downloadFile file", tempFile.exists()); - } - - private void assertTransferSuccess(FileTransferListener fileTransferListener) throws InterruptedException { - long bytesTransferred; - do { - bytesTransferred = fileTransferListener.getBytesTransferred(); - Thread.sleep(2000); - } while (fileTransferListener.getBytesTransferred() != bytesTransferred); -// assertEquals("downloadFile status", "success", fileTransferListener.getStatus()); - assertNull("downloadFile exception", fileTransferListener.getException()); - } - - @Test - public void testDownloadFile2() throws Exception { - final Map<String, Object> headers = new HashMap<String, Object>(); - // parameter type is String - headers.put("CamelBox.fileId", testFileId); - // parameter type is java.io.OutputStream[] - final OutputStream[] outputStreams = new OutputStream[]{new ByteArrayOutputStream()}; - headers.put("CamelBox.outputStreams", outputStreams); - // parameter type is com.box.boxjavalibv2.filetransfer.IFileTransferListener - final FileTransferListener fileTransferListener = new FileTransferListener(); - headers.put("CamelBox.listener", fileTransferListener); - // parameter type is com.box.restclientv2.requestsbase.BoxDefaultRequestObject -// headers.put("CamelBox.defaultRequest", null); - - requestBodyAndHeaders("direct://DOWNLOADFILE_2", null, headers); - - assertTransferSuccess(fileTransferListener); - assertNotNull("downloadFile OutputStream", outputStreams[0].toString()); - } - - @Test - public void testDownloadThumbnail() throws Exception { - final Map<String, Object> headers = new HashMap<String, Object>(); - // parameter type is String - headers.put("CamelBox.fileId", testFileId); - // parameter type is String - headers.put("CamelBox.extension", PNG_EXTENSION); - // parameter type is com.box.boxjavalibv2.requests.requestobjects.BoxImageRequestObject - headers.put("CamelBox.imageRequest", BOX_IMAGE_REQUEST_OBJECT); - - InputStream result = requestBodyAndHeaders("direct://DOWNLOADTHUMBNAIL", null, headers); - - assertNotNull("downloadThumbnail result", result); - LOG.debug("downloadThumbnail: " + result); - result.close(); - } - - @Test - public void testGetFile() throws Exception { - final Map<String, Object> headers = new HashMap<String, Object>(); - // parameter type is String - headers.put("CamelBox.fileId", testFileId); - // parameter type is com.box.restclientv2.requestsbase.BoxDefaultRequestObject -// headers.put("CamelBox.defaultRequest", null); - - BoxFile result = requestBodyAndHeaders("direct://GETFILE", null, headers); - - assertNotNull("getFile result", result); - LOG.debug("getFile: " + result); - } - - @Test - public void testGetFileComments() throws Exception { - final Map<String, Object> headers = new HashMap<String, Object>(); - // parameter type is String - headers.put("CamelBox.fileId", testFileId); - // parameter type is com.box.restclientv2.requestsbase.BoxDefaultRequestObject -// headers.put("CamelBox.defaultRequest", null); - - com.box.boxjavalibv2.dao.BoxCollection result = requestBodyAndHeaders("direct://GETFILECOMMENTS", null, headers); - - assertNotNull("getFileComments result", result); - LOG.debug("getFileComments: " + result); - } - - @Test - public void testGetFileVersions() throws Exception { - final Map<String, Object> headers = new HashMap<String, Object>(); - // parameter type is String - headers.put("CamelBox.fileId", testFileId); - // parameter type is com.box.restclientv2.requestsbase.BoxDefaultRequestObject -// headers.put("CamelBox.defaultRequest", null); - - java.util.List result = requestBodyAndHeaders("direct://GETFILEVERSIONS", null, headers); - - assertNotNull("getFileVersions result", result); - LOG.debug("getFileVersions: " + result); - } - - @Test - public void testGetPreview() throws Exception { - final Map<String, Object> headers = new HashMap<String, Object>(); - // parameter type is String - headers.put("CamelBox.fileId", testFileId); - // parameter type is String - headers.put("CamelBox.extension", PNG_EXTENSION); - // parameter type is com.box.boxjavalibv2.requests.requestobjects.BoxImageRequestObject - headers.put("CamelBox.imageRequest", BOX_IMAGE_REQUEST_OBJECT); - com.box.boxjavalibv2.dao.BoxPreview result = null; - try { - result = requestBodyAndHeaders("direct://GETPREVIEW", null, headers); - } catch (CamelExecutionException e) { - boolean ignore = false; - if (e.getCause().getCause() instanceof BoxServerException) { - BoxServerException exception = (BoxServerException) e.getCause().getCause(); - if (PREVIEW_UNAVAILABLE.equals(exception.getMessage())) { - // ignore unavailable preview errors - result = new BoxPreview(); - ignore = true; - } - } - if (!ignore) { - throw e; - } - } - - assertNotNull("getPreview result", result); - LOG.debug("getPreview: " + result); - } - - @Test - public void testGetThumbnail() throws Exception { - final Map<String, Object> headers = new HashMap<String, Object>(); - // parameter type is String - headers.put("CamelBox.fileId", testFileId); - // parameter type is String - headers.put("CamelBox.extension", PNG_EXTENSION); - // parameter type is com.box.boxjavalibv2.requests.requestobjects.BoxImageRequestObject - headers.put("CamelBox.imageRequest", BOX_IMAGE_REQUEST_OBJECT); - com.box.boxjavalibv2.dao.BoxThumbnail result = requestBodyAndHeaders("direct://GETTHUMBNAIL", null, headers); - - LOG.debug("getThumbnail: " + result); - } - - @Test - public void testUpdateFileInfo() throws Exception { - final Map<String, Object> headers = new HashMap<String, Object>(); - // parameter type is String - headers.put("CamelBox.fileId", testFileId); - // parameter type is com.box.boxjavalibv2.requests.requestobjects.BoxFileRequestObject - final BoxFileRequestObject requestObject = BoxFileRequestObject.getRequestObject(); - requestObject.setTags(new String[]{CAMEL_TEST_TAG}); - headers.put("CamelBox.fileRequest", requestObject); - BoxFile result = requestBodyAndHeaders("direct://UPDATEFILEINFO", null, headers); - - assertNotNull("updateFileInfo result", result); - LOG.debug("updateFileInfo: " + result); - } - - public BoxFile uploadFile() throws Exception { - // using com.box.restclientv2.requestsbase.BoxFileUploadRequestObject message body for single parameter "fileUploadRequest" - final BoxFileUploadRequestObject requestObject = - BoxFileUploadRequestObject.uploadFileRequestObject("0", CAMEL_TEST_FILE, - getClass().getResourceAsStream(TEST_UPLOAD_FILE)); - final FileTransferListener fileTransferListener = new FileTransferListener(); - requestObject.setListener(fileTransferListener); - - BoxFile result = requestBody("direct://UPLOADFILE", requestObject); - - assertTransferSuccess(fileTransferListener); - assertNotNull("uploadFile result", result); - LOG.debug("uploadFile: " + result); - - // wait a moment for the file to show up in subsequent calls - Thread.sleep(2000); - return result; - } - - @Test - public void testUploadNewVersion() throws Exception { - final BoxFile boxFile = uploadFile(); - - try { - final Map<String, Object> headers = new HashMap<String, Object>(); - // parameter type is String - headers.put("CamelBox.fileId", boxFile.getId()); - // parameter type is com.box.restclientv2.requestsbase.BoxFileUploadRequestObject - final BoxFileUploadRequestObject requestObject = - BoxFileUploadRequestObject.uploadNewVersionRequestObject(CAMEL_TEST_FILE, - getClass().getResourceAsStream(TEST_UPLOAD_FILE)); - final FileTransferListener fileTransferListener = new FileTransferListener(); - requestObject.setListener(fileTransferListener); - - headers.put("CamelBox.fileUploadRequest", requestObject); - BoxFile result = requestBodyAndHeaders("direct://UPLOADNEWVERSION", null, headers); - - assertTransferSuccess(fileTransferListener); - assertNotNull("uploadNewVersion result", result); - LOG.debug("uploadNewVersion: " + result); - } finally { - deleteFile(boxFile.getId()); - } - } - - @Override - protected RouteBuilder createRouteBuilder() throws Exception { - return new RouteBuilder() { - public void configure() { - // test route for copyFile - from("direct://COPYFILE") - .to("box://" + PATH_PREFIX + "/copyFile"); - - // test route for createSharedLink - from("direct://CREATESHAREDLINK") - .to("box://" + PATH_PREFIX + "/createSharedLink"); - - // test route for deleteFile - from("direct://DELETEFILE") - .to("box://" + PATH_PREFIX + "/deleteFile"); - - // test route for downloadFile - from("direct://DOWNLOADFILE") - .to("box://" + PATH_PREFIX + "/downloadFile"); - - // test route for downloadFile - from("direct://DOWNLOADFILE_1") - .to("box://" + PATH_PREFIX + "/downloadFile"); - - // test route for downloadFile - from("direct://DOWNLOADFILE_2") - .to("box://" + PATH_PREFIX + "/downloadFile"); - - // test route for downloadThumbnail - from("direct://DOWNLOADTHUMBNAIL") - .to("box://" + PATH_PREFIX + "/downloadThumbnail"); - - // test route for getFile - from("direct://GETFILE") - .to("box://" + PATH_PREFIX + "/getFile"); - - // test route for getFileComments - from("direct://GETFILECOMMENTS") - .to("box://" + PATH_PREFIX + "/getFileComments"); - - // test route for getFileVersions - from("direct://GETFILEVERSIONS") - .to("box://" + PATH_PREFIX + "/getFileVersions"); - - // test route for getPreview - from("direct://GETPREVIEW") - .to("box://" + PATH_PREFIX + "/getPreview"); - - // test route for getThumbnail - from("direct://GETTHUMBNAIL") - .to("box://" + PATH_PREFIX + "/getThumbnail"); - - // test route for updateFileInfo - from("direct://UPDATEFILEINFO") - .to("box://" + PATH_PREFIX + "/updateFileInfo"); - - // test route for uploadFile - from("direct://UPLOADFILE") - .to("box://" + PATH_PREFIX + "/uploadFile?inBody=fileUploadRequest"); - - // test route for uploadNewVersion - from("direct://UPLOADNEWVERSION") - .to("box://" + PATH_PREFIX + "/uploadNewVersion"); - - } - }; - } - - private static class FileTransferListener implements IFileTransferListener { - private String status; - private long bytesTransferred; - private IOException exception; - - public String getStatus() { - return status; - } - - public long getBytesTransferred() { - return bytesTransferred; - } - - private IOException getException() { - return exception; - } - - @Override - public void onComplete(String status) { - LOG.debug("Download completed with status " + status); - this.status = status; - } - - @Override - public void onCanceled() { - LOG.debug("Download canceled"); - } - - @Override - public void onProgress(long bytesTransferred) { - LOG.debug("Downloaded bytes " + bytesTransferred); - this.bytesTransferred = bytesTransferred; - } - - @Override - public void onIOException(IOException e) { - LOG.debug("Download exception " + e.getMessage(), e); - this.exception = e; - } - } -} http://git-wip-us.apache.org/repos/asf/camel/blob/b51280c8/components/camel-box/src/test/java/org/apache/camel/component/box/IBoxFoldersManagerIntegrationTest.java ---------------------------------------------------------------------- diff --git a/components/camel-box/src/test/java/org/apache/camel/component/box/IBoxFoldersManagerIntegrationTest.java b/components/camel-box/src/test/java/org/apache/camel/component/box/IBoxFoldersManagerIntegrationTest.java deleted file mode 100644 index 898bc4c..0000000 --- a/components/camel-box/src/test/java/org/apache/camel/component/box/IBoxFoldersManagerIntegrationTest.java +++ /dev/null @@ -1,236 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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. - */ - -/* - * Camel Api Route test generated by camel-component-util-maven-plugin - * Generated on: Tue Jun 24 22:42:08 PDT 2014 - */ -package org.apache.camel.component.box; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.box.boxjavalibv2.dao.BoxCollection; -import com.box.boxjavalibv2.dao.BoxFolder; -import com.box.boxjavalibv2.dao.BoxSharedLinkAccess; -import com.box.boxjavalibv2.jsonentities.BoxSharedLinkRequestEntity; -import com.box.boxjavalibv2.requests.requestobjects.BoxFolderDeleteRequestObject; -import com.box.boxjavalibv2.requests.requestobjects.BoxFolderRequestObject; -import com.box.boxjavalibv2.requests.requestobjects.BoxItemCopyRequestObject; -import com.box.boxjavalibv2.requests.requestobjects.BoxSharedLinkRequestObject; -import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.component.box.internal.BoxApiName; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Test class for com.box.boxjavalibv2.resourcemanagers.IBoxFoldersManager APIs. - */ -public class IBoxFoldersManagerIntegrationTest extends AbstractBoxTestSupport { - - private static final Logger LOG = LoggerFactory.getLogger(IBoxFoldersManagerIntegrationTest.class); - private static final String CAMEL_TEST_FOLDER = "CamelTestFolder"; - private static final String CAMEL_TEST_COPY_FOLDER = IBoxFoldersManagerIntegrationTest.CAMEL_TEST_FOLDER + "_Copy"; - private static final String PATH_PREFIX = BoxApiName.FOLDERS.getName(); - - @Test - // also tests create folder, and delete folder - public void testCopyFolder() throws Exception { - // create a test folder to copy - final BoxFolder testFolder = createFolder(); - - try { - final Map<String, Object> headers = new HashMap<String, Object>(); - // parameter type is String - headers.put("CamelBox.folderId", testFolder.getId()); - // parameter type is com.box.boxjavalibv2.requests.requestobjects.BoxItemCopyRequestObject - final BoxItemCopyRequestObject requestObject = BoxItemCopyRequestObject.copyItemRequestObject("0"); - requestObject.setName(CAMEL_TEST_COPY_FOLDER); - headers.put("CamelBox.itemCopyRequest", requestObject); - - BoxFolder result = requestBodyAndHeaders("direct://COPYFOLDER", null, headers); - assertNotNull("copyFolder result", result); - assertEquals("copyFolder folder name", CAMEL_TEST_COPY_FOLDER, result.getName()); - LOG.debug("copyFolder: " + result); - - // delete the copy - deleteFolder(result.getId()); - } finally { - deleteFolder(testFolder.getId()); - } - } - - private BoxFolder createFolder() { - // using com.box.boxjavalibv2.requests.requestobjects.BoxFolderRequestObject message body for single parameter "folderRequest" - final BoxFolderRequestObject camelTestFolder = BoxFolderRequestObject.createFolderRequestObject(CAMEL_TEST_FOLDER, "0"); - - BoxFolder result = requestBody("direct://CREATEFOLDER", camelTestFolder); - assertNotNull("createFolder result", result); - assertNotNull("createFolder folder id", result.getId()); - return result; - } - - @Test - public void testCreateSharedLink() throws Exception { - final BoxFolder testFolder = createFolder(); - - try { - final Map<String, Object> headers = new HashMap<String, Object>(); - // parameter type is String - headers.put("CamelBox.folderId", testFolder.getId()); - // parameter type is com.box.boxjavalibv2.requests.requestobjects.BoxSharedLinkRequestObject - final BoxSharedLinkRequestEntity sharedLink = new BoxSharedLinkRequestEntity( - BoxSharedLinkAccess.COLLABORATORS); - headers.put("CamelBox.sharedLinkRequest", - BoxSharedLinkRequestObject.createSharedLinkRequestObject(sharedLink)); - - BoxFolder result = requestBodyAndHeaders("direct://CREATESHAREDLINK", null, headers); - assertNotNull("createSharedLink result", result); - assertNotNull("createSharedLink result", result.getSharedLink()); - LOG.debug("createSharedLink: " + result); - } finally { - deleteFolder(testFolder.getId()); - } - } - - public void deleteFolder(String folderId) throws Exception { - final Map<String, Object> headers = new HashMap<String, Object>(); - // parameter type is String - headers.put("CamelBox.folderId", folderId); - // parameter type is com.box.boxjavalibv2.requests.requestobjects.BoxFolderDeleteRequestObject - headers.put("CamelBox.folderDeleteRequest", BoxFolderDeleteRequestObject.deleteFolderRequestObject(true)); - - requestBodyAndHeaders("direct://DELETEFOLDER", null, headers); - - // wait for the delete to happen - Thread.sleep(2000); - } - - @Test - public void testGetFolder() { - final Map<String, Object> headers = new HashMap<String, Object>(); - // parameter type is String - headers.put("CamelBox.folderId", "0"); - // parameter type is com.box.restclientv2.requestsbase.BoxDefaultRequestObject -// headers.put("CamelBox.defaultRequest", null); - - final BoxFolder result = (BoxFolder) requestBodyAndHeaders("direct://GETFOLDER", null, headers); - assertNotNull("getFolder result", result); - assertEquals("getFolder folder id", "0", result.getId()); - LOG.debug("getFolder: " + result); - } - - @Test - public void testGetFolderCollaborations() throws Exception { - final BoxFolder testFolder = createFolder(); - - try { - final Map<String, Object> headers = new HashMap<String, Object>(); - // parameter type is String - headers.put("CamelBox.folderId", testFolder.getId()); - // parameter type is com.box.restclientv2.requestsbase.BoxDefaultRequestObject -// headers.put("CamelBox.defaultRequest", null); - - List result = requestBodyAndHeaders("direct://GETFOLDERCOLLABORATIONS", null, headers); - assertNotNull("getFolderCollaborations result", result); - LOG.debug("getFolderCollaborations: " + result); - } finally { - deleteFolder(testFolder.getId()); - } - } - - @Test - public void testGetFolderItems() throws Exception { - final Map<String, Object> headers = new HashMap<String, Object>(); - // parameter type is String - headers.put("CamelBox.folderId", "0"); - // parameter type is com.box.boxjavalibv2.requests.requestobjects.BoxPagingRequestObject - headers.put("CamelBox.pagingRequest", BOX_PAGING_REQUEST_OBJECT); - - BoxCollection result = requestBodyAndHeaders("direct://GETFOLDERITEMS", null, headers); - assertNotNull(result); - LOG.debug("getFolderItems: " + result); - } - - @Test - public void testUpdateFolderInfo() throws Exception { - // create test folder - final BoxFolder testFolder = createFolder(); - - try { - - final Map<String, Object> headers = new HashMap<String, Object>(); - // parameter type is String - headers.put("CamelBox.folderId", testFolder.getId()); - // parameter type is com.box.boxjavalibv2.requests.requestobjects.BoxFolderRequestObject - final BoxFolderRequestObject folderRequestObject = BoxFolderRequestObject.getRequestObject(); - folderRequestObject.setTags(new String[]{CAMEL_TEST_TAG}); - folderRequestObject.setName(CAMEL_TEST_COPY_FOLDER); - headers.put("CamelBox.folderRequest", folderRequestObject); - - BoxFolder result = requestBodyAndHeaders("direct://UPDATEFOLDERINFO", null, headers); - assertNotNull("updateFolderInfo result", result); - assertEquals("updateFolderInfo folder name", CAMEL_TEST_COPY_FOLDER, result.getName()); -// assertEquals("updateFolderInfo result", "["+ CAMEL_TEST_TAG + "]", Arrays.toString(result.getTags())); - LOG.debug("updateFolderInfo: " + result); - } finally { - deleteFolder(testFolder.getId()); - } - } - - @Override - protected RouteBuilder createRouteBuilder() throws Exception { - return new RouteBuilder() { - public void configure() { - // test route for copyFolder - from("direct://COPYFOLDER") - .to("box://" + PATH_PREFIX + "/copyFolder"); - - // test route for createFolder - from("direct://CREATEFOLDER") - .to("box://" + PATH_PREFIX + "/createFolder?inBody=folderRequest"); - - // test route for createSharedLink - from("direct://CREATESHAREDLINK") - .to("box://" + PATH_PREFIX + "/createSharedLink"); - - // test route for deleteFolder - from("direct://DELETEFOLDER") - .to("box://" + PATH_PREFIX + "/deleteFolder"); - - // test route for getFolder - from("direct://GETFOLDER") - .to("box://" + PATH_PREFIX + "/getFolder"); - - // test route for getFolderCollaborations - from("direct://GETFOLDERCOLLABORATIONS") - .to("box://" + PATH_PREFIX + "/getFolderCollaborations"); - - // test route for getFolderItems - from("direct://GETFOLDERITEMS") - .to("box://" + PATH_PREFIX + "/getFolderItems"); - - // test route for updateFolderInfo - from("direct://UPDATEFOLDERINFO") - .to("box://" + PATH_PREFIX + "/updateFolderInfo"); - - } - }; - } -} http://git-wip-us.apache.org/repos/asf/camel/blob/b51280c8/components/camel-box/src/test/java/org/apache/camel/component/box/IBoxGroupsManagerIntegrationTest.java ---------------------------------------------------------------------- diff --git a/components/camel-box/src/test/java/org/apache/camel/component/box/IBoxGroupsManagerIntegrationTest.java b/components/camel-box/src/test/java/org/apache/camel/component/box/IBoxGroupsManagerIntegrationTest.java deleted file mode 100644 index decd6ec..0000000 --- a/components/camel-box/src/test/java/org/apache/camel/component/box/IBoxGroupsManagerIntegrationTest.java +++ /dev/null @@ -1,326 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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. - */ - -/* - * Camel Api Route test generated by camel-component-util-maven-plugin - * Generated on: Tue Jun 24 22:42:08 PDT 2014 - */ -package org.apache.camel.component.box; - -import java.util.HashMap; -import java.util.Map; - -import com.box.boxjavalibv2.dao.BoxCollection; -import com.box.boxjavalibv2.dao.BoxGroup; -import com.box.boxjavalibv2.dao.BoxGroupMembership; -import com.box.boxjavalibv2.requests.requestobjects.BoxGroupMembershipRequestObject; -import com.box.boxjavalibv2.requests.requestobjects.BoxGroupRequestObject; -import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.component.box.internal.BoxApiCollection; -import org.apache.camel.component.box.internal.IBoxGroupsManagerApiMethod; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Test class for com.box.boxjavalibv2.resourcemanagers.IBoxGroupsManager APIs. - */ -public class IBoxGroupsManagerIntegrationTest extends AbstractBoxTestSupport { - - private static final Logger LOG = LoggerFactory.getLogger(IBoxGroupsManagerIntegrationTest.class); - private static final String PATH_PREFIX = BoxApiCollection.getCollection().getApiName(IBoxGroupsManagerApiMethod.class).getName(); - - private static final String CAMEL_TEST_GROUP = "CamelTestGroup"; - - public BoxGroup createGroup() throws Exception { - // using com.box.boxjavalibv2.requests.requestobjects.BoxGroupRequestObject message body for single parameter "groupRequest" - final BoxGroupRequestObject requestObject = BoxGroupRequestObject.createGroupRequestObject(CAMEL_TEST_GROUP); - BoxGroup result = requestBody("direct://CREATEGROUP", requestObject); - - assertNotNull("createGroup result", result); - return result; - } - - @Test - public void testCreateGroup1() throws Exception { - // using String message body for single parameter "name" - BoxGroup result = requestBody("direct://CREATEGROUP_1", CAMEL_TEST_GROUP); - - assertNotNull("createGroup result", result); - LOG.debug("createGroup: " + result); - - deleteGroup(result.getId()); - } - - public BoxGroupMembership createMembership(String groupId) throws Exception { - // using com.box.boxjavalibv2.requests.requestobjects.BoxGroupMembershipRequestObject message body for single parameter "groupMembershipRequest" - final BoxGroupMembershipRequestObject requestObject = - BoxGroupMembershipRequestObject.addMembershipRequestObject(groupId, testUserId, BoxGroupMembership.ROLE_MEMBER); - BoxGroupMembership result = requestBody("direct://CREATEMEMBERSHIP", requestObject); - - assertNotNull("createMembership result", result); - return result; - } - - @Test - public void testCreateMembership1() throws Exception { - final BoxGroup group = createGroup(); - - try { - final Map<String, Object> headers = new HashMap<String, Object>(); - // parameter type is String - headers.put("CamelBox.groupId", group.getId()); - // parameter type is String - headers.put("CamelBox.userId", testUserId); - // parameter type is String - headers.put("CamelBox.role", BoxGroupMembership.ROLE_MEMBER); - - BoxGroupMembership result = requestBodyAndHeaders("direct://CREATEMEMBERSHIP_1", null, headers); - - assertNotNull("createMembership result", result); - LOG.debug("createMembership: " + result); - } finally { - deleteGroup(group.getId()); - } - } - - public void deleteGroup(String groupId) throws Exception { - final Map<String, Object> headers = new HashMap<String, Object>(); - // parameter type is String - headers.put("CamelBox.groupId", groupId); - // parameter type is com.box.restclientv2.requestsbase.BoxDefaultRequestObject -// headers.put("CamelBox.defaultRequest", null); - - requestBodyAndHeaders("direct://DELETEGROUP", null, headers); - } - - @Test - public void testDeleteMembership() throws Exception { - final BoxGroup group = createGroup(); - - try { - final BoxGroupMembership membership = createMembership(group.getId()); - - final Map<String, Object> headers = new HashMap<String, Object>(); - // parameter type is String - headers.put("CamelBox.membershipId", membership.getId()); - // parameter type is com.box.restclientv2.requestsbase.BoxDefaultRequestObject -// headers.put("CamelBox.defaultRequest", null); - requestBodyAndHeaders("direct://DELETEMEMBERSHIP", null, headers); - } finally { - deleteGroup(group.getId()); - } - } - - @Test - public void testGetAllCollaborations() throws Exception { - final BoxGroup group = createGroup(); - try { - final Map<String, Object> headers = new HashMap<String, Object>(); - // parameter type is String - headers.put("CamelBox.groupId", group.getId()); - // parameter type is com.box.restclientv2.requestsbase.BoxDefaultRequestObject -// headers.put("CamelBox.defaultRequest", null); - - BoxCollection result = requestBodyAndHeaders("direct://GETALLCOLLABORATIONS", null, headers); - - assertNotNull("getAllCollaborations result", result); - LOG.debug("getAllCollaborations: " + result); - } finally { - deleteGroup(group.getId()); - } - } - - @Test - public void testGetAllGroups() throws Exception { - // using com.box.restclientv2.requestsbase.BoxDefaultRequestObject message body for single parameter "defaultRequest" - BoxCollection result = requestBody("direct://GETALLGROUPS", null); - - assertNotNull("getAllGroups result", result); - LOG.debug("getAllGroups: " + result); - } - - @Test - public void testGetMembership() throws Exception { - final BoxGroup group = createGroup(); - - try { - final BoxGroupMembership membership = createMembership(group.getId()); - - final Map<String, Object> headers = new HashMap<String, Object>(); - // parameter type is String - headers.put("CamelBox.membershipId", membership.getId()); - // parameter type is com.box.restclientv2.requestsbase.BoxDefaultRequestObject -// headers.put("CamelBox.defaultRequest", null); - - BoxGroupMembership result = requestBodyAndHeaders("direct://GETMEMBERSHIP", null, headers); - - assertNotNull("getMembership result", result); - LOG.debug("getMembership: " + result); - } finally { - deleteGroup(group.getId()); - } - } - - @Test - public void testGetMemberships() throws Exception { - final BoxGroup group = createGroup(); - - try { - final Map<String, Object> headers = new HashMap<String, Object>(); - // parameter type is String - headers.put("CamelBox.groupId", group.getId()); - // parameter type is com.box.restclientv2.requestsbase.BoxDefaultRequestObject - headers.put("CamelBox.defaultRequest", null); - - BoxCollection result = requestBodyAndHeaders("direct://GETMEMBERSHIPS", null, headers); - - assertNotNull("getMemberships result", result); - LOG.debug("getMemberships: " + result); - } finally { - deleteGroup(group.getId()); - } - } - - @Test - public void testUpdateGroup() throws Exception { - final BoxGroup group = createGroup(); - - try { - final Map<String, Object> headers = new HashMap<String, Object>(); - // parameter type is String - headers.put("CamelBox.groupId", group.getId()); - // parameter type is com.box.boxjavalibv2.requests.requestobjects.BoxGroupRequestObject - final BoxGroupRequestObject requestObject = - BoxGroupRequestObject.updateGroupRequestObject(CAMEL_TEST_GROUP + "_Updated"); - headers.put("CamelBox.groupRequest", requestObject); - - BoxGroup result = requestBodyAndHeaders("direct://UPDATEGROUP", null, headers); - - assertNotNull("updateGroup result", result); - LOG.debug("updateGroup: " + result); - } finally { - deleteGroup(group.getId()); - } - } - - @Test - public void testUpdateMembership() throws Exception { - final BoxGroup group = createGroup(); - - try { - final BoxGroupMembership membership = createMembership(group.getId()); - - final Map<String, Object> headers = new HashMap<String, Object>(); - // parameter type is String - headers.put("CamelBox.membershipId", membership.getId()); - // parameter type is com.box.boxjavalibv2.requests.requestobjects.BoxGroupMembershipRequestObject - final BoxGroupMembershipRequestObject requestObject = - BoxGroupMembershipRequestObject.updateMembershipRequestObject(BoxGroupMembership.ROLE_ADMIN); - headers.put("CamelBox.groupMembershipRequest", requestObject); - - BoxGroupMembership result = requestBodyAndHeaders("direct://UPDATEMEMBERSHIP", null, headers); - - assertNotNull("updateMembership result", result); - LOG.debug("updateMembership: " + result); - } finally { - deleteGroup(group.getId()); - } - } - - @Test - public void testUpdateMembership1() throws Exception { - final BoxGroup group = createGroup(); - - try { - final BoxGroupMembership membership = createMembership(group.getId()); - - final Map<String, Object> headers = new HashMap<String, Object>(); - // parameter type is String - headers.put("CamelBox.membershipId", membership.getId()); - // parameter type is String - headers.put("CamelBox.role", BoxGroupMembership.ROLE_ADMIN); - - BoxGroupMembership result = requestBodyAndHeaders("direct://UPDATEMEMBERSHIP_1", null, headers); - - assertNotNull("updateMembership result", result); - LOG.debug("updateMembership: " + result); - } finally { - deleteGroup(group.getId()); - } - } - - @Override - protected RouteBuilder createRouteBuilder() throws Exception { - return new RouteBuilder() { - public void configure() { - // test route for createGroup - from("direct://CREATEGROUP") - .to("box://" + PATH_PREFIX + "/createGroup?inBody=groupRequest"); - - // test route for createGroup - from("direct://CREATEGROUP_1") - .to("box://" + PATH_PREFIX + "/createGroup?inBody=name"); - - // test route for createMembership - from("direct://CREATEMEMBERSHIP") - .to("box://" + PATH_PREFIX + "/createMembership?inBody=groupMembershipRequest"); - - // test route for createMembership - from("direct://CREATEMEMBERSHIP_1") - .to("box://" + PATH_PREFIX + "/createMembership"); - - // test route for deleteGroup - from("direct://DELETEGROUP") - .to("box://" + PATH_PREFIX + "/deleteGroup"); - - // test route for deleteMembership - from("direct://DELETEMEMBERSHIP") - .to("box://" + PATH_PREFIX + "/deleteMembership"); - - // test route for getAllCollaborations - from("direct://GETALLCOLLABORATIONS") - .to("box://" + PATH_PREFIX + "/getAllCollaborations"); - - // test route for getAllGroups - from("direct://GETALLGROUPS") - .to("box://" + PATH_PREFIX + "/getAllGroups?inBody=defaultRequest"); - - // test route for getMembership - from("direct://GETMEMBERSHIP") - .to("box://" + PATH_PREFIX + "/getMembership"); - - // test route for getMemberships - from("direct://GETMEMBERSHIPS") - .to("box://" + PATH_PREFIX + "/getMemberships"); - - // test route for updateGroup - from("direct://UPDATEGROUP") - .to("box://" + PATH_PREFIX + "/updateGroup"); - - // test route for updateMembership - from("direct://UPDATEMEMBERSHIP") - .to("box://" + PATH_PREFIX + "/updateMembership"); - - // test route for updateMembership - from("direct://UPDATEMEMBERSHIP_1") - .to("box://" + PATH_PREFIX + "/updateMembership"); - - } - }; - } -} http://git-wip-us.apache.org/repos/asf/camel/blob/b51280c8/components/camel-box/src/test/java/org/apache/camel/component/box/IBoxSearchManagerIntegrationTest.java ---------------------------------------------------------------------- diff --git a/components/camel-box/src/test/java/org/apache/camel/component/box/IBoxSearchManagerIntegrationTest.java b/components/camel-box/src/test/java/org/apache/camel/component/box/IBoxSearchManagerIntegrationTest.java deleted file mode 100644 index 09650cb..0000000 --- a/components/camel-box/src/test/java/org/apache/camel/component/box/IBoxSearchManagerIntegrationTest.java +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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. - */ - -/* - * Camel Api Route test generated by camel-component-util-maven-plugin - * Generated on: Tue Jun 24 22:42:08 PDT 2014 - */ -package org.apache.camel.component.box; - -import java.util.HashMap; -import java.util.Map; - -import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.component.box.internal.BoxApiCollection; -import org.apache.camel.component.box.internal.IBoxSearchManagerApiMethod; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Test class for com.box.boxjavalibv2.resourcemanagers.IBoxSearchManager APIs. - */ -public class IBoxSearchManagerIntegrationTest extends AbstractBoxTestSupport { - - private static final Logger LOG = LoggerFactory.getLogger(IBoxSearchManagerIntegrationTest.class); - private static final String PATH_PREFIX = BoxApiCollection.getCollection().getApiName(IBoxSearchManagerApiMethod.class).getName(); - - @Test - public void testSearch() throws Exception { - final Map<String, Object> headers = new HashMap<String, Object>(); - // parameter type is String - headers.put("CamelBox.searchQuery", "Test"); - // parameter type is com.box.restclientv2.requestsbase.BoxDefaultRequestObject -// headers.put("CamelBox.defaultRequest", null); - - com.box.boxjavalibv2.dao.BoxCollection result = requestBodyAndHeaders("direct://SEARCH", null, headers); - assertNotNull("search result", result); - LOG.debug("search: " + result); - } - - @Override - protected RouteBuilder createRouteBuilder() throws Exception { - return new RouteBuilder() { - public void configure() { - // test route for search - from("direct://SEARCH") - .to("box://" + PATH_PREFIX + "/search"); - - } - }; - } -} http://git-wip-us.apache.org/repos/asf/camel/blob/b51280c8/components/camel-box/src/test/java/org/apache/camel/component/box/IBoxSharedItemsManagerIntegrationTest.java ---------------------------------------------------------------------- diff --git a/components/camel-box/src/test/java/org/apache/camel/component/box/IBoxSharedItemsManagerIntegrationTest.java b/components/camel-box/src/test/java/org/apache/camel/component/box/IBoxSharedItemsManagerIntegrationTest.java deleted file mode 100644 index 24bd890..0000000 --- a/components/camel-box/src/test/java/org/apache/camel/component/box/IBoxSharedItemsManagerIntegrationTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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. - */ -package org.apache.camel.component.box; - -import com.box.boxjavalibv2.dao.BoxItem; -import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.component.box.internal.BoxApiCollection; -import org.apache.camel.component.box.internal.IBoxSharedItemsManagerApiMethod; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Test class for com.box.boxjavalibv2.resourcemanagers.IBoxSharedItemsManager APIs. - */ -public class IBoxSharedItemsManagerIntegrationTest extends AbstractBoxTestSupport { - - private static final Logger LOG = LoggerFactory.getLogger(IBoxSharedItemsManagerIntegrationTest.class); - private static final String PATH_PREFIX = BoxApiCollection.getCollection().getApiName(IBoxSharedItemsManagerApiMethod.class).getName(); - - @Test - public void testGetSharedItem() throws Exception { - // using com.box.restclientv2.requestsbase.BoxDefaultRequestObject message body for single parameter "defaultRequest" - BoxItem result = requestBody("direct://GETSHAREDITEM", null); - - assertNotNull("getSharedItem result", result); - LOG.debug("getSharedItem: " + result); - } - - @Override - protected RouteBuilder createRouteBuilder() throws Exception { - return new RouteBuilder() { - public void configure() { - // test route for getSharedItem - from("direct://GETSHAREDITEM") - .to("box://" + PATH_PREFIX + "/getSharedItem?inBody=defaultRequest"); - - } - }; - } -} http://git-wip-us.apache.org/repos/asf/camel/blob/b51280c8/components/camel-box/src/test/java/org/apache/camel/component/box/IBoxUsersManagerIntegrationTest.java ---------------------------------------------------------------------- diff --git a/components/camel-box/src/test/java/org/apache/camel/component/box/IBoxUsersManagerIntegrationTest.java b/components/camel-box/src/test/java/org/apache/camel/component/box/IBoxUsersManagerIntegrationTest.java deleted file mode 100644 index a264178..0000000 --- a/components/camel-box/src/test/java/org/apache/camel/component/box/IBoxUsersManagerIntegrationTest.java +++ /dev/null @@ -1,280 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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. - */ - -/* - * Camel Api Route test generated by camel-component-util-maven-plugin - * Generated on: Tue Jun 24 22:42:08 PDT 2014 - */ -package org.apache.camel.component.box; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.box.boxjavalibv2.dao.BoxEmailAlias; -import com.box.boxjavalibv2.dao.BoxFolder; -import com.box.boxjavalibv2.dao.BoxUser; -import com.box.boxjavalibv2.requests.requestobjects.BoxEmailAliasRequestObject; -import com.box.boxjavalibv2.requests.requestobjects.BoxSimpleUserRequestObject; -import com.box.boxjavalibv2.requests.requestobjects.BoxUserDeleteRequestObject; -import com.box.boxjavalibv2.requests.requestobjects.BoxUserRequestObject; -import com.box.boxjavalibv2.requests.requestobjects.BoxUserUpdateLoginRequestObject; -import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.component.box.internal.BoxApiCollection; -import org.apache.camel.component.box.internal.IBoxUsersManagerApiMethod; -import org.junit.Ignore; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Test class for com.box.boxjavalibv2.resourcemanagers.IBoxUsersManager APIs. - */ -public class IBoxUsersManagerIntegrationTest extends AbstractBoxTestSupport { - - private static final Logger LOG = LoggerFactory.getLogger(IBoxUsersManagerIntegrationTest.class); - private static final String PATH_PREFIX = BoxApiCollection.getCollection().getApiName(IBoxUsersManagerApiMethod.class).getName(); - private static final String CAMEL_EMAIL_ALIAS = "camel.t...@localhost.com"; - private static final String UPDATED_EMAIL_ALIAS = "Updated." + CAMEL_EMAIL_ALIAS; - private static final String CAMEL_USER_NAME = "Camel User"; - private static final String CAMEL_JOB_TITLE = "Extreme Camel Rider"; - - @Ignore("Causes error Bad Request from SDK") - @Test - public void testAddEmailAlias() throws Exception { - final Map<String, Object> headers = new HashMap<String, Object>(); - // parameter type is String - headers.put("CamelBox.userId", testUserId); - // parameter type is com.box.boxjavalibv2.requests.requestobjects.BoxEmailAliasRequestObject - final BoxEmailAliasRequestObject requestObject = - BoxEmailAliasRequestObject.addEmailAliasRequestObject(CAMEL_EMAIL_ALIAS); - headers.put("CamelBox.emailAliasRequest", requestObject); - - BoxEmailAlias result = requestBodyAndHeaders("direct://ADDEMAILALIAS", null, headers); - - assertNotNull("addEmailAlias result", result); - LOG.debug("addEmailAlias: " + result); - - deleteEmailAlias(); - } - - public BoxUser createEnterpriseUser() throws Exception { - // using com.box.boxjavalibv2.requests.requestobjects.BoxUserRequestObject message body for single parameter "userRequest" - final BoxUserRequestObject enterpriseUserRequestObject = - BoxUserRequestObject.createEnterpriseUserRequestObject(CAMEL_EMAIL_ALIAS, CAMEL_USER_NAME); - BoxUser result = requestBody("direct://CREATEENTERPRISEUSER", enterpriseUserRequestObject); - - assertNotNull("createEnterpriseUser result", result); - return result; - } - - public void deleteEmailAlias() throws Exception { - final Map<String, Object> headers = new HashMap<String, Object>(); - // parameter type is String - headers.put("CamelBox.userId", testUserId); - // parameter type is String - headers.put("CamelBox.emailId", CAMEL_EMAIL_ALIAS); - // parameter type is com.box.restclientv2.requestsbase.BoxDefaultRequestObject -// headers.put("CamelBox.defaultRequest", null); - - requestBodyAndHeaders("direct://DELETEEMAILALIAS", null, headers); - } - - public void deleteEnterpriseUser(String userId) throws Exception { - final Map<String, Object> headers = new HashMap<String, Object>(); - // parameter type is String - headers.put("CamelBox.userId", userId); - // parameter type is com.box.boxjavalibv2.requests.requestobjects.BoxUserDeleteRequestObject - final BoxUserDeleteRequestObject requestObject = - BoxUserDeleteRequestObject.deleteEnterpriseUserRequestObject(false, true); - headers.put("CamelBox.userDeleteRequest", requestObject); - - requestBodyAndHeaders("direct://DELETEENTERPRISEUSER", null, headers); - // pause for user to be deleted completely - Thread.sleep(2000); - } - - @Test - public void testGetAllEnterpriseUser() throws Exception { - final Map<String, Object> headers = new HashMap<String, Object>(); - // parameter type is com.box.restclientv2.requestsbase.BoxDefaultRequestObject - headers.put("CamelBox.defaultRequest", null); - // parameter type is String - headers.put("CamelBox.filterTerm", null); - - List result = requestBodyAndHeaders("direct://GETALLENTERPRISEUSER", null, headers); - - assertNotNull("getAllEnterpriseUser result", result); - LOG.debug("getAllEnterpriseUser: " + result); - } - - @Test - public void testGetCurrentUser() throws Exception { - // using com.box.restclientv2.requestsbase.BoxDefaultRequestObject message body for single parameter "defaultRequest" - BoxUser result = requestBody("direct://GETCURRENTUSER", null); - - assertNotNull("getCurrentUser result", result); - LOG.debug("getCurrentUser: " + result); - } - - @Test - public void testGetEmailAliases() throws Exception { - final BoxUser enterpriseUser = createEnterpriseUser(); - - try { - final Map<String, Object> headers = new HashMap<String, Object>(); - // parameter type is String - headers.put("CamelBox.userId", enterpriseUser.getId()); - // parameter type is com.box.restclientv2.requestsbase.BoxDefaultRequestObject -// headers.put("CamelBox.defaultRequest", null); - - List result = requestBodyAndHeaders("direct://GETEMAILALIASES", null, headers); - - assertNotNull("getEmailAliases result", result); - LOG.debug("getEmailAliases: " + result); - } finally { - deleteEnterpriseUser(enterpriseUser.getId()); - } - } - - @Ignore("Developer account errors out with 'This does not currently support moving content into non-root folders'") - @Test - public void testMoveFolderToAnotherUser() throws Exception { - final BoxUser enterpriseUser = createEnterpriseUser(); - - try { - final String toUserId = enterpriseUser.getId(); - moveTestFolder(testUserId, toUserId); - moveTestFolder(toUserId, testUserId); - } finally { - deleteEnterpriseUser(enterpriseUser.getId()); - } - } - - private void moveTestFolder(String fromUserId, String toUserId) { - final Map<String, Object> headers = new HashMap<String, Object>(); - // parameter type is String - headers.put("CamelBox.userId", fromUserId); - // parameter type is String - headers.put("CamelBox.folderId", testFolderId); - // parameter type is com.box.boxjavalibv2.requests.requestobjects.BoxSimpleUserRequestObject - final BoxSimpleUserRequestObject requestObject = - BoxSimpleUserRequestObject.moveFolderToAnotherUserRequestEntity(toUserId, false); - headers.put("CamelBox.simpleUserRequest", requestObject); - - BoxFolder result = requestBodyAndHeaders("direct://MOVEFOLDERTOANOTHERUSER", null, headers); - - assertNotNull("moveFolderToAnotherUser result", result); - LOG.debug("moveFolderToAnotherUser: " + result); - } - - @Test - public void testUpdateUserInformaiton() throws Exception { - final BoxUser enterpriseUser = createEnterpriseUser(); - - try { - final Map<String, Object> headers = new HashMap<String, Object>(); - // parameter type is String - headers.put("CamelBox.userId", enterpriseUser.getId()); - // parameter type is com.box.boxjavalibv2.requests.requestobjects.BoxUserRequestObject - final BoxUserRequestObject requestObject = - BoxUserRequestObject.updateUserInfoRequestObject(false); - requestObject.setJobTitle(CAMEL_JOB_TITLE); - headers.put("CamelBox.userRequest", requestObject); - - BoxUser result = requestBodyAndHeaders("direct://UPDATEUSERINFORMAITON", null, headers); - - assertNotNull("updateUserInformaiton result", result); - assertEquals("updateUserInformaiton job title", CAMEL_JOB_TITLE, result.getJobTitle()); - LOG.debug("updateUserInformaiton: " + result); - } finally { - deleteEnterpriseUser(enterpriseUser.getId()); - } - } - - @Ignore("Requires multiple confirmed email aliases, do disabled by default") - @Test - public void testUpdateUserPrimaryLogin() throws Exception { - final BoxUser enterpriseUser = createEnterpriseUser(); - - try { - final Map<String, Object> headers = new HashMap<String, Object>(); - // parameter type is String - headers.put("CamelBox.userId", enterpriseUser.getId()); - // parameter type is com.box.boxjavalibv2.requests.requestobjects.BoxUserUpdateLoginRequestObject - final BoxUserUpdateLoginRequestObject requestObject = - BoxUserUpdateLoginRequestObject.updateUserPrimaryLoginRequestObject(UPDATED_EMAIL_ALIAS); - headers.put("CamelBox.userUpdateLoginRequest", requestObject); - - BoxUser result = requestBodyAndHeaders("direct://UPDATEUSERPRIMARYLOGIN", null, headers); - - assertNotNull("updateUserPrimaryLogin result", result); - assertEquals("updateUserPrimaryLogin primary login", UPDATED_EMAIL_ALIAS, result.getLogin()); - LOG.debug("updateUserPrimaryLogin: " + result); - } finally { - deleteEnterpriseUser(enterpriseUser.getId()); - } - } - - @Override - protected RouteBuilder createRouteBuilder() throws Exception { - return new RouteBuilder() { - public void configure() { - // test route for addEmailAlias - from("direct://ADDEMAILALIAS") - .to("box://" + PATH_PREFIX + "/addEmailAlias"); - - // test route for createEnterpriseUser - from("direct://CREATEENTERPRISEUSER") - .to("box://" + PATH_PREFIX + "/createEnterpriseUser?inBody=userRequest"); - - // test route for deleteEmailAlias - from("direct://DELETEEMAILALIAS") - .to("box://" + PATH_PREFIX + "/deleteEmailAlias"); - - // test route for deleteEnterpriseUser - from("direct://DELETEENTERPRISEUSER") - .to("box://" + PATH_PREFIX + "/deleteEnterpriseUser"); - - // test route for getAllEnterpriseUser - from("direct://GETALLENTERPRISEUSER") - .to("box://" + PATH_PREFIX + "/getAllEnterpriseUser"); - - // test route for getCurrentUser - from("direct://GETCURRENTUSER") - .to("box://" + PATH_PREFIX + "/getCurrentUser?inBody=defaultRequest"); - - // test route for getEmailAliases - from("direct://GETEMAILALIASES") - .to("box://" + PATH_PREFIX + "/getEmailAliases"); - - // test route for moveFolderToAnotherUser - from("direct://MOVEFOLDERTOANOTHERUSER") - .to("box://" + PATH_PREFIX + "/moveFolderToAnotherUser"); - - // test route for updateUserInformaiton - from("direct://UPDATEUSERINFORMAITON") - .to("box://" + PATH_PREFIX + "/updateUserInformaiton"); - - // test route for updateUserPrimaryLogin - from("direct://UPDATEUSERPRIMARYLOGIN") - .to("box://" + PATH_PREFIX + "/updateUserPrimaryLogin"); - - } - }; - } -} http://git-wip-us.apache.org/repos/asf/camel/blob/b51280c8/components/camel-box/src/test/java/org/apache/camel/component/box/InvalidClientIdIntegrationTest.java ---------------------------------------------------------------------- diff --git a/components/camel-box/src/test/java/org/apache/camel/component/box/InvalidClientIdIntegrationTest.java b/components/camel-box/src/test/java/org/apache/camel/component/box/InvalidClientIdIntegrationTest.java deleted file mode 100644 index 8216b5a..0000000 --- a/components/camel-box/src/test/java/org/apache/camel/component/box/InvalidClientIdIntegrationTest.java +++ /dev/null @@ -1,83 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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. - */ -package org.apache.camel.component.box; - -import org.apache.camel.CamelContext; -import org.apache.camel.FailedToCreateRouteException; -import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.component.box.internal.BoxApiCollection; -import org.apache.camel.component.box.internal.IBoxSharedItemsManagerApiMethod; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Test Box component configuration. - */ -public class InvalidClientIdIntegrationTest extends AbstractBoxTestSupport { - - private static final Logger LOG = LoggerFactory.getLogger(InvalidClientIdIntegrationTest.class); - private static final String PATH_PREFIX = BoxApiCollection.getCollection().getApiName(IBoxSharedItemsManagerApiMethod.class).getName(); - - @Override - protected CamelContext createCamelContext() throws Exception { - final CamelContext camelContext = super.createCamelContext(); - - // set client_id to an invalid value - final BoxConfiguration configuration = camelContext.getComponent("box", BoxComponent.class).getConfiguration(); - configuration.setClientId("bad_client_id"); - - // also remove auth secure storage to avoid loading a stored token - configuration.setAuthSecureStorage(null); - - return camelContext; - } - - @Override - protected void startCamelContext() throws Exception { - // should throw an exception on start - try { - super.startCamelContext(); - fail("Invalid client id MUST cause an IllegalArgumentException on startup"); - } catch (FailedToCreateRouteException e) { - Throwable t = e; - while (t.getCause() != null && t.getCause() != e) { - t = t.getCause(); - } - assertNotNull("root cause exception", t); - assertEquals("illegal argument exception", IllegalArgumentException.class, t.getClass()); - LOG.debug("Caught expected exception {}", t.getMessage()); - } - } - - @Test - public void testInvalidClientId() throws Exception { - // do nothing - } - - @Override - protected RouteBuilder createRouteBuilder() throws Exception { - return new RouteBuilder() { - @Override - public void configure() throws Exception { - // dummy route to force box component startup - from("direct://GETSHAREDITEM") - .to("box://" + PATH_PREFIX + "/getSharedItem?inBody=defaultRequest"); - } - }; - } -}