Skip to content

Commit

Permalink
Enable javadoc plugin and generates javadoc for libs (#26)
Browse files Browse the repository at this point in the history
Signed-off-by: David Kornel <[email protected]>
  • Loading branch information
kornys authored Mar 4, 2024
1 parent a32aea0 commit f78b733
Show file tree
Hide file tree
Showing 43 changed files with 1,343 additions and 203 deletions.
36 changes: 18 additions & 18 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -176,24 +176,24 @@

<build>
<plugins>
<!-- <plugin>-->
<!-- <groupId>org.apache.maven.plugins</groupId>-->
<!-- <artifactId>maven-javadoc-plugin</artifactId>-->
<!-- <version>${maven.javadoc.version}</version>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <id>attach-javadocs</id>-->
<!-- <goals>-->
<!-- <goal>jar</goal>-->
<!-- </goals>-->
<!-- <configuration>-->
<!-- <show>public</show>-->
<!-- <failOnError>true</failOnError>-->
<!-- <failOnWarnings>true</failOnWarnings>-->
<!-- </configuration>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- </plugin>-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${maven.javadoc.version}</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<show>public</show>
<failOnError>true</failOnError>
<failOnWarnings>true</failOnWarnings>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,41 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Utility methods for logging.
*/
public class LoggerUtils {

private static final Logger LOGGER = LoggerFactory.getLogger(LoggerUtils.class);
static final String SEPARATOR_CHAR = "#";

/**
* Pattern for logging resource information without namespace.
*/
public static final String RESOURCE_LOGGER_PATTERN = "{} {}/{}";

/**
* Pattern for logging resource information with namespace.
*/
public static final String RESOURCE_WITH_NAMESPACE_LOGGER_PATTERN = "{} {}/{} in {}";

private LoggerUtils() {
// All static methods
}

/**
* Logs a separator line using the default separator character and length.
*/
public static void logSeparator() {
logSeparator(SEPARATOR_CHAR, 76);
}

/**
* Logs a separator line with a custom delimiter character and length.
*
* @param delimiterChar The delimiter character.
* @param length The length of the separator line.
*/
public static void logSeparator(String delimiterChar, int length) {
LOGGER.info(String.join("", Collections.nCopies(length, delimiterChar)));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,46 @@

import java.time.Duration;

/**
* Constants used in the test framework.
*/
public class TestFrameConstants {
private TestFrameConstants() {
// Private constructor to prevent instantiation
}

/**
* Global poll interval in milliseconds (long).
*/
public static final long GLOBAL_POLL_INTERVAL_LONG = Duration.ofSeconds(15).toMillis();

/**
* Global poll interval in milliseconds (medium).
*/
public static final long GLOBAL_POLL_INTERVAL_MEDIUM = Duration.ofSeconds(10).toMillis();

/**
* Global poll interval in milliseconds (short).
*/
public static final long GLOBAL_POLL_INTERVAL_SHORT = Duration.ofSeconds(5).toMillis();

/**
* Global poll interval in milliseconds (1 second).
*/
public static final long GLOBAL_POLL_INTERVAL_1_SEC = Duration.ofSeconds(1).toMillis();

/**
* Global timeout in milliseconds.
*/
public static final long GLOBAL_TIMEOUT = Duration.ofMinutes(10).toMillis();

/**
* OpenShift client type.
*/
public static final String OPENSHIFT_CLIENT = "oc";
public static final String KUBERNETES_CLIENT = "kubectl";

/**
* Kubernetes client type.
*/
public static final String KUBERNETES_CLIENT = "kubectl";
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ public class TestFrameEnv {
private static final Logger LOGGER = LoggerFactory.getLogger(TestFrameEnv.class);
private static final Map<String, String> VALUES = new HashMap<>();
private static final Map<String, Object> YAML_DATA = loadConfigurationFile();
public static final String USER_PATH = System.getProperty("user.dir");

private static final String CONFIG_FILE_PATH_ENV = "ENV_FILE";
private static final String CLIENT_TYPE_ENV = "CLIENT_TYPE";
Expand All @@ -36,15 +35,36 @@ public class TestFrameEnv {
private static final String URL_ENV = "KUBE_URL";

/**
* Set values
* Default user dir of exec process
*/
public static final String USER_PATH = System.getProperty("user.dir");
/**
* The type of client.
*/
public static final String CLIENT_TYPE = getOrDefault(CLIENT_TYPE_ENV, TestFrameConstants.KUBERNETES_CLIENT);

/**
* The username for accessing the Kubernetes cluster.
*/
public static final String KUBE_USERNAME = getOrDefault(USERNAME_ENV, null);

/**
* The password for accessing the Kubernetes cluster.
*/
public static final String KUBE_PASSWORD = getOrDefault(PASSWORD_ENV, null);

/**
* The token for accessing the Kubernetes cluster.
*/
public static final String KUBE_TOKEN = getOrDefault(TOKEN_ENV, null);

/**
* The URL for accessing the Kubernetes cluster.
*/
public static final String KUBE_URL = getOrDefault(URL_ENV, null);

private TestFrameEnv() {
// Private constructor to prevent instantiation
}

static {
Expand All @@ -61,7 +81,11 @@ private TestFrameEnv() {
LoggerUtils.logSeparator("-", 30);
}

/**
* Print method.
*/
public static void print() {
// Method implementation
}

private static String getOrDefault(String varName, String defaultValue) {
Expand Down Expand Up @@ -90,7 +114,7 @@ private static Map<String, Object> loadConfigurationFile() {
File yamlFile = new File(config).getAbsoluteFile();
return yaml.load(new FileInputStream(yamlFile));
} catch (IOException ex) {
LOGGER.info("Yaml configuration not provider or not exists");
LOGGER.info("Yaml configuration not provided or does not exist");
return Collections.emptyMap();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@

import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
* This annotation is used to manage resources in JUnit tests.
* It is applied at the class level.
* <p>
* It uses the {@link ResourceManagerExtension} and {@link ResourceManagerCleanerExtension}
* to set up and clean up resources before and after each test.
*/
@Target(ElementType.TYPE)
@Retention(RUNTIME)
@ExtendWith(ResourceManagerExtension.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@

import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
* This annotation is used to manage resources in JUnit tests.
* It is applied at the class level.
* <p>
* It uses the {@link ResourceManagerExtension}
*/
@Target(ElementType.TYPE)
@Retention(RUNTIME)
@ExtendWith(ResourceManagerExtension.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@

import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
* This annotation is used to manage resources in JUnit tests.
* It is applied at the class level.
* <p>
* It uses the {@link TestVisualSeparatorExtension}
*/
@Target(ElementType.TYPE)
@Retention(RUNTIME)
@ExtendWith(TestVisualSeparatorExtension.class)
Expand Down
Loading

0 comments on commit f78b733

Please sign in to comment.