CAMEL-10052: Spring-boot integration tests
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/c39b9558 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/c39b9558 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/c39b9558 Branch: refs/heads/master Commit: c39b95580ce8fc4d1335d5e43b7d7e3feacb6848 Parents: 4692110 Author: Nicola Ferraro <[email protected]> Authored: Wed Jun 15 14:43:03 2016 +0200 Committer: Claus Ibsen <[email protected]> Committed: Wed Jun 15 15:40:20 2016 +0200 ---------------------------------------------------------------------- tests/camel-itest-spring-boot/pom.xml | 137 +++++++++++ .../springboot/ApplicationContextHolder.java | 71 ++++++ .../apache/camel/itest/springboot/Command.java | 26 ++ .../camel/itest/springboot/CommandRouter.java | 53 +++++ .../itest/springboot/ITestApplication.java | 39 +++ .../camel/itest/springboot/ITestConfig.java | 147 ++++++++++++ .../itest/springboot/ITestConfigBuilder.java | 146 ++++++++++++ .../springboot/command/AbstractTestCommand.java | 49 ++++ .../command/ComponentTestCommand.java | 52 ++++ .../command/DataFormatTestCommand.java | 53 +++++ .../springboot/command/LanguageTestCommand.java | 53 +++++ .../springboot/command/UnitTestCommand.java | 135 +++++++++++ .../springboot/command/UnitTestResult.java | 91 +++++++ .../springboot/util/SerializationUtils.java | 71 ++++++ .../AbstractSpringBootTestSupport.java | 107 +++++++++ .../camel/itest/springboot/CamelAhcTest.java | 47 ++++ .../camel/itest/springboot/CamelAhcWsTest.java | 48 ++++ .../camel/itest/springboot/CamelAmqpTest.java | 48 ++++ .../camel/itest/springboot/CamelApnsTest.java | 47 ++++ .../camel/itest/springboot/CamelAtmosTest.java | 48 ++++ .../CamelAtmosphereWebsocketTest.java | 48 ++++ .../camel/itest/springboot/CamelAtomTest.java | 48 ++++ .../camel/itest/springboot/CamelAvroTest.java | 47 ++++ .../camel/itest/springboot/CamelAwsTest.java | 56 +++++ .../camel/itest/springboot/CamelBamTest.java | 48 ++++ .../itest/springboot/CamelBarcodeTest.java | 48 ++++ .../camel/itest/springboot/CamelBase64Test.java | 48 ++++ .../springboot/CamelBeanValidatorTest.java | 48 ++++ .../camel/itest/springboot/CamelBeanioTest.java | 48 ++++ .../itest/springboot/CamelBeanstalkTest.java | 48 ++++ .../camel/itest/springboot/CamelBindyTest.java | 50 ++++ .../itest/springboot/CamelBlueprintTest.java | 48 ++++ .../camel/itest/springboot/CamelBoonTest.java | 48 ++++ .../camel/itest/springboot/CamelBoxTest.java | 48 ++++ .../itest/springboot/CamelBraintreeTest.java | 48 ++++ .../camel/itest/springboot/CamelCacheTest.java | 48 ++++ .../itest/springboot/CamelCassandraqlTest.java | 48 ++++ .../camel/itest/springboot/CamelCastorTest.java | 48 ++++ .../camel/itest/springboot/CamelCdiTest.java | 49 ++++ .../camel/itest/springboot/CamelChunkTest.java | 48 ++++ .../camel/itest/springboot/CamelCmSmsTest.java | 48 ++++ .../camel/itest/springboot/CamelCmisTest.java | 51 ++++ .../camel/itest/springboot/CamelCoapTest.java | 48 ++++ .../camel/itest/springboot/CamelCometdTest.java | 48 ++++ .../camel/itest/springboot/CamelConsulTest.java | 48 ++++ .../itest/springboot/CamelContextTest.java | 48 ++++ .../itest/springboot/CamelCoreOsgiTest.java | 48 ++++ .../itest/springboot/CamelCoreXmlTest.java | 49 ++++ .../itest/springboot/CamelCouchdbTest.java | 48 ++++ .../camel/itest/springboot/CamelCryptoTest.java | 48 ++++ .../camel/itest/springboot/CamelCsvTest.java | 48 ++++ .../camel/itest/springboot/CamelCxfTest.java | 51 ++++ .../itest/springboot/CamelCxfTransportTest.java | 48 ++++ .../itest/springboot/CamelDisruptorTest.java | 50 ++++ .../camel/itest/springboot/CamelDnsTest.java | 48 ++++ .../camel/itest/springboot/CamelDockerTest.java | 48 ++++ .../camel/itest/springboot/CamelDozerTest.java | 48 ++++ .../itest/springboot/CamelDropboxTest.java | 48 ++++ .../itest/springboot/CamelEclipseTest.java | 49 ++++ .../itest/springboot/CamelEhcacheTest.java | 48 ++++ .../camel/itest/springboot/CamelEjbTest.java | 48 ++++ .../springboot/CamelElasticsearchTest.java | 48 ++++ .../camel/itest/springboot/CamelElsqlTest.java | 48 ++++ .../camel/itest/springboot/CamelEtcdTest.java | 50 ++++ .../itest/springboot/CamelEventadminTest.java | 51 ++++ .../camel/itest/springboot/CamelExecTest.java | 48 ++++ .../itest/springboot/CamelFacebookTest.java | 49 ++++ .../itest/springboot/CamelFlatpackTest.java | 48 ++++ .../camel/itest/springboot/CamelFlinkTest.java | 48 ++++ .../camel/itest/springboot/CamelFopTest.java | 48 ++++ .../itest/springboot/CamelFreemarkerTest.java | 48 ++++ .../camel/itest/springboot/CamelFtpTest.java | 50 ++++ .../itest/springboot/CamelGangliaTest.java | 48 ++++ .../itest/springboot/CamelGeocoderTest.java | 48 ++++ .../camel/itest/springboot/CamelGitTest.java | 48 ++++ .../camel/itest/springboot/CamelGithubTest.java | 48 ++++ .../springboot/CamelGoogleCalendarTest.java | 48 ++++ .../itest/springboot/CamelGoogleDriveTest.java | 48 ++++ .../itest/springboot/CamelGoogleMailTest.java | 48 ++++ .../camel/itest/springboot/CamelGoraTest.java | 48 ++++ .../camel/itest/springboot/CamelGrapeTest.java | 48 ++++ .../camel/itest/springboot/CamelGroovyTest.java | 49 ++++ .../camel/itest/springboot/CamelGsonTest.java | 48 ++++ .../springboot/CamelGuavaEventbusTest.java | 48 ++++ .../camel/itest/springboot/CamelGuiceTest.java | 48 ++++ .../camel/itest/springboot/CamelHawtdbTest.java | 48 ++++ .../itest/springboot/CamelHazelcastTest.java | 48 ++++ .../camel/itest/springboot/CamelHbaseTest.java | 48 ++++ .../camel/itest/springboot/CamelHdfs2Test.java | 48 ++++ .../camel/itest/springboot/CamelHdfsTest.java | 48 ++++ .../itest/springboot/CamelHessianTest.java | 48 ++++ .../itest/springboot/CamelHipchatTest.java | 48 ++++ .../camel/itest/springboot/CamelHl7Test.java | 48 ++++ .../camel/itest/springboot/CamelHttp4Test.java | 48 ++++ .../itest/springboot/CamelHttpCommonTest.java | 48 ++++ .../camel/itest/springboot/CamelHttpTest.java | 48 ++++ .../itest/springboot/CamelHystrixTest.java | 48 ++++ .../camel/itest/springboot/CamelIbatisTest.java | 48 ++++ .../camel/itest/springboot/CamelIcalTest.java | 48 ++++ .../camel/itest/springboot/CamelIgniteTest.java | 48 ++++ .../itest/springboot/CamelInfinispanTest.java | 48 ++++ .../camel/itest/springboot/CamelIrcTest.java | 48 ++++ .../camel/itest/springboot/CamelIronmqTest.java | 48 ++++ .../itest/springboot/CamelJacksonTest.java | 48 ++++ .../itest/springboot/CamelJacksonxmlTest.java | 48 ++++ .../camel/itest/springboot/CamelJasyptTest.java | 48 ++++ .../itest/springboot/CamelJavaspaceTest.java | 48 ++++ .../camel/itest/springboot/CamelJaxbTest.java | 48 ++++ .../camel/itest/springboot/CamelJbpmTest.java | 48 ++++ .../camel/itest/springboot/CamelJcacheTest.java | 48 ++++ .../itest/springboot/CamelJcloudsTest.java | 48 ++++ .../camel/itest/springboot/CamelJcrTest.java | 48 ++++ .../camel/itest/springboot/CamelJdbcTest.java | 48 ++++ .../camel/itest/springboot/CamelJetty9Test.java | 48 ++++ .../itest/springboot/CamelJettyCommonTest.java | 48 ++++ .../camel/itest/springboot/CamelJettyTest.java | 48 ++++ .../itest/springboot/CamelJgroupsTest.java | 48 ++++ .../camel/itest/springboot/CamelJibxTest.java | 48 ++++ .../camel/itest/springboot/CamelJingTest.java | 48 ++++ .../camel/itest/springboot/CamelJiraTest.java | 48 ++++ .../camel/itest/springboot/CamelJmsTest.java | 48 ++++ .../camel/itest/springboot/CamelJmxTest.java | 48 ++++ .../camel/itest/springboot/CamelJoltTest.java | 48 ++++ .../camel/itest/springboot/CamelJosqlTest.java | 49 ++++ .../camel/itest/springboot/CamelJpaTest.java | 48 ++++ .../camel/itest/springboot/CamelJschTest.java | 48 ++++ .../itest/springboot/CamelJsonpathTest.java | 48 ++++ .../camel/itest/springboot/CamelJt400Test.java | 48 ++++ .../camel/itest/springboot/CamelJuelTest.java | 48 ++++ .../camel/itest/springboot/CamelJxpathTest.java | 48 ++++ .../camel/itest/springboot/CamelKafkaTest.java | 48 ++++ .../itest/springboot/CamelKestrelTest.java | 48 ++++ .../camel/itest/springboot/CamelKratiTest.java | 48 ++++ .../itest/springboot/CamelKubernetesTest.java | 48 ++++ .../camel/itest/springboot/CamelKuraTest.java | 48 ++++ .../camel/itest/springboot/CamelLdapTest.java | 48 ++++ .../itest/springboot/CamelLeveldbTest.java | 48 ++++ .../itest/springboot/CamelLinkedinTest.java | 48 ++++ .../camel/itest/springboot/CamelLuceneTest.java | 48 ++++ .../camel/itest/springboot/CamelLzfTest.java | 49 ++++ .../camel/itest/springboot/CamelMailTest.java | 51 ++++ .../itest/springboot/CamelMetricsTest.java | 48 ++++ .../camel/itest/springboot/CamelMina2Test.java | 48 ++++ .../camel/itest/springboot/CamelMinaTest.java | 48 ++++ .../camel/itest/springboot/CamelMllpTest.java | 48 ++++ .../springboot/CamelMongodbGridfsTest.java | 48 ++++ .../itest/springboot/CamelMongodbTest.java | 48 ++++ .../camel/itest/springboot/CamelMqttTest.java | 48 ++++ .../camel/itest/springboot/CamelMsvTest.java | 48 ++++ .../itest/springboot/CamelMustacheTest.java | 48 ++++ .../camel/itest/springboot/CamelMvelTest.java | 48 ++++ .../itest/springboot/CamelMybatisTest.java | 48 ++++ .../camel/itest/springboot/CamelNagiosTest.java | 48 ++++ .../camel/itest/springboot/CamelNatsTest.java | 48 ++++ .../itest/springboot/CamelNetty4HttpTest.java | 48 ++++ .../camel/itest/springboot/CamelNetty4Test.java | 48 ++++ .../itest/springboot/CamelNettyHttpTest.java | 48 ++++ .../camel/itest/springboot/CamelNettyTest.java | 48 ++++ .../camel/itest/springboot/CamelOgnlTest.java | 48 ++++ .../itest/springboot/CamelOlingo2Test.java | 48 ++++ .../itest/springboot/CamelOpenshiftTest.java | 48 ++++ .../itest/springboot/CamelOptaplannerTest.java | 48 ++++ .../camel/itest/springboot/CamelPahoTest.java | 48 ++++ .../itest/springboot/CamelPaxloggingTest.java | 50 ++++ .../camel/itest/springboot/CamelPdfTest.java | 48 ++++ .../itest/springboot/CamelPgeventTest.java | 48 ++++ .../itest/springboot/CamelPrinterTest.java | 48 ++++ .../itest/springboot/CamelProtobufTest.java | 48 ++++ .../itest/springboot/CamelQuartz2Test.java | 48 ++++ .../camel/itest/springboot/CamelQuartzTest.java | 48 ++++ .../itest/springboot/CamelQuickfixTest.java | 48 ++++ .../itest/springboot/CamelRabbitmqTest.java | 48 ++++ .../itest/springboot/CamelRestletTest.java | 48 ++++ .../camel/itest/springboot/CamelRmiTest.java | 48 ++++ .../itest/springboot/CamelRouteboxTest.java | 48 ++++ .../camel/itest/springboot/CamelRssTest.java | 48 ++++ .../camel/itest/springboot/CamelRubyTest.java | 48 ++++ .../camel/itest/springboot/CamelRxTest.java | 48 ++++ .../itest/springboot/CamelSalesforceTest.java | 48 ++++ .../itest/springboot/CamelSapNetweaverTest.java | 48 ++++ .../camel/itest/springboot/CamelSaxonTest.java | 50 ++++ .../camel/itest/springboot/CamelScalaTest.java | 48 ++++ .../itest/springboot/CamelSchematronTest.java | 48 ++++ .../camel/itest/springboot/CamelScrTest.java | 48 ++++ .../camel/itest/springboot/CamelScriptTest.java | 52 ++++ .../itest/springboot/CamelServicenowTest.java | 48 ++++ .../itest/springboot/CamelServletTest.java | 48 ++++ .../springboot/CamelServletlistenerTest.java | 48 ++++ .../camel/itest/springboot/CamelShiroTest.java | 48 ++++ .../camel/itest/springboot/CamelSipTest.java | 48 ++++ .../camel/itest/springboot/CamelSjmsTest.java | 48 ++++ .../camel/itest/springboot/CamelSlackTest.java | 48 ++++ .../camel/itest/springboot/CamelSmppTest.java | 48 ++++ .../itest/springboot/CamelSnakeyamlTest.java | 49 ++++ .../camel/itest/springboot/CamelSnmpTest.java | 48 ++++ .../camel/itest/springboot/CamelSoapTest.java | 49 ++++ .../camel/itest/springboot/CamelSolrTest.java | 48 ++++ .../itest/springboot/CamelSparkRestTest.java | 48 ++++ .../camel/itest/springboot/CamelSparkTest.java | 48 ++++ .../camel/itest/springboot/CamelSplunkTest.java | 48 ++++ .../itest/springboot/CamelSpringBatchTest.java | 48 ++++ .../springboot/CamelSpringBootStarterTest.java | 48 ++++ .../itest/springboot/CamelSpringBootTest.java | 48 ++++ .../itest/springboot/CamelSpringDmTest.java | 48 ++++ .../springboot/CamelSpringIntegrationTest.java | 48 ++++ .../springboot/CamelSpringJavaconfigTest.java | 48 ++++ .../itest/springboot/CamelSpringLdapTest.java | 48 ++++ .../itest/springboot/CamelSpringRedisTest.java | 48 ++++ .../springboot/CamelSpringSecurityTest.java | 48 ++++ .../camel/itest/springboot/CamelSpringTest.java | 48 ++++ .../itest/springboot/CamelSpringWsTest.java | 48 ++++ .../camel/itest/springboot/CamelSqlTest.java | 48 ++++ .../camel/itest/springboot/CamelSshTest.java | 48 ++++ .../camel/itest/springboot/CamelStaxTest.java | 48 ++++ .../camel/itest/springboot/CamelStompTest.java | 48 ++++ .../camel/itest/springboot/CamelStreamTest.java | 48 ++++ .../springboot/CamelStringtemplateTest.java | 48 ++++ .../itest/springboot/CamelSwaggerJavaTest.java | 48 ++++ .../itest/springboot/CamelSwaggerTest.java | 48 ++++ .../camel/itest/springboot/CamelSyslogTest.java | 48 ++++ .../itest/springboot/CamelTagsoupTest.java | 48 ++++ .../itest/springboot/CamelTarfileTest.java | 48 ++++ .../itest/springboot/CamelTelegramTest.java | 47 ++++ .../itest/springboot/CamelTwitterTest.java | 49 ++++ .../itest/springboot/CamelUndertowTest.java | 48 ++++ .../springboot/CamelUnivocityParsersTest.java | 51 ++++ .../itest/springboot/CamelUrlrewriteTest.java | 48 ++++ .../itest/springboot/CamelVelocityTest.java | 48 ++++ .../camel/itest/springboot/CamelVertxTest.java | 48 ++++ .../itest/springboot/CamelWeatherTest.java | 47 ++++ .../itest/springboot/CamelWebsocketTest.java | 47 ++++ .../itest/springboot/CamelXmlbeansTest.java | 47 ++++ .../itest/springboot/CamelXmljsonTest.java | 47 ++++ .../camel/itest/springboot/CamelXmlrpcTest.java | 47 ++++ .../itest/springboot/CamelXmlsecurityTest.java | 47 ++++ .../camel/itest/springboot/CamelXmppTest.java | 47 ++++ .../itest/springboot/CamelXstreamTest.java | 49 ++++ .../camel/itest/springboot/CamelYammerTest.java | 47 ++++ .../itest/springboot/CamelZipfileTest.java | 47 ++++ .../springboot/CamelZipkinStarterTest.java | 48 ++++ .../camel/itest/springboot/CamelZipkinTest.java | 48 ++++ .../itest/springboot/CamelZookeeperTest.java | 48 ++++ .../ArquillianSyncBootJarLauncher.java | 55 +++++ .../SpringBootZipExporterDelegate.java | 51 ++++ .../arquillian/SpringBootZipExporterImpl.java | 45 ++++ .../SpringBootZipOnDemandInputStream.java | 224 ++++++++++++++++++ .../springboot/util/ArquillianPackager.java | 237 +++++++++++++++++++ .../itest/springboot/util/JarExporter.java | 44 ++++ .../util/SpringBootContainerFacade.java | 65 +++++ .../src/test/resources/BOOT-MANIFEST.MF | 3 + .../test/resources/spring-boot-itest.properties | 9 + tests/pom.xml | 8 + 252 files changed, 12904 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/c39b9558/tests/camel-itest-spring-boot/pom.xml ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/pom.xml b/tests/camel-itest-spring-boot/pom.xml new file mode 100644 index 0000000..b53b612 --- /dev/null +++ b/tests/camel-itest-spring-boot/pom.xml @@ -0,0 +1,137 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <artifactId>tests</artifactId> + <groupId>org.apache.camel</groupId> + <version>2.18-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + + <artifactId>camel-itest-spring-boot</artifactId> + + <name>Camel :: Integration Tests :: Spring-Boot</name> + <description>Spring-Boot Camel test</description> + + + <properties> + <arquillian.version>1.1.11.Final</arquillian.version> + <arquillian-container.version>1.0.0.Final</arquillian-container.version> + <shrinkwrap.version>1.2.3</shrinkwrap.version> + <shrinkwrap-resolver.version>2.2.2</shrinkwrap-resolver.version> + </properties> + + <dependencies> + + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-spring-boot-starter</artifactId> + </dependency> + + <!-- Dependency needed to incorporate classes in main jar --> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-loader</artifactId> + <version>${spring-boot-version}</version> + </dependency> + + <!-- Test dependencies needed also at compile/unitTestEnabled time --> + <dependency> + <groupId>org.jboss.shrinkwrap</groupId> + <artifactId>shrinkwrap-api</artifactId> + <version>${shrinkwrap.version}</version> + </dependency> + + <dependency> + <groupId>org.jboss.shrinkwrap</groupId> + <artifactId>shrinkwrap-impl-base</artifactId> + <version>${shrinkwrap.version}</version> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </dependency> + + <!-- Test dependencies --> + <dependency> + <groupId>org.jboss.arquillian.junit</groupId> + <artifactId>arquillian-junit-container</artifactId> + <version>${arquillian.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.jboss.arquillian.container</groupId> + <artifactId>container-se-managed</artifactId> + <version>${arquillian-container.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.jboss.shrinkwrap.resolver</groupId> + <artifactId>shrinkwrap-resolver-api</artifactId> + <version>${shrinkwrap-resolver.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.jboss.shrinkwrap.resolver</groupId> + <artifactId>shrinkwrap-resolver-spi</artifactId> + <version>${shrinkwrap-resolver.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.jboss.shrinkwrap.resolver</groupId> + <artifactId>shrinkwrap-resolver-api-maven</artifactId> + <version>${shrinkwrap-resolver.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.jboss.shrinkwrap.resolver</groupId> + <artifactId>shrinkwrap-resolver-spi-maven</artifactId> + <version>${shrinkwrap-resolver.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.jboss.shrinkwrap.resolver</groupId> + <artifactId>shrinkwrap-resolver-api-maven-archive</artifactId> + <version>${shrinkwrap-resolver.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.jboss.shrinkwrap.resolver</groupId> + <artifactId>shrinkwrap-resolver-impl-maven</artifactId> + <version>${shrinkwrap-resolver.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.jboss.shrinkwrap.resolver</groupId> + <artifactId>shrinkwrap-resolver-impl-maven-archive</artifactId> + <version>${shrinkwrap-resolver.version}</version> + <scope>test</scope> + </dependency> + + </dependencies> + + <build> + <plugins> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <childDelegation>false</childDelegation> + <forkedProcessTimeoutInSeconds>15000</forkedProcessTimeoutInSeconds> + <includes> + <include>**/*Test.java</include> + </includes> + </configuration> + </plugin> + </plugins> + </build> + +</project> http://git-wip-us.apache.org/repos/asf/camel/blob/c39b9558/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/ApplicationContextHolder.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/ApplicationContextHolder.java b/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/ApplicationContextHolder.java new file mode 100644 index 0000000..1885e62 --- /dev/null +++ b/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/ApplicationContextHolder.java @@ -0,0 +1,71 @@ +/** + * 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.itest.springboot; + +import org.springframework.beans.BeansException; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.stereotype.Component; + +/** + * receives a spring-context and make it available to classes outside the spring scope. + */ +@Component +public class ApplicationContextHolder implements ApplicationContextAware { + + private static ApplicationContext context; + + private static long contextMaxWaitTime = 60000L; + + @Override + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { + synchronized (ApplicationContextHolder.class) { + ApplicationContextHolder.context = applicationContext; + ApplicationContextHolder.class.notifyAll(); + } + } + + public static ApplicationContext getApplicationContext() throws InterruptedException { + waitForContextReady(); + return context; + } + + private static void waitForContextReady() throws InterruptedException { + long maxWait = contextMaxWaitTime; + long deadline = System.currentTimeMillis() + maxWait; + synchronized (ApplicationContextHolder.class) { + long time = System.currentTimeMillis(); + while (time < deadline && context == null) { + ApplicationContextHolder.class.wait(deadline - time); + time = System.currentTimeMillis(); + } + + if (context == null) { + throw new IllegalStateException("No spring context available after " + maxWait + " millis"); + } + } + } + + public static long getContextMaxWaitTime() { + return contextMaxWaitTime; + } + + public static void setContextMaxWaitTime(long contextMaxWaitTime) { + ApplicationContextHolder.contextMaxWaitTime = contextMaxWaitTime; + } + +} http://git-wip-us.apache.org/repos/asf/camel/blob/c39b9558/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/Command.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/Command.java b/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/Command.java new file mode 100644 index 0000000..c550905 --- /dev/null +++ b/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/Command.java @@ -0,0 +1,26 @@ +/** + * 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.itest.springboot; + +/** + * Represents a generic command that can be executed in the spring-boot context. + */ +public interface Command { + + Object execute(Object[] parameters) throws Exception; + +} http://git-wip-us.apache.org/repos/asf/camel/blob/c39b9558/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/CommandRouter.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/CommandRouter.java b/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/CommandRouter.java new file mode 100644 index 0000000..b0273af --- /dev/null +++ b/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/CommandRouter.java @@ -0,0 +1,53 @@ +/** + * 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.itest.springboot; + +import org.springframework.context.ApplicationContext; + +import static org.apache.camel.itest.springboot.util.SerializationUtils.marshal; +import static org.apache.camel.itest.springboot.util.SerializationUtils.transferable; +import static org.apache.camel.itest.springboot.util.SerializationUtils.unmarshal; + +/** + * Routes a command coming from another classloader to the appropriate spring bean. + */ +public final class CommandRouter { + + private CommandRouter() { + } + + public static byte[] execute(String commandStr, byte[] params) { + + try { + ApplicationContext context = ApplicationContextHolder.getApplicationContext(); + + Command command = (Command) context.getBean(commandStr); + + Object[] args = null; + if (params != null) { + args = (Object[]) unmarshal(params); + } + + Object result = command.execute(args); + + return marshal(result); + } catch (Throwable t) { + return marshal(transferable(t)); + } + } + +} http://git-wip-us.apache.org/repos/asf/camel/blob/c39b9558/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/ITestApplication.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/ITestApplication.java b/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/ITestApplication.java new file mode 100644 index 0000000..315a8f6 --- /dev/null +++ b/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/ITestApplication.java @@ -0,0 +1,39 @@ +/** + * 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.itest.springboot; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +/** + * Contains the main class of the sample spring-boot application created for the module under test. + * + */ +@SpringBootApplication +public class ITestApplication { + + public static void main(String[] args) throws Exception { + SpringApplication.run(ITestApplication.class, args); + } + + @Override + public String toString() { + // to tell source-check this is not a utility-class + return "spring-boot-main"; + } + +} http://git-wip-us.apache.org/repos/asf/camel/blob/c39b9558/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/ITestConfig.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/ITestConfig.java b/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/ITestConfig.java new file mode 100644 index 0000000..200be45 --- /dev/null +++ b/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/ITestConfig.java @@ -0,0 +1,147 @@ +/** + * 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.itest.springboot; + +import java.io.Serializable; + +/** + * A configuration bean for a test execution. + */ +public class ITestConfig implements Serializable { + + private static final long serialVersionUID = -3641997669166217595L; + + private String moduleName; + + private String mavenGroup; + + private String mavenVersion; + + private String modulesPath; + + private Boolean includeTestDependencies; + + private Boolean unitTestEnabled; + + private String unitTestInclusionPattern; + + private String unitTestExclusionPattern; + + private String unitTestBasePackage; + + private Integer unitTestsExpectedNumber; + + public ITestConfig() { + } + + public String getModuleName() { + return moduleName; + } + + public void setModuleName(String moduleName) { + this.moduleName = moduleName; + } + + public String getMavenGroup() { + return mavenGroup; + } + + public void setMavenGroup(String mavenGroup) { + this.mavenGroup = mavenGroup; + } + + public String getMavenVersion() { + return mavenVersion; + } + + public void setMavenVersion(String mavenVersion) { + this.mavenVersion = mavenVersion; + } + + public String getModulesPath() { + return modulesPath; + } + + public void setModulesPath(String modulesPath) { + this.modulesPath = modulesPath; + } + + public Boolean getIncludeTestDependencies() { + return includeTestDependencies; + } + + public void setIncludeTestDependencies(Boolean includeTestDependencies) { + this.includeTestDependencies = includeTestDependencies; + } + + public Boolean getUnitTestEnabled() { + return unitTestEnabled; + } + + public void setUnitTestEnabled(Boolean unitTestEnabled) { + this.unitTestEnabled = unitTestEnabled; + } + + public String getUnitTestInclusionPattern() { + return unitTestInclusionPattern; + } + + public void setUnitTestInclusionPattern(String unitTestInclusionPattern) { + this.unitTestInclusionPattern = unitTestInclusionPattern; + } + + public String getUnitTestExclusionPattern() { + return unitTestExclusionPattern; + } + + public void setUnitTestExclusionPattern(String unitTestExclusionPattern) { + this.unitTestExclusionPattern = unitTestExclusionPattern; + } + + public String getUnitTestBasePackage() { + return unitTestBasePackage; + } + + public void setUnitTestBasePackage(String unitTestBasePackage) { + this.unitTestBasePackage = unitTestBasePackage; + } + + public Integer getUnitTestsExpectedNumber() { + return unitTestsExpectedNumber; + } + + public void setUnitTestsExpectedNumber(Integer unitTestsExpectedNumber) { + this.unitTestsExpectedNumber = unitTestsExpectedNumber; + } + + @Override + public String toString() { + final StringBuilder sb = new StringBuilder("ITestConfig{"); + sb.append("moduleName='").append(moduleName).append('\''); + sb.append(", mavenGroup='").append(mavenGroup).append('\''); + sb.append(", mavenVersion='").append(mavenVersion).append('\''); + sb.append(", modulesPath='").append(modulesPath).append('\''); + sb.append(", includeTestDependencies=").append(includeTestDependencies); + sb.append(", unitTestEnabled=").append(unitTestEnabled); + sb.append(", unitTestInclusionPattern='").append(unitTestInclusionPattern).append('\''); + sb.append(", unitTestExclusionPattern='").append(unitTestExclusionPattern).append('\''); + sb.append(", unitTestBasePackage='").append(unitTestBasePackage).append('\''); + sb.append(", unitTestsExpectedNumber=").append(unitTestsExpectedNumber); + sb.append('}'); + return sb.toString(); + } +} http://git-wip-us.apache.org/repos/asf/camel/blob/c39b9558/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/ITestConfigBuilder.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/ITestConfigBuilder.java b/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/ITestConfigBuilder.java new file mode 100644 index 0000000..092665b --- /dev/null +++ b/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/ITestConfigBuilder.java @@ -0,0 +1,146 @@ +/** + * 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.itest.springboot; + +import java.io.InputStream; +import java.util.Optional; +import java.util.Properties; + +/** + * Builder for the {@code ITestConfig} that enforces defaults values. + */ +public class ITestConfigBuilder { + + private static final String PROPERTIES_FILE = "/spring-boot-itest.properties"; + + private Properties properties; + + private ITestConfig config; + + public ITestConfigBuilder() { + this.config = new ITestConfig(); + } + + public ITestConfigBuilder(ITestConfig config) { + this.config = config; + } + + public ITestConfigBuilder module(String module) { + config.setModuleName(module); + return this; + } + + public ITestConfigBuilder mavenGroup(String mavenGroup) { + config.setMavenGroup(mavenGroup); + return this; + } + + public ITestConfigBuilder mavenVersion(String mavenVersion) { + config.setMavenVersion(mavenVersion); + return this; + } + + public ITestConfigBuilder modulesPath(String path) { + config.setModulesPath(path); + return this; + } + + public ITestConfigBuilder unitTestExpectedNumber(int number) { + config.setUnitTestsExpectedNumber(number); + return this; + } + + public ITestConfigBuilder unitTestBasePackage(String pack) { + config.setUnitTestBasePackage(pack); + return this; + } + + public ITestConfigBuilder unitTestInclusionPattern(String pattern) { + config.setUnitTestInclusionPattern(pattern); + return this; + } + + public ITestConfigBuilder unitTestExclusionPattern(String pattern) { + config.setUnitTestExclusionPattern(pattern); + return this; + } + + public ITestConfig build() { + + // Checking conditions + if (config.getModuleName() == null) { + fail("ModuleName is required"); + } + + // Set the defaults + if (config.getUnitTestEnabled() == null) { + config.setUnitTestEnabled(booleanProperty("unitTestEnabled").orElse(false)); + } + + if (config.getMavenGroup() == null) { + config.setMavenGroup(property("mavenGroup").orElse("org.apache.camel")); + } + + if (config.getMavenVersion() == null) { + config.setMavenVersion(property("mavenVersion").orElse(null)); + } + + if (config.getUnitTestInclusionPattern() == null) { + config.setUnitTestInclusionPattern(property("unitTestInclusionPattern").orElse("^.*Test$")); // All tests + } + + if (config.getUnitTestExclusionPattern() == null) { + config.setUnitTestExclusionPattern(property("unitTestExclusionPattern").orElse(".*(\\.integration\\..*|XXXTest$)")); // Integration test + } + + if (config.getIncludeTestDependencies() == null) { + config.setIncludeTestDependencies(booleanProperty("includeTestDependencies").orElse(config.getUnitTestEnabled())); + } + + if (config.getModulesPath() == null) { + config.setModulesPath(property("modulesPath").orElse("../../components/")); + } + + if (config.getUnitTestBasePackage() == null) { + config.setUnitTestBasePackage(property("unitTestBasePackage").orElse("org.apache.camel")); + } + + return config; + } + + private void fail(String msg) { + throw new IllegalStateException("Configuration is not complete: " + msg); + } + + private Optional<String> property(String name) { + if (properties == null) { + properties = new Properties(); + try { + InputStream in = getClass().getResourceAsStream(PROPERTIES_FILE); + properties.load(in); + } catch (Exception e) { + throw new IllegalStateException("Unable to load property file: " + PROPERTIES_FILE, e); + } + } + + return Optional.ofNullable(properties.getProperty(name)); + } + + private Optional<Boolean> booleanProperty(String name) { + return property(name).map(Boolean::valueOf); + } +} http://git-wip-us.apache.org/repos/asf/camel/blob/c39b9558/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/command/AbstractTestCommand.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/command/AbstractTestCommand.java b/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/command/AbstractTestCommand.java new file mode 100644 index 0000000..d294d59 --- /dev/null +++ b/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/command/AbstractTestCommand.java @@ -0,0 +1,49 @@ +/** + * 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.itest.springboot.command; + +import org.apache.camel.itest.springboot.Command; +import org.apache.camel.itest.springboot.ITestConfig; +import org.junit.Assert; + +/** + * An abstract class for commands that need standard test parameters. + */ +public abstract class AbstractTestCommand implements Command { + + @Override + public Object execute(Object[] parameters) throws Exception { + Assert.assertNotNull("Parameters cannot be null", parameters); + Assert.assertEquals("Parameters should contain two elements", 2, parameters.length); + Object configObj = parameters[0]; + Assert.assertNotNull("The first parameter cannot be null", configObj); + Assert.assertTrue("First parameter should be of type ITestConfig, found type " + configObj.getClass().getName(), configObj instanceof ITestConfig); + + Object compNameObj = parameters[1]; + Assert.assertNotNull("The second parameter cannot be null", compNameObj); + Assert.assertTrue("Second parameter should be of type String, found type " + compNameObj.getClass().getName(), compNameObj instanceof String); + + String compName = (String) compNameObj; + + ITestConfig config = (ITestConfig) configObj; + this.executeTest(config, compName); + return true; + } + + public abstract Object executeTest(ITestConfig config, String component) throws Exception; + +} http://git-wip-us.apache.org/repos/asf/camel/blob/c39b9558/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/command/ComponentTestCommand.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/command/ComponentTestCommand.java b/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/command/ComponentTestCommand.java new file mode 100644 index 0000000..909757f --- /dev/null +++ b/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/command/ComponentTestCommand.java @@ -0,0 +1,52 @@ +/** + * 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.itest.springboot.command; + +import org.apache.camel.CamelContext; +import org.apache.camel.itest.springboot.Command; +import org.apache.camel.itest.springboot.ITestConfig; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import static org.junit.Assert.assertNotNull; + +/** + * A command that tries to lookup a camel component. + */ +@Component("module") +public class ComponentTestCommand extends AbstractTestCommand implements Command { + + private Logger logger = LoggerFactory.getLogger(getClass()); + + @Autowired + private CamelContext context; + + @Override + public Boolean executeTest(ITestConfig config, String component) throws Exception { + + logger.info("Getting Camel component: {}", component); + + org.apache.camel.Component comp = context.getComponent(component, true, false); + assertNotNull("Cannot get module with name: " + component, comp); + + logger.info("Found Camel module: {} instance: {} with className: {}", component, comp, comp.getClass()); + return true; + } + +} http://git-wip-us.apache.org/repos/asf/camel/blob/c39b9558/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/command/DataFormatTestCommand.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/command/DataFormatTestCommand.java b/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/command/DataFormatTestCommand.java new file mode 100644 index 0000000..6a9c789 --- /dev/null +++ b/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/command/DataFormatTestCommand.java @@ -0,0 +1,53 @@ +/** + * 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.itest.springboot.command; + +import org.apache.camel.CamelContext; +import org.apache.camel.itest.springboot.Command; +import org.apache.camel.itest.springboot.ITestConfig; +import org.apache.camel.spi.DataFormat; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import static org.junit.Assert.assertNotNull; + +/** + * A command that tries to lookup a camel data-format. + */ +@Component("dataformat") +public class DataFormatTestCommand extends AbstractTestCommand implements Command { + + private Logger logger = LoggerFactory.getLogger(getClass()); + + @Autowired + private CamelContext context; + + @Override + public Boolean executeTest(ITestConfig config, String dataFormat) throws Exception { + + logger.info("Getting Camel dataFormat: {}", dataFormat); + + DataFormat df = context.resolveDataFormat(dataFormat); + assertNotNull("Cannot get dataformat with name: " + dataFormat, df); + + logger.info("Found Camel dataformat: {} instance: {} with className: {}", dataFormat, df, df.getClass()); + return true; + } + +} http://git-wip-us.apache.org/repos/asf/camel/blob/c39b9558/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/command/LanguageTestCommand.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/command/LanguageTestCommand.java b/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/command/LanguageTestCommand.java new file mode 100644 index 0000000..bab9501 --- /dev/null +++ b/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/command/LanguageTestCommand.java @@ -0,0 +1,53 @@ +/** + * 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.itest.springboot.command; + +import org.apache.camel.CamelContext; +import org.apache.camel.itest.springboot.Command; +import org.apache.camel.itest.springboot.ITestConfig; +import org.apache.camel.spi.Language; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import static org.junit.Assert.assertNotNull; + +/** + * A command that tries to lookup a camel language. + */ +@Component("language") +public class LanguageTestCommand extends AbstractTestCommand implements Command { + + private Logger logger = LoggerFactory.getLogger(getClass()); + + @Autowired + private CamelContext context; + + @Override + public Boolean executeTest(ITestConfig config, String language) throws Exception { + + logger.info("Getting Camel language: {}", language); + + Language lan = context.resolveLanguage(language); + assertNotNull("Cannot get language with name: " + language, lan); + + logger.info("Found Camel language: {} instance: {} with className: {}", language, lan, lan.getClass()); + return true; + } + +} http://git-wip-us.apache.org/repos/asf/camel/blob/c39b9558/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/command/UnitTestCommand.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/command/UnitTestCommand.java b/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/command/UnitTestCommand.java new file mode 100644 index 0000000..c3b99fe --- /dev/null +++ b/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/command/UnitTestCommand.java @@ -0,0 +1,135 @@ +/** + * 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.itest.springboot.command; + +import java.net.URL; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.regex.Pattern; +import java.util.stream.Collectors; + +import org.apache.camel.CamelContext; +import org.apache.camel.itest.springboot.Command; +import org.apache.camel.itest.springboot.ITestConfig; +import org.junit.Assert; +import org.junit.runner.JUnitCore; +import org.junit.runner.Result; +import org.junit.runner.notification.Failure; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider; +import org.springframework.core.type.filter.RegexPatternTypeFilter; +import org.springframework.stereotype.Component; + +/** + * A command that executes all unit tests contained in the module. + */ +@Component("unittest") +public class UnitTestCommand extends AbstractTestCommand implements Command { + + Logger logger = LoggerFactory.getLogger(getClass()); + + @Autowired + private CamelContext context; + + @Override + public UnitTestResult executeTest(ITestConfig config, String component) throws Exception { + + logger.info("Spring-Boot test configuration {}", config); + + Pattern pattern = Pattern.compile(config.getUnitTestInclusionPattern()); + + logger.info("Scaning the classpath for test classes"); + ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider(false); + + scanner.addIncludeFilter(new RegexPatternTypeFilter(pattern)); + + List<String> testClasses = new LinkedList<>(scanner.findCandidateComponents(config.getUnitTestBasePackage()).stream().map(bd -> bd.getBeanClassName()).collect(Collectors.toList())); + + if (config.getUnitTestExclusionPattern() != null) { + Pattern exclusionPattern = Pattern.compile(config.getUnitTestExclusionPattern()); + for (Iterator<String> it = testClasses.iterator(); it.hasNext();) { + String cn = it.next(); + if (exclusionPattern.matcher(cn).matches()) { + logger.warn("Excluding Test Class: {}", cn); + it.remove(); + } + } + } + + List<Class<?>> classes = new ArrayList<>(); + for (String cn : testClasses) { + Class<?> clazz = Class.forName(cn); + if (isAdmissible(clazz)) { + logger.info("Found admissible test class: {}", cn); + classes.add(clazz); + } + } + + + Result result = JUnitCore.runClasses(classes.toArray(new Class[]{})); + logger.info("Run JUnit tests on {} test classes", classes.size()); + logger.info("Success: " + result.wasSuccessful() + " - Test Run: " + result.getRunCount() + " - Failures: " + result.getFailureCount() + " - Ignored Tests: " + result.getIgnoreCount()); + + for (Failure f : result.getFailures()) { + logger.warn("Failed test description: {}", f.getDescription()); + logger.warn("Message: {}", f.getMessage()); + if (f.getException() != null) { + logger.warn("Exception thrown from test", f.getException()); + } + } + + if (!result.wasSuccessful()) { + Assert.fail("Some unit tests failed (" + result.getFailureCount() + "/" + result.getRunCount() + "), check the logs for more details"); + } + + if (result.getRunCount() == 0 && config.getUnitTestsExpectedNumber() == null) { + Assert.fail("No tests have been found"); + } + + Integer expectedTests = config.getUnitTestsExpectedNumber(); + if (expectedTests != null && expectedTests != result.getRunCount()) { + Assert.fail("Wrong number of tests: expected " + expectedTests + " found " + result.getRunCount()); + } + + return new UnitTestResult(result); + } + + private boolean isAdmissible(Class<?> testClass) { + + if (testClass.getPackage().getName().startsWith("org.apache.camel.itest.springboot")) { + // no tests from the integration test suite + return false; + } + + URL location = testClass.getResource("/" + testClass.getName().replace(".", "/") + ".class"); + if (location != null) { + int firstLevel = location.toString().indexOf("!/"); + int lastLevel = location.toString().lastIndexOf("!/"); + if (firstLevel >= 0 && lastLevel >= 0 && firstLevel != lastLevel) { + // test class is in a nested jar, skipping + return false; + } + } + + return true; + } + +} http://git-wip-us.apache.org/repos/asf/camel/blob/c39b9558/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/command/UnitTestResult.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/command/UnitTestResult.java b/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/command/UnitTestResult.java new file mode 100644 index 0000000..2872d70 --- /dev/null +++ b/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/command/UnitTestResult.java @@ -0,0 +1,91 @@ +/** + * 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.itest.springboot.command; + +import java.io.Serializable; + +import org.junit.runner.Result; + +/** + * Contains the result of the execution of a test suite. + * Can be rebuilt at the other classloader as it does not contain reference to internal classes. + */ +public class UnitTestResult implements Serializable { + + private static final long serialVersionUID = -5015959334755321719L; + + private int runCount; + + private int failureCount; + + private long runTime; + + private int ignoreCount; + + private boolean successful; + + public UnitTestResult() { + } + + public UnitTestResult(Result jr) { + this.runCount = jr.getRunCount(); + this.failureCount = jr.getFailureCount(); + this.runTime = jr.getRunTime(); + this.ignoreCount = jr.getIgnoreCount(); + this.successful = jr.wasSuccessful(); + } + + public int getRunCount() { + return runCount; + } + + public void setRunCount(int runCount) { + this.runCount = runCount; + } + + public int getFailureCount() { + return failureCount; + } + + public void setFailureCount(int failureCount) { + this.failureCount = failureCount; + } + + public long getRunTime() { + return runTime; + } + + public void setRunTime(long runTime) { + this.runTime = runTime; + } + + public int getIgnoreCount() { + return ignoreCount; + } + + public void setIgnoreCount(int ignoreCount) { + this.ignoreCount = ignoreCount; + } + + public boolean isSuccessful() { + return successful; + } + + public void setSuccessful(boolean successful) { + this.successful = successful; + } +} http://git-wip-us.apache.org/repos/asf/camel/blob/c39b9558/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/util/SerializationUtils.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/util/SerializationUtils.java b/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/util/SerializationUtils.java new file mode 100644 index 0000000..ac9cfe8 --- /dev/null +++ b/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/util/SerializationUtils.java @@ -0,0 +1,71 @@ +/** + * 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.itest.springboot.util; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.PrintWriter; +import java.io.StringWriter; + +/** + * Provide basic serialization utils. + * Cannot rely on common available libraries to not influence the test outcome. + */ +public final class SerializationUtils { + + private SerializationUtils() { + } + + public static byte[] marshal(Object o) { + try (ByteArrayOutputStream out = new ByteArrayOutputStream(); ObjectOutputStream oout = new ObjectOutputStream(out)) { + oout.writeObject(o); + oout.flush(); + return out.toByteArray(); + } catch (IOException e) { + throw new RuntimeException("Unable to marshal the bean " + o, e); + } + } + + public static Object unmarshal(byte[] content) { + if (content == null) { + return null; + } + + try (ByteArrayInputStream in = new ByteArrayInputStream(content); ObjectInputStream oin = new ObjectInputStream(in)) { + Object bean = oin.readObject(); + return bean; + + } catch (IOException | ClassNotFoundException e) { + throw new RuntimeException("Unable to unmarshal the bean", e); + } + } + + public static Throwable transferable(Throwable ex) { + try (StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw)) { + ex.printStackTrace(pw); + pw.flush(); + + return new Exception("Error while executing tests. Wrapped exception is: " + sw.toString()); + } catch (IOException e) { + return new RuntimeException("Error while cleaning up the exception. Message=" + e.getMessage()); + } + } + +} http://git-wip-us.apache.org/repos/asf/camel/blob/c39b9558/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/AbstractSpringBootTestSupport.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/AbstractSpringBootTestSupport.java b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/AbstractSpringBootTestSupport.java new file mode 100644 index 0000000..24162c4 --- /dev/null +++ b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/AbstractSpringBootTestSupport.java @@ -0,0 +1,107 @@ +/** + * 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.itest.springboot; + +import java.lang.reflect.Method; + +import org.apache.camel.itest.springboot.arquillian.ArquillianSyncBootJarLauncher; +import org.apache.camel.itest.springboot.util.SpringBootContainerFacade; +import org.junit.Before; + +/** + * This is the base class of all spring-boot integration tests. + */ +public abstract class AbstractSpringBootTestSupport { + + protected ITestConfig config; + + private SpringBootContainerFacade facade; + + /** + * Starts a spring-boot container with the module under test. + * + * @throws Exception + */ + @Before + public void startSpringBoot() throws Exception { + this.config = retrieveConfig(); + + ArquillianSyncBootJarLauncher launcher = new ArquillianSyncBootJarLauncher(); + launcher.run(new String[]{}); + + this.facade = new SpringBootContainerFacade(launcher.getClassLoader()); + } + + protected static String inferModuleName(Class<?> testClass) { + String name = testClass.getSimpleName(); + int id1 = name.indexOf("Test"); + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < id1; i++) { + char c = name.charAt(i); + if (i > 0 && Character.isUpperCase(c) && sb.length() > 0) { + sb.append("-"); + } + sb.append(Character.toLowerCase(c)); + } + return sb.toString(); + } + + protected String defaultComponentName() throws Exception { + return config.getModuleName().replace("camel-", ""); + } + + protected void runComponentTest(ITestConfig config) throws Exception { + this.runComponentTest(config, defaultComponentName()); + } + + protected void runComponentTest(ITestConfig config, String componentName) throws Exception { + facade.executeTest("module", config, componentName); + } + + protected void runDataformatTest(ITestConfig config) throws Exception { + this.runDataformatTest(config, defaultComponentName()); + } + + protected void runDataformatTest(ITestConfig config, String dataFormatName) throws Exception { + facade.executeTest("dataformat", config, dataFormatName); + } + + protected void runLanguageTest(ITestConfig config) throws Exception { + this.runLanguageTest(config, defaultComponentName()); + } + + protected void runLanguageTest(ITestConfig config, String language) throws Exception { + facade.executeTest("language", config, language); + } + + protected void runModuleUnitTestsIfEnabled(ITestConfig config) throws Exception { + if (config.getUnitTestEnabled()) { + this.runModuleUnitTests(config); + } + } + + protected void runModuleUnitTests(ITestConfig config) throws Exception { + facade.executeTest("unittest", config, config.getModuleName().replace("camel-", "")); + } + + protected ITestConfig retrieveConfig() throws Exception { + Method confMethod = this.getClass().getMethod("createTestConfig"); + ITestConfig conf = (ITestConfig) confMethod.invoke(null); + return conf; + } + +} http://git-wip-us.apache.org/repos/asf/camel/blob/c39b9558/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelAhcTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelAhcTest.java b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelAhcTest.java new file mode 100644 index 0000000..bc98919 --- /dev/null +++ b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelAhcTest.java @@ -0,0 +1,47 @@ +/** + * 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.itest.springboot; + +import org.apache.camel.itest.springboot.util.ArquillianPackager; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.Archive; +import org.junit.Test; +import org.junit.runner.RunWith; + + +@RunWith(Arquillian.class) +public class CamelAhcTest extends AbstractSpringBootTestSupport { + + @Deployment + public static Archive<?> createSpringBootPackage() throws Exception { + return ArquillianPackager.springBootPackage(createTestConfig()); + } + + public static ITestConfig createTestConfig() { + return new ITestConfigBuilder() + .module(inferModuleName(CamelAhcTest.class)) + .build(); + } + + @Test + public void componentTests() throws Exception { + this.runComponentTest(config); + this.runModuleUnitTestsIfEnabled(config); + } + +} http://git-wip-us.apache.org/repos/asf/camel/blob/c39b9558/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelAhcWsTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelAhcWsTest.java b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelAhcWsTest.java new file mode 100644 index 0000000..7ed9953 --- /dev/null +++ b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelAhcWsTest.java @@ -0,0 +1,48 @@ +/** + * 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.itest.springboot; + +import org.apache.camel.itest.springboot.util.ArquillianPackager; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.Archive; +import org.junit.Test; +import org.junit.runner.RunWith; + + +@RunWith(Arquillian.class) +public class CamelAhcWsTest extends AbstractSpringBootTestSupport { + + @Deployment + public static Archive<?> createSpringBootPackage() throws Exception { + return ArquillianPackager.springBootPackage(createTestConfig()); + } + + public static ITestConfig createTestConfig() { + return new ITestConfigBuilder() + .module(inferModuleName(CamelAhcWsTest.class)) + .build(); + } + + @Test + public void componentTests() throws Exception { + this.runComponentTest(config); + this.runModuleUnitTestsIfEnabled(config); + } + + +} http://git-wip-us.apache.org/repos/asf/camel/blob/c39b9558/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelAmqpTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelAmqpTest.java b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelAmqpTest.java new file mode 100644 index 0000000..4f66a0d --- /dev/null +++ b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelAmqpTest.java @@ -0,0 +1,48 @@ +/** + * 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.itest.springboot; + +import org.apache.camel.itest.springboot.util.ArquillianPackager; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.Archive; +import org.junit.Test; +import org.junit.runner.RunWith; + + +@RunWith(Arquillian.class) +public class CamelAmqpTest extends AbstractSpringBootTestSupport { + + @Deployment + public static Archive<?> createSpringBootPackage() throws Exception { + return ArquillianPackager.springBootPackage(createTestConfig()); + } + + public static ITestConfig createTestConfig() { + return new ITestConfigBuilder() + .module(inferModuleName(CamelAmqpTest.class)) + .build(); + } + + @Test + public void componentTests() throws Exception { + this.runComponentTest(config); + this.runModuleUnitTestsIfEnabled(config); + } + + +} http://git-wip-us.apache.org/repos/asf/camel/blob/c39b9558/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelApnsTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelApnsTest.java b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelApnsTest.java new file mode 100644 index 0000000..c9eff09 --- /dev/null +++ b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelApnsTest.java @@ -0,0 +1,47 @@ +/** + * 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.itest.springboot; + +import org.apache.camel.itest.springboot.util.ArquillianPackager; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.Archive; +import org.junit.Test; +import org.junit.runner.RunWith; + + +@RunWith(Arquillian.class) +public class CamelApnsTest extends AbstractSpringBootTestSupport { + + @Deployment + public static Archive<?> createSpringBootPackage() throws Exception { + return ArquillianPackager.springBootPackage(createTestConfig()); + } + + public static ITestConfig createTestConfig() { + return new ITestConfigBuilder() + .module(inferModuleName(CamelApnsTest.class)) + .build(); + } + + @Test + public void componentTests() throws Exception { + this.runComponentTest(config); + this.runModuleUnitTestsIfEnabled(config); + } + +} http://git-wip-us.apache.org/repos/asf/camel/blob/c39b9558/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelAtmosTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelAtmosTest.java b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelAtmosTest.java new file mode 100644 index 0000000..ae43401 --- /dev/null +++ b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelAtmosTest.java @@ -0,0 +1,48 @@ +/** + * 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.itest.springboot; + +import org.apache.camel.itest.springboot.util.ArquillianPackager; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.Archive; +import org.junit.Test; +import org.junit.runner.RunWith; + + +@RunWith(Arquillian.class) +public class CamelAtmosTest extends AbstractSpringBootTestSupport { + + @Deployment + public static Archive<?> createSpringBootPackage() throws Exception { + return ArquillianPackager.springBootPackage(createTestConfig()); + } + + public static ITestConfig createTestConfig() { + return new ITestConfigBuilder() + .module(inferModuleName(CamelAtmosTest.class)) + .build(); + } + + @Test + public void componentTests() throws Exception { + this.runComponentTest(config); + this.runModuleUnitTestsIfEnabled(config); + } + + +} http://git-wip-us.apache.org/repos/asf/camel/blob/c39b9558/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelAtmosphereWebsocketTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelAtmosphereWebsocketTest.java b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelAtmosphereWebsocketTest.java new file mode 100644 index 0000000..9a8b781 --- /dev/null +++ b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelAtmosphereWebsocketTest.java @@ -0,0 +1,48 @@ +/** + * 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.itest.springboot; + +import org.apache.camel.itest.springboot.util.ArquillianPackager; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.Archive; +import org.junit.Test; +import org.junit.runner.RunWith; + + +@RunWith(Arquillian.class) +public class CamelAtmosphereWebsocketTest extends AbstractSpringBootTestSupport { + + @Deployment + public static Archive<?> createSpringBootPackage() throws Exception { + return ArquillianPackager.springBootPackage(createTestConfig()); + } + + public static ITestConfig createTestConfig() { + return new ITestConfigBuilder() + .module(inferModuleName(CamelAtmosphereWebsocketTest.class)) + .build(); + } + + @Test + public void componentTests() throws Exception { + this.runComponentTest(config); + this.runModuleUnitTestsIfEnabled(config); + } + + +} http://git-wip-us.apache.org/repos/asf/camel/blob/c39b9558/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelAtomTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelAtomTest.java b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelAtomTest.java new file mode 100644 index 0000000..0d68402 --- /dev/null +++ b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelAtomTest.java @@ -0,0 +1,48 @@ +/** + * 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.itest.springboot; + +import org.apache.camel.itest.springboot.util.ArquillianPackager; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.Archive; +import org.junit.Test; +import org.junit.runner.RunWith; + + +@RunWith(Arquillian.class) +public class CamelAtomTest extends AbstractSpringBootTestSupport { + + @Deployment + public static Archive<?> createSpringBootPackage() throws Exception { + return ArquillianPackager.springBootPackage(createTestConfig()); + } + + public static ITestConfig createTestConfig() { + return new ITestConfigBuilder() + .module(inferModuleName(CamelAtomTest.class)) + .build(); + } + + @Test + public void componentTests() throws Exception { + this.runComponentTest(config); + this.runModuleUnitTestsIfEnabled(config); + } + + +} http://git-wip-us.apache.org/repos/asf/camel/blob/c39b9558/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelAvroTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelAvroTest.java b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelAvroTest.java new file mode 100644 index 0000000..c1c946e --- /dev/null +++ b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelAvroTest.java @@ -0,0 +1,47 @@ +/** + * 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.itest.springboot; + +import org.apache.camel.itest.springboot.util.ArquillianPackager; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.Archive; +import org.junit.Test; +import org.junit.runner.RunWith; + + +@RunWith(Arquillian.class) +public class CamelAvroTest extends AbstractSpringBootTestSupport { + + @Deployment + public static Archive<?> createSpringBootPackage() throws Exception { + return ArquillianPackager.springBootPackage(createTestConfig()); + } + + public static ITestConfig createTestConfig() { + return new ITestConfigBuilder() + .module(inferModuleName(CamelAvroTest.class)) + .build(); + } + + @Test + public void moduleTests() throws Exception { + this.runDataformatTest(config); + this.runModuleUnitTestsIfEnabled(config); + } + +}
