Skip to content

Commit

Permalink
Switch from NativeImageTest to QuarkusIntegrationTest
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesnetherton committed Mar 22, 2022
1 parent 10773b9 commit 1dceb05
Show file tree
Hide file tree
Showing 280 changed files with 563 additions and 563 deletions.
10 changes: 5 additions & 5 deletions docs/modules/ROOT/pages/user-guide/testing.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ An example implementation can be found https://github.com/apache/camel-quarkus/b
As long as all extensions your application depends on are supported in native mode,
you should definitely test that your application really works in native mode.
The test logic defined in JVM mode can then be reused in native mode thanks to inheriting from the respective JVM mode class.
`@NativeImageTest` annotation is there to instruct the Quarkus JUnit extension to compile the application under test to native image
`@QuarkusIntegrationTest` annotation is there to instruct the Quarkus JUnit extension to compile the application under test to native image
and start it before running the tests.

[source,java]
----
import io.quarkus.test.junit.NativeImageTest;
import io.quarkus.test.junit.QuarkusIntegrationTest;
@NativeImageTest
@QuarkusIntegrationTest
class MyIT extends MyTest {
...
}
Expand All @@ -55,13 +55,13 @@ class MyIT extends MyTest {
An implementation of a native test may help to capture more details https://github.com/apache/camel-quarkus/blob/main/integration-tests/bindy/src/test/java/org/apache/camel/quarkus/component/bindy/it/MessageRecordIT.java[here].

[[jvm-vs-native-tests]]
== `@QuarkusTest` vs. `@NativeImageTest`
== `@QuarkusTest` vs. `@QuarkusIntegrationTest`

JVM mode tests annotated with `@QuarkusTest` are executed in the same JVM as the application under test.
Thanks to that, `@Inject`-ing beans from the application into the test code is possible.
You can also define new beans or even override the beans from the application using `@javax.enterprise.inject.Alternative` and `@javax.annotation.Priority`.

However all these tricks won't work in native mode tests annotated with `@NativeImageTest`
However all these tricks won't work in native mode tests annotated with `@QuarkusIntegrationTest`
because those are executed in a JVM hosted in a process separate from the running native application.

If you ask why, the answer is actually in the previous sentence: a native executable does not need a JVM to run;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
*/
package org.apache.camel.quarkus.component.aws2.lambda.it;

import io.quarkus.test.junit.NativeImageTest;
import io.quarkus.test.junit.QuarkusIntegrationTest;

@NativeImageTest
@QuarkusIntegrationTest
class Aws2LambdaIT extends Aws2LambdaTest {

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
*/
package org.apache.camel.quarkus.component.aws2.ddb.it;

import io.quarkus.test.junit.NativeImageTest;
import io.quarkus.test.junit.QuarkusIntegrationTest;

@NativeImageTest
@QuarkusIntegrationTest
class Aws2DdbQuarkusClientIT extends Aws2DdbQuarkusClientTest {

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
*/
package org.apache.camel.quarkus.component.aws2.cw.it;

import io.quarkus.test.junit.NativeImageTest;
import io.quarkus.test.junit.QuarkusIntegrationTest;

@NativeImageTest
@QuarkusIntegrationTest
class Aws2CwIT extends Aws2CwTest {

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
*/
package org.apache.camel.quarkus.component.aws2.ddb.it;

import io.quarkus.test.junit.NativeImageTest;
import io.quarkus.test.junit.QuarkusIntegrationTest;

@NativeImageTest
@QuarkusIntegrationTest
class Aws2DdbIT extends Aws2DdbTest {

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
*/
package org.apache.camel.quarkus.component.aws2.ddb.it;

import io.quarkus.test.junit.NativeImageTest;
import io.quarkus.test.junit.QuarkusIntegrationTest;

@NativeImageTest
@QuarkusIntegrationTest
class Aws2DdbStreamIT extends Aws2DdbStreamTest {

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
*/
package org.apache.camel.quarkus.component.aws2.kinesis.it;

import io.quarkus.test.junit.NativeImageTest;
import io.quarkus.test.junit.QuarkusIntegrationTest;

@NativeImageTest
@QuarkusIntegrationTest
class Aws2KinesisIT extends Aws2KinesisTest {

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
*/
package org.apache.camel.quarkus.component.aws2.lambda.it;

import io.quarkus.test.junit.NativeImageTest;
import io.quarkus.test.junit.QuarkusIntegrationTest;

@NativeImageTest
@QuarkusIntegrationTest
class Aws2LambdaIT extends Aws2LambdaTest {

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
*/
package org.apache.camel.quarkus.component.aws2.s3.it;

import io.quarkus.test.junit.NativeImageTest;
import io.quarkus.test.junit.QuarkusIntegrationTest;

@NativeImageTest
@QuarkusIntegrationTest
class Aws2S3IT extends Aws2S3Test {

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
*/
package org.apache.camel.quarkus.component.aws2.ses.it;

import io.quarkus.test.junit.NativeImageTest;
import io.quarkus.test.junit.QuarkusIntegrationTest;
import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable;

/* Disabled on Localstack because Localstack does not send e-mails which we do assume in our tests
* See https://github.com/localstack/localstack/issues/339#issuecomment-341727758 */
@EnabledIfEnvironmentVariable(named = "AWS_ACCESS_KEY", matches = "[a-zA-Z0-9]+")
@EnabledIfEnvironmentVariable(named = "MAILSLURP_API_KEY", matches = "[a-zA-Z0-9]+")
@NativeImageTest
@QuarkusIntegrationTest
class Aws2SesIT extends Aws2SesTest {

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
*/
package org.apache.camel.quarkus.component.aws2.sns.it;

import io.quarkus.test.junit.NativeImageTest;
import io.quarkus.test.junit.QuarkusIntegrationTest;

@NativeImageTest
@QuarkusIntegrationTest
class Aws2SqsSnsIT extends Aws2SqsSnsTest {

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
*/
package org.apache.camel.quarkus.component.aws2.sqs.it;

import io.quarkus.test.junit.NativeImageTest;
import io.quarkus.test.junit.QuarkusIntegrationTest;

@NativeImageTest
@QuarkusIntegrationTest
class Aws2SqsIT extends Aws2SqsTest {

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
*/
package org.apache.camel.quarkus.component.azure.eventhubs.it;

import io.quarkus.test.junit.NativeImageTest;
import io.quarkus.test.junit.QuarkusIntegrationTest;
import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable;

@EnabledIfEnvironmentVariable(named = "AZURE_STORAGE_ACCOUNT_NAME", matches = ".+")
@EnabledIfEnvironmentVariable(named = "AZURE_STORAGE_ACCOUNT_KEY", matches = ".+")
@EnabledIfEnvironmentVariable(named = "AZURE_BLOB_CONTAINER_NAME", matches = ".+")
@EnabledIfEnvironmentVariable(named = "AZURE_EVENT_HUBS_CONNECTION_STRING", matches = ".+")
@NativeImageTest
@QuarkusIntegrationTest
class AzureEventhubsIT extends AzureEventhubsTest {

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
package org.apache.camel.quarkus.component.azure.storage.blob.it;

import io.quarkus.test.common.QuarkusTestResource;
import io.quarkus.test.junit.NativeImageTest;
import io.quarkus.test.junit.QuarkusIntegrationTest;
import org.apache.camel.quarkus.test.support.azure.AzureStorageTestResource;

@NativeImageTest
@QuarkusIntegrationTest
@QuarkusTestResource(AzureStorageTestResource.class)
class AzureStorageBlobIT extends AzureStorageBlobTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
package org.apache.camel.quarkus.component.azure.storage.queue.it;

import io.quarkus.test.common.QuarkusTestResource;
import io.quarkus.test.junit.NativeImageTest;
import io.quarkus.test.junit.QuarkusIntegrationTest;
import org.apache.camel.quarkus.test.support.azure.AzureStorageTestResource;

@NativeImageTest
@QuarkusIntegrationTest
@QuarkusTestResource(AzureStorageTestResource.class)
class AzureStorageQueueIT extends AzureStorageQueueTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
*/
package org.apache.camel.quarkus.component.bean;

import io.quarkus.test.junit.NativeImageTest;
import io.quarkus.test.junit.QuarkusIntegrationTest;

@NativeImageTest
@QuarkusIntegrationTest
public class BeanITCase extends BeanTest {
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
*/
package org.apache.camel.quarkus.component.bean;

import io.quarkus.test.junit.NativeImageTest;
import io.quarkus.test.junit.QuarkusIntegrationTest;

@NativeImageTest
@QuarkusIntegrationTest
public class BeanMethodIT extends BeanMethodTest {
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
*/
package org.apache.camel.quarkus.component.bean;

import io.quarkus.test.junit.NativeImageTest;
import io.quarkus.test.junit.QuarkusIntegrationTest;

@NativeImageTest
@QuarkusIntegrationTest
public class ClassIT extends ClassTest {
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
*/
package org.apache.camel.quarkus.component.bean;

import io.quarkus.test.junit.NativeImageTest;
import io.quarkus.test.junit.QuarkusIntegrationTest;

@NativeImageTest
@QuarkusIntegrationTest
public class ConsumeAnnotationIT extends ConsumeAnnotationTest {
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
*/
package org.apache.camel.quarkus.component.bean;

import io.quarkus.test.junit.NativeImageTest;
import io.quarkus.test.junit.QuarkusIntegrationTest;

@NativeImageTest
@QuarkusIntegrationTest
class EipIT extends EipTest {

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
*/
package org.apache.camel.quarkus.component.browse.it;

import io.quarkus.test.junit.NativeImageTest;
import io.quarkus.test.junit.QuarkusIntegrationTest;

@NativeImageTest
@QuarkusIntegrationTest
class BrowseIT extends BrowseTest {

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
*/
package org.apache.camel.quarkus.core.component.name.resolver;

import io.quarkus.test.junit.NativeImageTest;
import io.quarkus.test.junit.QuarkusIntegrationTest;

@NativeImageTest
@QuarkusIntegrationTest
public class ComponentNameResolverIT extends ComponentNameResolverTest {
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
*/
package org.apache.camel.quarkus.component.controlbus.it;

import io.quarkus.test.junit.NativeImageTest;
import io.quarkus.test.junit.QuarkusIntegrationTest;

@NativeImageTest
@QuarkusIntegrationTest
class ControlbusIT extends ControlbusTest {

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
*/
package org.apache.camel.quarkus.core.it.annotations;

import io.quarkus.test.junit.NativeImageTest;
import io.quarkus.test.junit.QuarkusIntegrationTest;

@NativeImageTest
@QuarkusIntegrationTest
public class CoreAnnotationsIT extends CoreAnnotationsTest {

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
*/
package org.apache.camel.quarkus.core.faulttolerance.it;

import io.quarkus.test.junit.NativeImageTest;
import io.quarkus.test.junit.QuarkusIntegrationTest;

@NativeImageTest
@QuarkusIntegrationTest
public class CoreFaultToleranceIT extends CoreFaultToleranceTest {
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
*/
package org.apache.camel.quarkus.core.languages.it;

import io.quarkus.test.junit.NativeImageTest;
import io.quarkus.test.junit.QuarkusIntegrationTest;

@NativeImageTest
@QuarkusIntegrationTest
public class ConstantLanguageIT extends ConstantLanguageTest {

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
*/
package org.apache.camel.quarkus.core.languages.it;

import io.quarkus.test.junit.NativeImageTest;
import io.quarkus.test.junit.QuarkusIntegrationTest;

@NativeImageTest
@QuarkusIntegrationTest
public class CustomDataFormatIT extends CustomDataFormatTest {

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
*/
package org.apache.camel.quarkus.core.languages.it;

import io.quarkus.test.junit.NativeImageTest;
import io.quarkus.test.junit.QuarkusIntegrationTest;

@NativeImageTest
@QuarkusIntegrationTest
public class ExchangePropertyLanguageIT extends ExchangePropertyLanguageTest {

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
*/
package org.apache.camel.quarkus.core.languages.it;

import io.quarkus.test.junit.NativeImageTest;
import io.quarkus.test.junit.QuarkusIntegrationTest;

@NativeImageTest
@QuarkusIntegrationTest
public class HeaderLanguageIT extends HeaderLanguageTest {

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
*/
package org.apache.camel.quarkus.core.languages.it;

import io.quarkus.test.junit.NativeImageTest;
import io.quarkus.test.junit.QuarkusIntegrationTest;

@NativeImageTest
@QuarkusIntegrationTest
public class RefLanguageIT extends RefLanguageTest {

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
*/
package org.apache.camel.quarkus.core.languages.it;

import io.quarkus.test.junit.NativeImageTest;
import io.quarkus.test.junit.QuarkusIntegrationTest;

@NativeImageTest
@QuarkusIntegrationTest
public class SimpleIT extends SimpleTest {

}
Loading

0 comments on commit 1dceb05

Please sign in to comment.