-
Notifications
You must be signed in to change notification settings - Fork 5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CAMEL-21452: decouple the infrastructure from the testing API
- Loading branch information
Showing
17 changed files
with
155 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...godb/src/test/java/org/apache/camel/test/infra/arangodb/services/ArangoDBTestService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.test.infra.arangodb.services; | ||
|
||
import org.apache.camel.test.infra.common.services.TestService; | ||
|
||
/** | ||
* Test infra service for ArangoDB | ||
*/ | ||
public interface ArangoDBTestService extends TestService, ArangoDBService { | ||
|
||
int getPort(); | ||
|
||
String getHost(); | ||
|
||
default String getServiceAddress() { | ||
return String.format("%s:%d", getHost(), getPort()); | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
45 changes: 45 additions & 0 deletions
45
...ra-common/src/main/java/org/apache/camel/test/infra/common/services/ContainerService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* 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.test.infra.common.services; | ||
|
||
//import org.junit.jupiter.api.extension.ConditionEvaluationResult; | ||
//import org.junit.jupiter.api.extension.ExecutionCondition; | ||
//import org.junit.jupiter.api.extension.ExtensionContext; | ||
//import org.slf4j.Logger; | ||
//import org.slf4j.LoggerFactory; | ||
import org.testcontainers.containers.GenericContainer; | ||
|
||
public interface ContainerService<T extends GenericContainer> { | ||
|
||
// @Override | ||
// default ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext extensionContext) { | ||
// | ||
// if (ContainerEnvironmentUtil.isDockerAvailable()) { | ||
// return ConditionEvaluationResult.enabled("Docker is available"); | ||
// } | ||
// | ||
// Logger logger = LoggerFactory.getLogger(ContainerService.class); | ||
// logger.warn("Test {} is disabled because docker is not available", extensionContext.getElement().orElse(null)); | ||
// | ||
// System.err.println( | ||
// "Container-based tests were disabled because Docker is NOT available. Check the log files on target/failsafe-reports"); | ||
// return ConditionEvaluationResult.disabled("Docker is NOT available"); | ||
// } | ||
|
||
T getContainer(); | ||
} |
42 changes: 42 additions & 0 deletions
42
...mmon/src/main/java/org/apache/camel/test/infra/common/services/InfrastructureService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* 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.test.infra.common.services; | ||
|
||
public interface InfrastructureService extends AutoCloseable { | ||
|
||
/** | ||
* Register service properties (such as using System.setProperties) so that they can be resolved at distance (ie.: | ||
* when using Spring's PropertySourcesPlaceholderConfigurer or simply when trying to collect test infra information | ||
* outside of the test class itself). | ||
*/ | ||
void registerProperties(); | ||
|
||
/** | ||
* Perform any initialization necessary | ||
*/ | ||
void initialize(); | ||
|
||
/** | ||
* Shuts down the service after the test has completed | ||
*/ | ||
void shutdown(); | ||
|
||
@Override | ||
default void close() { | ||
shutdown(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters