From 27a93555b196ed2ab8b162cf53a74d24ff076e61 Mon Sep 17 00:00:00 2001 From: Lisa Best Date: Fri, 18 Oct 2024 09:01:03 +1030 Subject: [PATCH] Fix spotless errors --- ...ostgresConfigurationDataMigrationTest.java | 61 ++++++++++++------- 1 file changed, 40 insertions(+), 21 deletions(-) diff --git a/postgres-persistence/src/test/java/com/netflix/conductor/postgres/config/PostgresConfigurationDataMigrationTest.java b/postgres-persistence/src/test/java/com/netflix/conductor/postgres/config/PostgresConfigurationDataMigrationTest.java index e45525ade..0f5167fd6 100644 --- a/postgres-persistence/src/test/java/com/netflix/conductor/postgres/config/PostgresConfigurationDataMigrationTest.java +++ b/postgres-persistence/src/test/java/com/netflix/conductor/postgres/config/PostgresConfigurationDataMigrationTest.java @@ -1,6 +1,20 @@ +/* + * Copyright 2024 Conductor Authors. + *

+ * 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 + *

+ * 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 com.netflix.conductor.postgres.config; -import com.netflix.conductor.common.config.TestObjectMapperConfiguration; +import java.util.Arrays; +import java.util.Objects; + import org.flywaydb.core.Flyway; import org.junit.Before; import org.junit.Test; @@ -14,34 +28,31 @@ import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit4.SpringRunner; -import java.util.Arrays; -import java.util.Objects; +import com.netflix.conductor.common.config.TestObjectMapperConfiguration; import static org.junit.Assert.assertTrue; @ContextConfiguration( classes = { - TestObjectMapperConfiguration.class, - PostgresConfiguration.class, - FlywayAutoConfiguration.class + TestObjectMapperConfiguration.class, + PostgresConfiguration.class, + FlywayAutoConfiguration.class }) @RunWith(SpringRunner.class) @TestPropertySource( properties = { - "conductor.app.asyncIndexingEnabled=false", - "conductor.elasticsearch.version=0", - "conductor.indexing.type=postgres", - "conductor.postgres.applyDataMigrations=false", - "spring.flyway.clean-disabled=false" + "conductor.app.asyncIndexingEnabled=false", + "conductor.elasticsearch.version=0", + "conductor.indexing.type=postgres", + "conductor.postgres.applyDataMigrations=false", + "spring.flyway.clean-disabled=false" }) @SpringBootTest public class PostgresConfigurationDataMigrationTest { - @Autowired - Flyway flyway; + @Autowired Flyway flyway; - @Autowired - ResourcePatternResolver resourcePatternResolver; + @Autowired ResourcePatternResolver resourcePatternResolver; // clean the database between tests. @Before @@ -52,11 +63,19 @@ public void before() { @Test public void dataMigrationIsNotAppliedWhenDisabled() throws Exception { var files = resourcePatternResolver.getResources("classpath:db/migration_postgres_data/*"); - Arrays.stream(flyway.info().applied()).forEach(migrationInfo -> - assertTrue("Data migration wrongly applied: " + migrationInfo.getScript(), - Arrays.stream(files) - .map(Resource::getFilename) - .filter(Objects::nonNull) - .noneMatch(fileName -> fileName.contains(migrationInfo.getScript())))); + Arrays.stream(flyway.info().applied()) + .forEach( + migrationInfo -> + assertTrue( + "Data migration wrongly applied: " + + migrationInfo.getScript(), + Arrays.stream(files) + .map(Resource::getFilename) + .filter(Objects::nonNull) + .noneMatch( + fileName -> + fileName.contains( + migrationInfo + .getScript())))); } }