Skip to content

Commit

Permalink
work in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
andrzejj0 committed Oct 18, 2022
1 parent cdb601f commit 0d7d90d
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 3 deletions.
2 changes: 0 additions & 2 deletions src/it/it-use-latest-versions-011/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
<version>@project.version@</version>
<configuration>
<processParent>true</processParent>
<allowMajorUpdates>false</allowMajorUpdates>
<allowMinorUpdates>true</allowMinorUpdates>
<allowIncrementalUpdates>false</allowIncrementalUpdates>
</configuration>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ private void useLatestVersions( ModifiedPomXMLEventReader pom, Collection<Depend
{
Optional<Segment> unchangedSegment = SegmentUtils.determineUnchangedSegment( allowMajorUpdates,
allowMinorUpdates, allowIncrementalUpdates, getLog() );
getLog().debug( "unchanged segment: " + unchangedSegment );

for ( Dependency dep : dependencies )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public static Optional<Segment> determineUnchangedSegment( boolean allowMajorUpd
log.info( "Assuming allowMajorUpdates false because allowMinorUpdates is false." );
}

Optional<Segment> unchangedSegment = allowMajorUpdates && allowMinorUpdates
Optional<Segment> unchangedSegment = allowMajorUpdates && allowMinorUpdates && allowIncrementalUpdates
? empty()
: allowMinorUpdates && allowIncrementalUpdates
? of( MAJOR )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,17 @@ public void testReportLabels()
assertThat( instance.getNewestUpdate( of( SUBINCREMENTAL ) ).toString(), is( "1.1.0-2" ) );
assertThat( instance.getNewestUpdate( of( INCREMENTAL ) ).toString(), is( "1.1.3" ) );
}

@Test
public void testGetNewerVersionsWithSnapshot()
{
ArtifactVersion[] versions = versions( "1.0.0-SNAPSHOT", "1.0.0" );
ArtifactVersions instance =
new ArtifactVersions( new DefaultArtifact( "default-group", "dummy-api",
"1.0.0-SNAPSHOT", "foo", "bar",
"jar", null ),
Arrays.asList( versions ), new MavenVersionComparator() );

// assertThat( instance.getNewerVersions( "1.0.0-SNAPSHOT", of( SUBINCREMENTAL )))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,13 @@ public void testVersionSubIncrementalBoundGreaterThanMinor()
ArtifactVersion artifactVersion = new DefaultArtifactVersion( "1.3" );
assertThat( bound.compareTo( artifactVersion ), greaterThan( 0 ) );
}

@Test
public void testSnapshotWithSubIncremental()
{
BoundArtifactVersion bound = new BoundArtifactVersion( new DefaultArtifactVersion( "1.0.0-SNAPSHOT" ),
Segment.MINOR );
ArtifactVersion artifactVersion = new DefaultArtifactVersion( "1.0.0" );
assertThat( bound.compareTo( artifactVersion ), greaterThan( 0 ) );
}
}

0 comments on commit 0d7d90d

Please sign in to comment.