Skip to content

Commit

Permalink
Prepare Release: OpenRewrite-Plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
cuioss committed Aug 26, 2024
1 parent 1d1d02e commit ad2b235
Show file tree
Hide file tree
Showing 21 changed files with 134 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.nio.file.Paths;

import jakarta.enterprise.inject.spi.BeanManager;

import org.jboss.weld.environment.se.Weld;
import org.junit.jupiter.api.Test;

import java.nio.file.Path;

class ModuleConsistencyTest {

@Test
Expand All @@ -37,7 +37,7 @@ void shouldStartUpContainer() {

@Test
void moduleShouldProvideBeansXml() {
assertTrue(Paths.get("src", "main", "resources", "META-INF", "beans.xml").toFile().exists(),
assertTrue(Path.of("src", "main", "resources", "META-INF", "beans.xml").toFile().exists(),
"It is best-practice that each module provides a beans.xml");
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
* Copyright 2023 the original author or authors.
* <p>
* Licensed 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
* <p>
* https://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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 de.cuioss.portal.authentication.facade;

import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
* Copyright 2023 the original author or authors.
* <p>
* Licensed 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
* <p>
* https://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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 de.cuioss.portal.authentication.oauth.impl;

import de.cuioss.test.generator.Generators;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import java.io.File;
import java.nio.file.Path;
import java.nio.file.Paths;

import de.cuioss.test.generator.TypedGenerator;
import de.cuioss.tools.net.ssl.KeyStoreProvider;
Expand All @@ -29,7 +28,7 @@ public class KeyStoreInfoGenerator implements TypedGenerator<KeyStoreProvider> {

static final String PASSWORD = "initinit";

static final Path BASE_PATH = Paths.get("src/test/resources");
static final Path BASE_PATH = Path.of("src/test/resources");

private final TypedGenerator<File> keystores = fixedValues(BASE_PATH.resolve("keystore1.keystore").toFile(),
BASE_PATH.resolve("keystore2.keystore").toFile());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@

import java.io.File;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.*;
import java.util.concurrent.TimeUnit;

Expand Down Expand Up @@ -134,7 +133,7 @@ Path producePath(final InjectionPoint injectionPoint) {
throw new IllegalArgumentException("Path must not be null nor empty, property is " + metaData.name());
}

final var path = Paths.get(pathAsString).normalize();
final var path = Path.of(pathAsString).normalize();
if (metaData.failOnNotAccessible()) {
checkArgument(path.toFile().exists(),
"Path " + pathAsString + " does not denote an existing file/directory");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.nio.file.Paths;

import jakarta.enterprise.inject.spi.BeanManager;

import org.jboss.weld.environment.se.Weld;
import org.junit.jupiter.api.Test;

import java.nio.file.Path;

/**
* Tests the complete cdi environment / wiring
*
Expand All @@ -50,7 +50,7 @@ void shouldStartUpContainer() {

@Test
void moduleShouldProvideBeansXml() {
assertTrue(Paths.get("src", "main", "resources", "META-INF", "beans.xml").toFile().exists(),
assertTrue(Path.of("src", "main", "resources", "META-INF", "beans.xml").toFile().exists(),
"It is best-practice that each module provides a beans.xml");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import java.nio.file.Paths;
import java.nio.file.Path;
import java.util.concurrent.TimeUnit;

import static org.junit.jupiter.api.Assertions.*;
Expand Down Expand Up @@ -79,7 +79,7 @@ class ConnectionMetadataProducerTest {

@BeforeEach
void before() {
final var testResources = Paths.get("src/test/resources");
final var testResources = Path.of("src/test/resources");
truststoreLocation = testResources.resolve("host.keystore").toFile().getAbsolutePath();
keystoreLocation = testResources.resolve("ca.keystore").toFile().getAbsolutePath();
systemKeystores();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;

import static de.cuioss.portal.configuration.PortalConfigurationKeys.SCHEDULER_FILE_SCAN_ENABLED;
import static org.junit.jupiter.api.Assertions.*;
Expand All @@ -46,7 +45,7 @@ class FileWatcherServiceImplDisabledTest {
@Inject
private PortalConfigurationMock configuration;

private static final Path POM = Paths.get("pom.xml");
private static final Path POM = Path.of("pom.xml");

@BeforeEach
void beforeTest() throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.concurrent.TimeUnit;

import static org.awaitility.Awaitility.await;
Expand All @@ -51,7 +50,7 @@ class FileWatcherServiceImplEnabledTest {
@Inject
private PortalConfigurationMock configuration;

private static final Path POM = Paths.get("pom.xml");
private static final Path POM = Path.of("pom.xml");
private Path pathFromEvent;

@BeforeEach
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.nio.file.attribute.FileTime;
import java.util.UUID;
Expand All @@ -32,7 +31,7 @@ public final class TestFileHandler {

private static final CuiLogger LOGGER = new CuiLogger(TestFileHandler.class);

private static final Path SOURCE_FILE = Paths.get("src/test/resources/META-INF/test.properties");
private static final Path SOURCE_FILE = Path.of("src/test/resources/META-INF/test.properties");

@Getter
private Path baseDir;
Expand Down Expand Up @@ -98,7 +97,7 @@ public static long touchTargetFile(Path targetFile) throws IOException {
* @throws IOException
*/
public Path setupTestFileDirectory() throws IOException {
final var dir = Paths.get("target/test-files", UUID.randomUUID().toString());
final var dir = Path.of("target/test-files", UUID.randomUUID().toString());

if (!Files.exists(dir)) {
LOGGER.info("creating {}", dir.toAbsolutePath());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
* Copyright 2023 the original author or authors.
* <p>
* Licensed 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
* <p>
* https://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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 de.cuioss.portal.configuration.impl.source;

import static org.junit.jupiter.api.Assertions.assertEquals;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ protected SortedSet<String> extractConfigurationKeys() {
return strings;
}
var foundNames = StreamSupport.stream(ConfigProvider.getConfig().getConfigSources().spliterator(), false).map(ConfigSource::getName).collect(Collectors.toSet());
fail(String.format("Unable to find any configuration source named '%s', available sources: '%s'", name, foundNames));
fail("Unable to find any configuration source named '%s', available sources: '%s'".formatted(name, foundNames));

return null;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
* Copyright 2023 the original author or authors.
* <p>
* Licensed 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
* <p>
* https://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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 de.cuioss.portal.common.bundle;

import static org.junit.jupiter.api.Assertions.assertFalse;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
* Copyright 2023 the original author or authors.
* <p>
* Licensed 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
* <p>
* https://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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 de.cuioss.portal.common.bundle.support;

import java.io.Serial;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
* Copyright 2023 the original author or authors.
* <p>
* Licensed 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
* <p>
* https://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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 de.cuioss.portal.common.util;

import static org.junit.jupiter.api.Assertions.assertTrue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.nio.file.Paths;

import jakarta.enterprise.inject.spi.BeanManager;

import org.jboss.weld.environment.se.Weld;
import org.junit.jupiter.api.Test;

import de.cuioss.portal.core.test.support.PortalAuthenticationFacadeMock;

import java.nio.file.Path;

class ModuleConsistencyTest {

@Test
Expand All @@ -39,7 +39,7 @@ void shouldStartUpContainer() {

@Test
void moduleShouldProvideBeansXml() {
assertTrue(Paths.get("src", "main", "resources", "META-INF", "beans.xml").toFile().exists(),
assertTrue(Path.of("src", "main", "resources", "META-INF", "beans.xml").toFile().exists(),
"It is best-practice that each module provides a beans.xml");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.nio.file.Paths;

import jakarta.enterprise.inject.spi.BeanManager;

import org.jboss.weld.environment.se.Weld;
import org.jboss.weld.environment.se.WeldContainer;
import org.junit.jupiter.api.Test;

import java.nio.file.Path;

/**
* Base class for testing the consistency / structure of an assembly module by
* starting up a {@link WeldContainer} and checking whether the module provides
Expand All @@ -46,7 +46,7 @@ protected void shouldStartUpContainer() {

@Test
protected void assemblyShouldProvideBeansXml() {
assertTrue(Paths.get("src", "main", "webapp", "WEB-INF", "beans.xml").toFile().exists(),
assertTrue(Path.of("src", "main", "webapp", "WEB-INF", "beans.xml").toFile().exists(),
"It is best-practice that each module provides a beans.xml");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.nio.file.Paths;

import jakarta.enterprise.inject.spi.BeanManager;

import org.jboss.weld.environment.se.Weld;
import org.jboss.weld.environment.se.WeldContainer;
import org.junit.jupiter.api.Test;

import java.nio.file.Path;

/**
* Base class for testing the consistency / structure of a certain module by
* starting up a {@link WeldContainer} and checking whether the module provides
Expand Down Expand Up @@ -58,7 +58,7 @@ protected void shouldStartUpContainer() {

@Test
protected void moduleShouldProvideBeansXml() {
assertTrue(Paths.get("src", "main", "resources", "META-INF", "beans.xml").toFile().exists(),
assertTrue(Path.of("src", "main", "resources", "META-INF", "beans.xml").toFile().exists(),
"It is best-practice that each module provides a beans.xml");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ protected SortedSet<String> extractConfigurationKeys() {
return strings;
}
var foundNames = StreamSupport.stream(ConfigProvider.getConfig().getConfigSources().spliterator(), false).map(ConfigSource::getName).collect(Collectors.toSet());
fail(String.format("Unable to find any configuration source named '%s', available sources: '%s'", name, foundNames));
fail("Unable to find any configuration source named '%s', available sources: '%s'".formatted(name, foundNames));

return null;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
* Copyright 2023 the original author or authors.
* <p>
* Licensed 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
* <p>
* https://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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 de.cuioss.portal.core.test.junit5.mockwebserver;

import org.junit.jupiter.api.Test;
Expand Down
Loading

0 comments on commit ad2b235

Please sign in to comment.