Repository: camel Updated Branches: refs/heads/master cfe30492d -> cb1c757ff
http://git-wip-us.apache.org/repos/asf/camel/blob/b51280c8/components/camel-box/src/test/java/org/apache/camel/component/box/LongPollingEventsManagerIntegrationTest.java ---------------------------------------------------------------------- diff --git a/components/camel-box/src/test/java/org/apache/camel/component/box/LongPollingEventsManagerIntegrationTest.java b/components/camel-box/src/test/java/org/apache/camel/component/box/LongPollingEventsManagerIntegrationTest.java deleted file mode 100644 index ecef86a..0000000 --- a/components/camel-box/src/test/java/org/apache/camel/component/box/LongPollingEventsManagerIntegrationTest.java +++ /dev/null @@ -1,125 +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 java.util.concurrent.TimeUnit; - -import com.box.boxjavalibv2.dao.BoxEvent; -import com.box.boxjavalibv2.dao.BoxFile; -import com.box.boxjavalibv2.requests.requestobjects.BoxItemCopyRequestObject; -import org.apache.camel.CamelContext; -import org.apache.camel.Exchange; -import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.component.box.internal.BoxApiName; -import org.apache.camel.component.box.internal.BoxConstants; -import org.apache.camel.component.mock.MockEndpoint; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Test class for org.apache.camel.component.box.internal.LongPollingEventsManager APIs. - */ -public class LongPollingEventsManagerIntegrationTest extends AbstractBoxTestSupport { - - private static final Logger LOG = LoggerFactory.getLogger(LongPollingEventsManagerIntegrationTest.class); - - @Test - public void testPoll() throws Exception { - - // generate file copy event - final Map<String, Object> headers = new HashMap<String, Object>(); - headers.put("CamelBox.fileId", testFileId); - 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); - - // generate file delete event - headers.clear(); - headers.put("CamelBox.fileId", result.getId()); - headers.put("CamelBox.defaultRequest", null); - requestBodyAndHeaders("direct://DELETEFILE", null, headers); - - MockEndpoint mockEndpoint = getMockEndpoint("mock:boxEvents"); - mockEndpoint.expectedMinimumMessageCount(2); - mockEndpoint.setResultWaitTime(TimeUnit.MILLISECONDS.convert(30, TimeUnit.SECONDS)); - mockEndpoint.assertIsSatisfied(); - - final List<Exchange> exchanges = mockEndpoint.getExchanges(); - assertNotNull("poll result", exchanges); - assertFalse("poll result", exchanges.isEmpty()); - LOG.debug("poll result: " + exchanges); - - for (Exchange exchange : exchanges) { - - assertNotNull("poll result " + BoxConstants.CHUNK_SIZE_PROPERTY, - exchange.getIn().getHeader(BoxConstants.CHUNK_SIZE_PROPERTY)); - assertNotNull("poll result " + BoxConstants.NEXT_STREAM_POSITION_PROPERTY, - exchange.getIn().getHeader(BoxConstants.NEXT_STREAM_POSITION_PROPERTY)); - - final Object body = exchange.getIn().getBody(); - assertNotNull("poll result body", body); - assertEquals("poll result body type", BoxEvent.class, body.getClass()); - - final String eventType = ((BoxEvent) body).getEventType(); - assertTrue("poll result type", - BoxEvent.EVENT_TYPE_ITEM_COPY.equals(eventType) || BoxEvent.EVENT_TYPE_ITEM_TRASH.equals(eventType)); - } - } - - @Override - protected RouteBuilder createRouteBuilder() throws Exception { - return new RouteBuilder() { - public void configure() { - // test route for copyFile - from("direct://COPYFILE") - .to("box://" + BoxApiName.FILES.getName() + "/copyFile"); - - // test route for deleteFile - from("direct://DELETEFILE") - .to("box://" + BoxApiName.FILES.getName() + "/deleteFile"); - - // test route for poll - from("box://" + BoxApiName.POLL_EVENTS.getName() + "/poll?streamPosition=-1&streamType=all&limit=100") - .to("mock:boxEvents"); - - } - }; - } - - @Override - protected CamelContext createCamelContext() throws Exception { - // also test revoke on shutdown - final CamelContext camelContext = super.createCamelContext(); - final BoxComponent box = (BoxComponent) camelContext.getComponent("box"); - box.getConfiguration().setRevokeOnShutdown(true); - return camelContext; - } -} http://git-wip-us.apache.org/repos/asf/camel/blob/b51280c8/components/camel-box/src/test/resources/log4j2.properties ---------------------------------------------------------------------- diff --git a/components/camel-box/src/test/resources/log4j2.properties b/components/camel-box/src/test/resources/log4j2.properties deleted file mode 100644 index 438063a..0000000 --- a/components/camel-box/src/test/resources/log4j2.properties +++ /dev/null @@ -1,28 +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. -## --------------------------------------------------------------------------- - -appender.file.type = File -appender.file.name = file -appender.file.fileName = target/camel-box-test.log -appender.file.layout.type = PatternLayout -appender.file.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n -appender.out.type = Console -appender.out.name = out -appender.out.layout.type = PatternLayout -appender.out.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n -rootLogger.level = INFO -rootLogger.appenderRef.file.ref = file http://git-wip-us.apache.org/repos/asf/camel/blob/b51280c8/components/camel-box/src/test/resources/test-options.properties ---------------------------------------------------------------------- diff --git a/components/camel-box/src/test/resources/test-options.properties b/components/camel-box/src/test/resources/test-options.properties deleted file mode 100644 index 966cee4..0000000 --- a/components/camel-box/src/test/resources/test-options.properties +++ /dev/null @@ -1,45 +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. -# - -##################################### -## Login properties for Box Component -##################################### -## User name and password -## Create a free developer account on http://developers.box.com/ and provide user name password -userName= -userPassword= -## Application client id and secret -## Create a test Box.com application and provide its clientId and clientSecret -clientId= -clientSecret= -## Shared link and password for shared resources -## Create a shared link and password for a Test Folder or File -sharedLink= -sharedPassword= -############## -## Test values -############## -## OAuth refresh token to avoid authorizing every time -## This can either be provided manually or will be generated under target/test-classes/test-options.properties -refreshToken= -## Create a test folder and a test file -## These ids can be obtained by running the test IBoxFoldersManagerIntegrationTest.testGetFolderItems() -testFolderId= -testFileId= -## Test user id -## This can be obtained by running the test IBoxUsersManagerIntegrationTest.testGetCurrentUser() -testUserId=