Skip to content

Commit

Permalink
Merge pull request #180 from fabiobrz/polish.core
Browse files Browse the repository at this point in the history
Polishing the `core` module by adding missing Javadoc and do some refactoring
  • Loading branch information
marekkopecky authored Sep 4, 2024
2 parents 9a973a7 + 507cebf commit b0ec5e6
Show file tree
Hide file tree
Showing 24 changed files with 395 additions and 241 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
import org.jboss.intersmash.junit5.IntersmashExtension;
import org.junit.jupiter.api.extension.ExtendWith;

/**
* Annotation that is applied to a test class, so that the JUnit engine would use the {@link IntersmashExtension} to
* run the Intersmash provisioning workflow, and execute the related tests.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@ExtendWith(IntersmashExtension.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@

import org.jboss.intersmash.application.Application;

/**
* Annotation to define an Intersmash service, i.e. the abstraction of a given runtime workload.
* Examples are: a WildFly application service, a Keycloak service etc. on OpenShift.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Repeatable(Services.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* Annotation to define a group of Intersmash {@link Service} instances.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface Services {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
import cz.xtf.core.openshift.OpenShifts;
import lombok.extern.slf4j.Slf4j;

/**
* Implements a JUnit {@link ExecutionCondition} that is used to control whether a test class workflow can be managed by
* {@link IntersmashExtension}
*/
@Slf4j
public class IntersmashExecutionCondition implements ExecutionCondition {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@
import cz.xtf.core.openshift.OpenShifts;
import lombok.extern.slf4j.Slf4j;

/**
* Intersmash JUnit extension that handles the process of provisioning a cross-product scenario before starting the
* test execution.
*/
@Slf4j
public class IntersmashExtension implements BeforeAllCallback, AfterAllCallback, TestInstancePostProcessor {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import org.jboss.intersmash.application.Application;

/**
* Application provisioner for deploying and undeploying the application.
* Application provisioner for deploying and undeploying a service, represented by a given {@link Application} instance.
*/
public interface Provisioner<T extends Application> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@

import org.jboss.intersmash.application.Application;

/**
* Define the contract for classes that return a suitable {@link Provisioner} for a given {@link Application} class.
* @param <T> The type of the {@link Provisioner} that the factory implementation shall return.
*/
public interface ProvisionerFactory<T extends Provisioner> {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@

import org.jboss.intersmash.application.Application;

/**
* Manager class to load the suitable {@link Provisioner} for a given {@link Application} instance, based on SPI.
*/
public class ProvisionerManager {

/**
* Get application provisioner based on interfaces the application does implement.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
import cz.xtf.core.waiting.failfast.FailFastBuilder;
import cz.xtf.core.waiting.failfast.FailFastCheck;

/**
* Helper class that leverages the XTF library fail-fast APIs in methods that can be used to control the
* Intersmash provisioning workflow.
*/
public class FailFastUtils {
private static String[] failFastEventMessages = new String[] {
"Failed to pull image.*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@

import cz.xtf.core.openshift.OpenShift;

/**
* Helper class that leverages the XTF library {@link OpenShift} APIs in methods that can be used to control the
* Intersmash provisioning workflow.
*/
public class OpenShiftUtils {
public static void deleteResourcesWithLabel(OpenShift openShift, String labelKey, String labelValue) {
openShift.deploymentConfigs().withLabel(labelKey, labelValue).delete();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
import io.fabric8.kubernetes.api.model.EndpointSubset;
import io.fabric8.kubernetes.api.model.Endpoints;

/**
* Helper class that leverages the XTF library {@link Waiter} APIs in methods that can be used to control the
* Intersmash provisioning workflow.
*/
public class WaitersUtil {
public static Waiter serviceEndpointsAreReady(OpenShift openShift, String serviceName, int numOfPods, Integer... ports) {
return new SimpleWaiter(() -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@

import io.fabric8.openshift.api.model.operatorhub.v1alpha1.CatalogSourceBuilder;

/**
* Wrapper for creating and using {@link io.fabric8.openshift.api.model.operatorhub.v1alpha1.CatalogSource}
*/
public class CatalogSource extends io.fabric8.openshift.api.model.operatorhub.v1alpha1.CatalogSource
implements OpenShiftResource<CatalogSource> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@
import io.fabric8.openshift.api.model.operatorhub.v1alpha1.SubscriptionFluent;

/**
* <p>
* The Subscription configures when and how to update a ClusterService, binds a ClusterService to a channel in a
* CatalogSource and configures the update strategy for a ClusterService (automatic, manual approval, etc).
* </p>
*
* <p>This class is a wrapper for {@link io.fabric8.openshift.api.model.operatorhub.v1alpha1.Subscription} which
* adds some capabilities</p>
* <p>
Expand Down
Loading

0 comments on commit b0ec5e6

Please sign in to comment.