Skip to content

Commit

Permalink
Rename Simple test module to Core Languages because it now covers
Browse files Browse the repository at this point in the history
multiple Camel Core languages apache#2613
  • Loading branch information
ppalaga committed May 18, 2021
1 parent 1186965 commit 1c5ac57
Show file tree
Hide file tree
Showing 15 changed files with 197 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>camel-quarkus-integration-test-simple</artifactId>
<name>Camel Quarkus :: Integration Tests :: Simple :: Tests</name>
<description>The camel quarkus integration tests for the simple language</description>
<artifactId>camel-quarkus-integration-test-core-languages</artifactId>
<name>Camel Quarkus :: Integration Tests :: Core Languages :: Tests</name>
<description>The camel quarkus integration tests for Camel Core languages: Constant, ExchangeProperty, Header, Ref, Simple</description>

<dependencies>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.camel.quarkus.language.simple;
package org.apache.camel.quarkus.core.languages.it;

import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
Expand All @@ -30,9 +30,9 @@

import org.apache.camel.ProducerTemplate;

@Path("/simple")
@Path("/core-languages")
@ApplicationScoped
public class SimpleResource {
public class CoreLanguagesResource {

@Inject
ProducerTemplate template;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* 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.quarkus.core.languages.it;

import org.apache.camel.builder.RouteBuilder;

public class ExchangePropertyLanguageRoutes extends RouteBuilder {

@Override
public void configure() {
from("direct:myExchangePropertyRoute")
.setBody().exchangeProperty("myExchangeProperty");
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* 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.quarkus.core.languages.it;

import org.apache.camel.builder.RouteBuilder;

public class HeaderLanguageRoutes extends RouteBuilder {

@Override
public void configure() {

from("direct:myHeaderRoute")
.setBody().header("myHeader");

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.camel.quarkus.language.simple;
package org.apache.camel.quarkus.core.languages.it;

import java.nio.ByteBuffer;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.camel.quarkus.language.simple;
package org.apache.camel.quarkus.core.languages.it;

import org.apache.camel.builder.RouteBuilder;

Expand All @@ -33,12 +33,6 @@ public void configure() {

from("direct:bodyIs-simple").filter().simple("${body} is 'java.nio.ByteBuffer'").setBody(constant("BYTE_BUFFER"));

from("direct:myExchangePropertyRoute")
.setBody().exchangeProperty("myExchangeProperty");

from("direct:myHeaderRoute")
.setBody().header("myHeader");

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* 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.quarkus.core.languages.it;

import io.quarkus.test.junit.NativeImageTest;

@NativeImageTest
public class ExchangePropertyLanguageIT extends ExchangePropertyLanguageTest {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* 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.quarkus.core.languages.it;

import io.quarkus.test.junit.QuarkusTest;
import org.junit.jupiter.api.Test;

import static io.restassured.RestAssured.given;
import static org.hamcrest.CoreMatchers.is;

@QuarkusTest
public class ExchangePropertyLanguageTest {

@Test
public void exchangeProperty() {
given().body("foo").post("/core-languages/exchangeProperty/myExchangePropertyRoute/myExchangeProperty/1234").then()
.statusCode(200)
.body(is("1234"));
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* 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.quarkus.core.languages.it;

import io.quarkus.test.junit.NativeImageTest;

@NativeImageTest
public class HeaderLanguageIT extends HeaderLanguageTest {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* 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.quarkus.core.languages.it;

import io.quarkus.test.junit.QuarkusTest;
import org.junit.jupiter.api.Test;

import static io.restassured.RestAssured.given;
import static org.hamcrest.CoreMatchers.is;

@QuarkusTest
public class HeaderLanguageTest {
@Test
public void header() {
given().body("foo").post("/core-languages/header/myHeaderRoute/myHeader/barbaz").then().statusCode(200)
.body(is("barbaz"));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.camel.quarkus.core;
package org.apache.camel.quarkus.core.languages.it;

import io.quarkus.test.junit.NativeImageTest;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.camel.quarkus.core;
package org.apache.camel.quarkus.core.languages.it;

import io.quarkus.test.junit.QuarkusTest;
import org.junit.jupiter.api.Test;
Expand All @@ -27,55 +27,45 @@ public class SimpleTest {

@Test
public void premiumHeaderShouldPassThroughFilter() {
given().body("foo").when().post("/simple/header/filter-simple/premium/true").then().statusCode(200).body(is("PREMIUM"));
given().body("foo").when().post("/core-languages/header/filter-simple/premium/true").then().statusCode(200)
.body(is("PREMIUM"));
}

@Test
public void notPremiumHeaderShouldNotPassThroughFilter() {
given().body("foo").when().post("/simple/header/filter-simple/premium/false").then().statusCode(200)
given().body("foo").when().post("/core-languages/header/filter-simple/premium/false").then().statusCode(200)
.body(is("foo"));
}

@Test
public void aliceUserHeaderShouldBeTransformedToHelloAlice() {
given().body("Alice").when().post("/simple/header/transform-simple/user/Alice").then().statusCode(200)
given().body("Alice").when().post("/core-languages/header/transform-simple/user/Alice").then().statusCode(200)
.body(is("Hello Alice !"));
}

@Test
public void aliceBodyShouldBeTransformedToTheNameIsAlice() {
given().body("Alice").when().post("/simple/route/resource-simple/String").then().statusCode(200)
given().body("Alice").when().post("/core-languages/route/resource-simple/String").then().statusCode(200)
.body(is("The name is Alice"));
}

@Test
public void goldBodyShouldPassThroughFilter() {
given().body("gold").when().post("/simple/route/mandatoryBodyAs-simple/byte[]").then().statusCode(200)
given().body("gold").when().post("/core-languages/route/mandatoryBodyAs-simple/byte[]").then().statusCode(200)
.body(is("PREMIUM"));
}

@Test
public void stringBodyShouldNotPassThroughBodyIsFilter() {
given().body("STRING").when().post("/simple/route/bodyIs-simple/String").then().statusCode(200).body(is("STRING"));
given().body("STRING").when().post("/core-languages/route/bodyIs-simple/String").then().statusCode(200)
.body(is("STRING"));
}

@Test
public void byteBufferBodyShouldPassThroughBodyIsFilter() {
given().body("A body of type ByteBuffer").when().post("/simple/route/bodyIs-simple/ByteBuffer").then().statusCode(200)
.body(is("BYTE_BUFFER"));
}

@Test
public void exchangeProperty() {
given().body("foo").post("/simple/exchangeProperty/myExchangePropertyRoute/myExchangeProperty/1234").then()
given().body("A body of type ByteBuffer").when().post("/core-languages/route/bodyIs-simple/ByteBuffer").then()
.statusCode(200)
.body(is("1234"));
}

@Test
public void header() {
given().body("foo").post("/simple/header/myHeaderRoute/myHeader/barbaz").then().statusCode(200)
.body(is("barbaz"));
.body(is("BYTE_BUFFER"));
}

}
2 changes: 1 addition & 1 deletion integration-test-groups/foundation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@
<module>controlbus</module>
<module>core</module>
<module>core-annotations</module>
<module>core-languages</module>
<module>customized-log-component</module>
<module>direct</module>
<module>log</module>
<module>mock</module>
<module>ref</module>
<module>scheduler</module>
<module>seda</module>
<module>simple</module>
<module>stream</module>
<module>timer</module>
<module>type-converter</module>
Expand Down

0 comments on commit 1c5ac57

Please sign in to comment.