Skip to content

Commit

Permalink
Update with merge from main-3
Browse files Browse the repository at this point in the history
  • Loading branch information
corneil committed Aug 22, 2024
1 parent d9f39ea commit 2a08167
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 185 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class AppResourceCommonTests {
private AppResourceCommon appResourceCommon = new AppResourceCommon(new MavenProperties(), resourceLoader);

@Test
public void testBadNamedJars() throws Exception {
void badNamedJars() throws Exception {
UrlResource urlResource = new UrlResource("https://repo.maven.apache.org/maven2/org/springframework/cloud/stream/app/file-sink-rabbit/5.0.0/file-sink-rabbit.jar");
assertThatIllegalArgumentException().isThrownBy( () -> appResourceCommon.getUrlResourceVersion(urlResource));
}
Expand Down Expand Up @@ -91,23 +91,23 @@ void dockerUriString() throws Exception {
}

@Test
public void testJarMetadataUriDockerApp() throws Exception {
void jarMetadataUriDockerApp() throws Exception {
String appUri = "docker:springcloudstream/log-sink-rabbit:5.0.0";
String metadataUri = "https://repo.maven.apache.org/maven2/org/springframework/cloud/stream/app/file-sink-rabbit/5.0.0/file-sink-rabbit-5.0.0.jar";
appResourceCommon.getMetadataResource(new URI(appUri), new URI(metadataUri));
verify(resourceLoader).getResource(eq(metadataUri));
}

@Test
public void testMetadataUriHttpApp() throws Exception {
void metadataUriHttpApp() throws Exception {
String appUri = "https://repo.maven.apache.org/maven2/org/springframework/cloud/stream/app/file-sink-rabbit/5.0.0/file-sink-rabbit-5.0.0.jar";
Resource metadataResource = appResourceCommon.getMetadataResource(new URI(appUri), null);
assertThat(metadataResource instanceof UrlResource).isTrue();
assertThat(metadataResource.getURI().toString().equals(appUri));
}

@Test
public void testMetadataUriDockerApp() throws Exception {
void metadataUriDockerApp() throws Exception {
String appUri = "docker:springcloudstream/log-sink-rabbit:5.0.0";
Resource metadataResource = appResourceCommon.getMetadataResource(new URI(appUri), null);
assertThat(metadataResource).isNotNull();
Expand Down Expand Up @@ -168,7 +168,7 @@ void jars() throws MalformedURLException {
}

@Test
public void testGetResourceWithoutVersion() {
void testGetResourceWithoutVersion() {
assertThat(appResourceCommon.getResourceWithoutVersion(
MavenResource.parse("org.springframework.cloud.stream.app:aggregate-counter-sink-rabbit:war:exec:5.0.0")))
.isEqualTo("maven://org.springframework.cloud.stream.app:aggregate-counter-sink-rabbit:war:exec");
Expand All @@ -181,21 +181,21 @@ public void testGetResourceWithoutVersion() {
}

@Test
public void testGetResource() {
void testGetResource() {
String mavenUri = "maven://org.springframework.cloud.stream.app:aggregate-counter-sink-rabbit:5.0.0";
Resource resource = appResourceCommon.getResource(mavenUri);
assertThat(resource).isInstanceOf(MavenResource.class);
}

@Test
public void testGetResourceVersion() {
void testGetResourceVersion() {
String mavenUri = "maven://org.springframework.cloud.stream.app:aggregate-counter-sink-rabbit:5.0.0";
String version = appResourceCommon.getResourceVersion(appResourceCommon.getResource(mavenUri));
assertThat(version).isEqualTo("5.0.0");
}

@Test
public void testGetMetadataResourceVersion() {
void getMetadataResourceVersion() {
String httpUri = "http://repo.maven.apache.org/maven2/org/springframework/cloud/stream/app/cassandra-sink-rabbit/5.0.1-SNAPSHOT/cassandra-sink-rabbit-5.0.1-SNAPSHOT-metadata.jar";
String version = appResourceCommon.getResourceVersion(appResourceCommon.getResource(httpUri));
assertThat(version).isEqualTo("5.0.1-SNAPSHOT");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public static List<String[]> data() {

@MethodSource("data")
@ParameterizedTest
public void dockerImageParsing(String description, String fullImageName, String expectedHost, String expectedNamespace, String expectedRepo, String expectedNamespaceAndRepo, String expectedTag) {
void dockerImageParsing(String description, String fullImageName, String expectedHost, String expectedNamespace, String expectedRepo, String expectedNamespaceAndRepo, String expectedTag) {

initDockerImageTests(description, fullImageName, expectedHost, expectedNamespace, expectedRepo, expectedNamespaceAndRepo, expectedTag);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable;

import org.springframework.boot.test.autoconfigure.jdbc.JdbcTest;
import org.springframework.cloud.dataflow.server.db.DB2_11_5_ContainerSupport;
import org.springframework.cloud.dataflow.server.db.MariaDB_10_6_ContainerSupport;
import org.springframework.cloud.dataflow.server.db.MariaDB_11_ContainerSupport;
Expand All @@ -31,8 +30,6 @@
import org.springframework.cloud.dataflow.server.db.SqlServer_2019_ContainerSupport;
import org.springframework.cloud.dataflow.server.db.SqlServer_2022_ContainerSupport;

import static org.assertj.core.api.Assertions.assertThat;

class DatabaseTypeTests {

@Nested
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
import org.springframework.shell.table.Table;

import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

/**
* @author Glenn Renfro
Expand Down Expand Up @@ -159,8 +159,9 @@ void viewExecution() {
logger.info("Retrieve Job Execution Detail by Id");
Table table = getTable(job().executionDisplay(getFirstJobExecutionIdFromTable()));
verifyColumnNumber(table, 2);
assertEquals("Number of expected rows returned from the table is incorrect", 19,
table.getModel().getRowCount());
assertEquals(19,
table.getModel().getRowCount(),
"Number of expected rows returned from the table is incorrect");
int rowNumber = 0;
checkCell(table, rowNumber++, 0, "Key ");
checkCell(table, rowNumber++, 0, "Job Execution Id ");
Expand All @@ -180,14 +181,14 @@ void viewExecution() {
checkCell(table, rowNumber++, 0, "Job Parameters ");
int paramRowOne = rowNumber;

assertTrue("the table did not contain the correct job parameters for job parameter value foo",
checkModelColumn(paramRowOne, table, "-foo(java.lang.String) "));
assertTrue(checkModelColumn(paramRowOne, table, "-foo(java.lang.String) "),
"the table did not contain the correct job parameters for job parameter value foo");

assertTrue("the table did not contain the correct job parameters for job parameter value bar",
checkModelColumn(paramRowOne, table, "bar(java.lang.String) "));
assertTrue(checkModelColumn(paramRowOne, table, "bar(java.lang.String) "),
"the table did not contain the correct job parameters for job parameter value bar");

assertTrue("the table did not contain the correct job parameters for job parameter value baz",
checkModelColumn(paramRowOne, table, "baz(java.lang.Long) "));
assertTrue(checkModelColumn(paramRowOne, table, "baz(java.lang.Long) "),
"the table did not contain the correct job parameters for job parameter value baz");

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@

import javax.sql.DataSource;

import org.junit.After;
import org.junit.Rule;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -69,7 +69,7 @@ public abstract class AbstractIntegrationTest extends AbstractAssertReleaseDeplo

private final Logger logger = LoggerFactory.getLogger(getClass());

@Rule
@RegisterExtension
public LogTestNameRule logTestName = new LogTestNameRule();

@Autowired
Expand Down Expand Up @@ -102,7 +102,7 @@ public void beforeDumpSchema() {
dbScriptFile.deleteOnExit();
}

@After
@AfterEach
public void restoreEmptySchema() {
// Add a sleep for now to give the local deployer a chance to install the app. This
// should go away once we introduce spring state machine.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,27 @@
*/
package org.springframework.cloud.skipper.server;

import org.junit.rules.TestWatcher;
import org.junit.runner.Description;
import org.junit.jupiter.api.extension.AfterEachCallback;
import org.junit.jupiter.api.extension.BeforeEachCallback;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* @author Mark Pollack
*/
public class LogTestNameRule extends TestWatcher {
public class LogTestNameRule implements BeforeEachCallback, AfterEachCallback {

private final static Logger log = LoggerFactory.getLogger("junit.logTestName");

@Override
protected void starting(Description description) {
log.info("Starting Test {}", description.getMethodName());
public void afterEach(ExtensionContext extensionContext) throws Exception {
log.info("Finished Test: {}", extensionContext.getRequiredTestMethod().getName());
}

@Override
protected void finished(Description description) {
log.info("Finished Test {}", description.getMethodName());
public void beforeEach(ExtensionContext extensionContext) throws Exception {
log.info("Starting Test {}", extensionContext.getRequiredTestMethod().getName());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
package org.springframework.cloud.skipper.server.controller;

import org.junit.After;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -68,7 +68,7 @@ public void cleanupReleaseRepository() {
this.releaseRepository.deleteAll();
}

@After
@AfterEach
public void cleanupReleases() throws Exception {
// Add a sleep for now to give the local deployer a chance to install the app.
// This
Expand Down

This file was deleted.

Loading

0 comments on commit 2a08167

Please sign in to comment.