Skip to content

Commit

Permalink
Merge branch 'version/revamp' into 858-incorporate-new-parser-into-core
Browse files Browse the repository at this point in the history
  • Loading branch information
fabapp2 authored Sep 24, 2023
2 parents 084872b + f48a9eb commit 8abece3
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.fasterxml.jackson.dataformat.yaml.YAMLMapper;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.openrewrite.ExecutionContext;
import org.openrewrite.maven.MavenSettings;
Expand All @@ -32,10 +33,7 @@
import org.springframework.sbm.engine.commands.ApplicableRecipeListCommand;
import org.springframework.sbm.engine.commands.ApplyCommand;
import org.springframework.sbm.engine.commands.ScanCommand;
import org.springframework.sbm.engine.context.ProjectContext;
import org.springframework.sbm.engine.context.ProjectContextFactory;
import org.springframework.sbm.engine.context.ProjectContextSerializer;
import org.springframework.sbm.engine.context.ProjectRootPathResolver;
import org.springframework.sbm.engine.context.*;
import org.springframework.sbm.engine.git.GitSupport;
import org.springframework.sbm.engine.git.ProjectSyncVerifier;
import org.springframework.sbm.engine.precondition.PreconditionVerifier;
Expand Down Expand Up @@ -102,34 +100,35 @@
* @author Fabian Krüger
*/
@Slf4j
@Disabled()
@SpringBootTest(classes = {
ScanScope.class,
ExecutionScope.class,
// ScanScope.class,
// ExecutionScope.class,
ScanCommand.class,
ProjectRootPathResolver.class,
PathScanner.class,
// PathScanner.class,
SbmApplicationProperties.class,
ResourceHelper.class,
PreconditionVerifier.class,
ProjectContextInitializer.class,
ProjectContextFactory.class,
ProjectResourceWrapperRegistry.class,
ProjectResourceSetHolder.class,
ProjectContextHolder.class,
JavaRefactoringFactoryImpl.class,
BasePackageCalculator.class,
JavaParserBuilder.class,
RewriteParserConfiguration.class,
RewriteProjectParser.class,
ResourceParser.class,
RewriteJsonParser.class,
RewriteXmlParser.class,
RewriteYamlParser.class,
RewritePropertiesParser.class,
RewritePlainTextParser.class,
RewriteMavenParser.class,
// RewriteParserConfiguration.class,
// RewriteProjectParser.class,
// ResourceParser.class,
// RewriteJsonParser.class,
// RewriteXmlParser.class,
// RewriteYamlParser.class,
// RewritePropertiesParser.class,
// RewritePlainTextParser.class,
// RewriteMavenParser.class,
MavenSettingsInitializer.class,
RewriteMigrationResultMerger.class,
RewriteMavenArtifactDownloader.class,
JavaProvenanceMarkerFactory.class,
MavenConfigHandler.class,
RewriteSourceFileWrapper.class,
Expand All @@ -146,7 +145,9 @@
ExecutionScopeArchFitTestContext.class,
SbmSupportRewriteConfiguration.class
},
properties = "spring.main.allow-bean-definition-overriding=true"
properties = {
"spring.main.allow-bean-definition-overriding=true", // required to provide custom ProjectMetadata
"debug=true"}
)
public class ExecutionScopeArchFitTest {
public static final String TEST_RECIPE_NAME = "dummy-recipe";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,36 @@ void parseResources() {
assertThat(parsingResult.sourceFiles()).hasSize(5);
}

@Test
@DisplayName("parse4Modules")
void parse4Modules() {
Path baseDir = getMavenProject("4-modules");
List<Resource> resources = projectScanner.scan(baseDir);

assertThat(resources).hasSize(4);

RewriteProjectParsingResult parsingResult = sut.parse(baseDir, resources, new InMemoryExecutionContext(t -> {throw new RuntimeException(t);}));
assertThat(parsingResult.sourceFiles()).hasSize(4);
}

@Autowired
RewriteMavenProjectParser mavenProjectParser;

@Test
@DisplayName("parseResources")
void parseResources() {
Path baseDir = getMavenProject("resources");
List<Resource> resources = projectScanner.scan(baseDir);

RewriteProjectParsingResult parsingResult1 = mavenProjectParser.parse(baseDir);
assertThat(parsingResult1.sourceFiles()).hasSize(5);

RewriteProjectParsingResult parsingResult = sut.parse(baseDir, resources, new InMemoryExecutionContext(t -> {
throw new RuntimeException(t);
}));
assertThat(parsingResult.sourceFiles()).hasSize(5);
}

private Path getMavenProject(String s) {
return Path.of("./testcode/maven-projects/").resolve(s).toAbsolutePath().normalize();
}
Expand Down

0 comments on commit 8abece3

Please sign in to comment.