|
34 | 34 | import org.junit.jupiter.params.provider.MethodSource; |
35 | 35 | import org.junit.jupiter.params.provider.ValueSource; |
36 | 36 | import org.openrewrite.*; |
37 | | -import org.openrewrite.maven.cache.MavenPomCache; |
38 | 37 | import org.openrewrite.maven.http.OkHttpSender; |
39 | 38 | import org.openrewrite.maven.internal.MavenParsingException; |
40 | 39 | import org.openrewrite.maven.tree.*; |
|
44 | 43 |
|
45 | 44 | import java.net.InetAddress; |
46 | 45 | import java.nio.file.Path; |
47 | | -import java.util.*; |
| 46 | +import java.util.Base64; |
| 47 | +import java.util.List; |
| 48 | +import java.util.Map; |
| 49 | +import java.util.Objects; |
48 | 50 | import java.util.stream.Stream; |
49 | 51 |
|
50 | 52 | import static java.util.stream.Collectors.groupingBy; |
@@ -4715,101 +4717,6 @@ void allDependencyManagementEntryVariants_allDependencyVariants() { |
4715 | 4717 |
|
4716 | 4718 | } |
4717 | 4719 |
|
4718 | | - @Test |
4719 | | - void transitiveDependencyVersion() { |
4720 | | - InMemoryExecutionContext ctx = new InMemoryExecutionContext(); |
4721 | | - rewriteRun( |
4722 | | - spec -> spec.executionContext(ctx), |
4723 | | - pomXml( |
4724 | | - """ |
4725 | | - <project> |
4726 | | - <groupId>com.example.my-app</groupId> |
4727 | | - <artifactId>my-app-bom</artifactId> |
4728 | | - <version>1</version> |
4729 | | - <packaging>pom</packaging> |
4730 | | - <dependencyManagement> |
4731 | | - <dependencies> |
4732 | | - <dependency> |
4733 | | - <groupId>org.bouncycastle</groupId> |
4734 | | - <artifactId>bcprov-jdk18on</artifactId> |
4735 | | - <version>1.79</version> |
4736 | | - </dependency> |
4737 | | - </dependencies> |
4738 | | - </dependencyManagement> |
4739 | | - </project> |
4740 | | - """ |
4741 | | - ), |
4742 | | - mavenProject("parent", |
4743 | | - pomXml( |
4744 | | - """ |
4745 | | - <project> |
4746 | | - <groupId>com.example.my-app</groupId> |
4747 | | - <artifactId>my-app-parent</artifactId> |
4748 | | - <version>1</version> |
4749 | | - <packaging>pom</packaging> |
4750 | | - <dependencyManagement> |
4751 | | - <dependencies> |
4752 | | - <dependency> |
4753 | | - <groupId>com.example.my-app</groupId> |
4754 | | - <artifactId>my-app-bom</artifactId> |
4755 | | - <version>1</version> |
4756 | | - <type>pom</type> |
4757 | | - <scope>import</scope> |
4758 | | - </dependency> |
4759 | | - <dependency> |
4760 | | - <groupId>org.bouncycastle</groupId> |
4761 | | - <artifactId>bcprov-jdk18on</artifactId> |
4762 | | - </dependency> |
4763 | | - </dependencies> |
4764 | | - </dependencyManagement> |
4765 | | - </project> |
4766 | | - """ |
4767 | | - ) |
4768 | | - ), |
4769 | | - mavenProject("my-app", |
4770 | | - pomXml( |
4771 | | - """ |
4772 | | - <project> |
4773 | | - <groupId>com.example.my-app</groupId> |
4774 | | - <artifactId>my-app</artifactId> |
4775 | | - <version>1</version> |
4776 | | - <parent> |
4777 | | - <groupId>com.example.my-app</groupId> |
4778 | | - <artifactId>my-app-parent</artifactId> |
4779 | | - <version>1</version> |
4780 | | - </parent> |
4781 | | - <dependencies> |
4782 | | - <dependency> |
4783 | | - <groupId>org.bouncycastle</groupId> |
4784 | | - <artifactId>bcpkix-jdk18on</artifactId> |
4785 | | - <version>1.71</version> |
4786 | | - </dependency> |
4787 | | - </dependencies> |
4788 | | - </project> |
4789 | | - """, |
4790 | | - spec -> spec.afterRecipe(pom -> { |
4791 | | - assertThat(pom).isNotNull(); |
4792 | | - Optional<MavenResolutionResult> maybeMrr = pom.getMarkers().findFirst(MavenResolutionResult.class); |
4793 | | - assertThat(maybeMrr).isPresent(); |
4794 | | - |
4795 | | - MavenResolutionResult mrr = maybeMrr.get(); |
4796 | | - assertThat(mrr.getDependencies().get(Scope.Compile).stream()) |
4797 | | - .anyMatch(resolvedDependency -> "org.bouncycastle".equals(resolvedDependency.getGroupId()) && |
4798 | | - "bcprov-jdk18on".equals(resolvedDependency.getArtifactId()) && |
4799 | | - "1.79".equals(resolvedDependency.getVersion())) |
4800 | | - .noneMatch(resolvedDependency -> "org.bouncycastle".equals(resolvedDependency.getGroupId()) && |
4801 | | - "bcprov-jdk18on".equals(resolvedDependency.getArtifactId()) && |
4802 | | - !"1.79".equals(resolvedDependency.getVersion())); |
4803 | | - |
4804 | | - MavenPomCache pomCache = MavenExecutionContextView.view(ctx).getPomCache(); |
4805 | | - assertThat(pomCache.getPom(new ResolvedGroupArtifactVersion(MavenRepository.MAVEN_CENTRAL.getUri(), "org.bouncycastle", "bcprov-jdk18on", "1.79", "1.79"))).isPresent(); |
4806 | | - assertThat(pomCache.getPom(new ResolvedGroupArtifactVersion(MavenRepository.MAVEN_CENTRAL.getUri(), "org.bouncycastle", "bcprov-jdk18on", "1.71", "1.71"))).isNull(); |
4807 | | - }) |
4808 | | - ) |
4809 | | - ) |
4810 | | - ); |
4811 | | - } |
4812 | | - |
4813 | 4720 | @Test |
4814 | 4721 | void groupIdAndArtifactIdAsProperties() { |
4815 | 4722 | rewriteRun( |
|
0 commit comments