A way too big commit.
Switched to Apache Maven Invoker for running Maven on the projects. Added JGraphT to correctly sort dependencies in topological order. Upgraded to Spring Boot 1.3.2, Lombok 1.16.6, jGit 4.2.0. Upgraded to Spring Plugin 1.3 to benefit from lazy exception creation using lambdas. Added Lombok configuration to throw IllegalArgumentException on null checks.
This commit is contained in:
@@ -23,7 +23,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
/**
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
@ActiveProfiles({ "test", "local" })
|
||||
@ActiveProfiles({ "local", "test" })
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@SpringApplicationConfiguration(classes = Application.class)
|
||||
public abstract class AbstractIntegrationTests {}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or 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 org.springframework.data.release;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class ApplicationTests extends AbstractIntegrationTests {
|
||||
|
||||
@Test
|
||||
public void bootstrapsApplication() {}
|
||||
}
|
||||
@@ -19,7 +19,7 @@ import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.data.release.maven.Artifact;
|
||||
import org.springframework.data.release.build.MavenArtifact;
|
||||
import org.springframework.data.release.model.ArtifactVersion;
|
||||
import org.springframework.data.release.model.Iteration;
|
||||
import org.springframework.data.release.model.ReleaseTrains;
|
||||
@@ -32,7 +32,7 @@ public class ArtifactUnitTests {
|
||||
@Test
|
||||
public void testname() {
|
||||
|
||||
Artifact artifact = new Artifact(ReleaseTrains.DIJKSTRA.getModuleIteration(Iteration.M1, "JPA"));
|
||||
MavenArtifact artifact = new MavenArtifact(ReleaseTrains.DIJKSTRA.getModuleIteration(Iteration.M1, "JPA"));
|
||||
|
||||
assertThat(artifact.getArtifactId(), is("spring-data-jpa"));
|
||||
assertThat(artifact.getVersion(), is(ArtifactVersion.of("1.6.0.M1")));
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.release.maven;
|
||||
package org.springframework.data.release.build;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -21,8 +21,16 @@ import org.junit.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.data.release.AbstractIntegrationTests;
|
||||
import org.springframework.data.release.git.GitOperations;
|
||||
import org.springframework.data.release.io.Workspace;
|
||||
import org.springframework.data.release.model.ArtifactVersion;
|
||||
import org.springframework.data.release.model.Iteration;
|
||||
import org.springframework.data.release.model.ModuleIteration;
|
||||
import org.springframework.data.release.model.Phase;
|
||||
import org.springframework.data.release.model.Projects;
|
||||
import org.springframework.data.release.model.ReleaseTrains;
|
||||
import org.springframework.data.release.model.TrainIteration;
|
||||
import org.springframework.data.release.model.UpdateInformation;
|
||||
import org.xmlbeam.ProjectionFactory;
|
||||
import org.xmlbeam.io.XBFileIO;
|
||||
|
||||
@@ -33,6 +41,8 @@ public class MavenIntegrationTests extends AbstractIntegrationTests {
|
||||
|
||||
@Autowired Workspace workspace;
|
||||
@Autowired ProjectionFactory projection;
|
||||
@Autowired MavenBuildSystem maven;
|
||||
@Autowired GitOperations git;
|
||||
|
||||
@Test
|
||||
public void modifiesParentPomCorrectly() throws IOException {
|
||||
@@ -42,7 +52,7 @@ public class MavenIntegrationTests extends AbstractIntegrationTests {
|
||||
ParentPom pom = io.read(ParentPom.class);
|
||||
pom.setSharedResourcesVersion(ArtifactVersion.of("1.2.0.RELEASE"));
|
||||
|
||||
// System.out.println(projection.asString(pom));
|
||||
System.out.println(projection.asString(pom));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -57,4 +67,17 @@ public class MavenIntegrationTests extends AbstractIntegrationTests {
|
||||
|
||||
// System.out.println(projection.asString(pom));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testname() throws Exception {
|
||||
|
||||
git.update(ReleaseTrains.HOPPER);
|
||||
|
||||
TrainIteration iteration = new TrainIteration(ReleaseTrains.HOPPER, Iteration.M1);
|
||||
ModuleIteration build = iteration.getModule(Projects.BUILD);
|
||||
UpdateInformation information = new UpdateInformation(iteration, Phase.PREPARE);
|
||||
|
||||
maven.updateProjectDescriptors(build, information);
|
||||
maven.prepareVersion(build, Phase.PREPARE);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright 2015-2016 the original author or 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 org.springframework.data.release.deployment;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.release.AbstractIntegrationTests;
|
||||
import org.springframework.data.release.model.Iteration;
|
||||
import org.springframework.data.release.model.ModuleIteration;
|
||||
import org.springframework.data.release.model.Projects;
|
||||
import org.springframework.data.release.model.ReleaseTrains;
|
||||
import org.springframework.data.release.model.TrainIteration;
|
||||
|
||||
/**
|
||||
* Integration test for {@link DeploymentInformation}.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class DeploymentInformationIntegrationTests extends AbstractIntegrationTests {
|
||||
|
||||
@Autowired DeploymentProperties properties;
|
||||
|
||||
@Test
|
||||
public void createsDeploymentInformation() {
|
||||
|
||||
TrainIteration iteration = new TrainIteration(ReleaseTrains.HOPPER, Iteration.M1);
|
||||
ModuleIteration buildModule = iteration.getModule(Projects.BUILD);
|
||||
|
||||
DeploymentInformation information = new DeploymentInformation(buildModule, properties);
|
||||
|
||||
assertThat(information.getDeploymentTargetUrl(), containsString(properties.getServer().getUri().toString()));
|
||||
assertThat(information.getBuildName(), is("Spring Data Build - Release"));
|
||||
assertThat(information.getTargetRepository(), is("test-libs-milestone-local"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright 2015 the original author or 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 org.springframework.data.release.deployment;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.release.AbstractIntegrationTests;
|
||||
import org.springframework.data.release.build.BuildOperations;
|
||||
import org.springframework.data.release.git.GitOperations;
|
||||
import org.springframework.data.release.model.Iteration;
|
||||
import org.springframework.data.release.model.ModuleIteration;
|
||||
import org.springframework.data.release.model.Phase;
|
||||
import org.springframework.data.release.model.ReleaseTrains;
|
||||
import org.springframework.data.release.model.Train;
|
||||
|
||||
/**
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class DeploymentOperationsIntegrationTests extends AbstractIntegrationTests {
|
||||
|
||||
@Autowired GitOperations git;
|
||||
@Autowired BuildOperations build;
|
||||
@Autowired DeploymentOperations deployment;
|
||||
@Autowired ArtifactoryClient client;
|
||||
|
||||
@Test
|
||||
public void testname() {
|
||||
|
||||
Train train = ReleaseTrains.HOPPER;
|
||||
ModuleIteration buildModule = train.getModuleIteration(Iteration.M1, "build");
|
||||
|
||||
git.update(train);
|
||||
build.prepareVersion(buildModule, Phase.PREPARE);
|
||||
|
||||
DeploymentInformation information = build.buildAndDeployRelease(buildModule);
|
||||
|
||||
try {
|
||||
deployment.promote(information);
|
||||
} finally {
|
||||
client.deleteArtifacts(information);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,9 @@ public class ModuleIterationUnitTests {
|
||||
TrainIteration iteration = new TrainIteration(ReleaseTrains.DIJKSTRA, Iteration.M1);
|
||||
ModuleIteration module = iteration.getModule(Projects.JPA);
|
||||
|
||||
assertThat(module.getVersionString(), is("1.6 M1"));
|
||||
assertThat(module.getShortVersionString(), is("1.6 M1"));
|
||||
assertThat(module.getMediumVersionString(), is("1.6 M1 (Dijkstra)"));
|
||||
assertThat(module.getFullVersionString(), is("1.6.0.M1 (Dijkstra M1)"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -40,6 +42,8 @@ public class ModuleIterationUnitTests {
|
||||
TrainIteration iteration = new TrainIteration(ReleaseTrains.DIJKSTRA, Iteration.SR1);
|
||||
ModuleIteration module = iteration.getModule(Projects.JPA);
|
||||
|
||||
assertThat(module.getVersionString(), is("1.6.1"));
|
||||
assertThat(module.getShortVersionString(), is("1.6.1"));
|
||||
assertThat(module.getMediumVersionString(), is("1.6.1 (Dijkstra SR1)"));
|
||||
assertThat(module.getFullVersionString(), is("1.6.1.RELEASE (Dijkstra SR1)"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright 2015 the original author or 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 org.springframework.data.release.model;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class ProjectUnitTests {
|
||||
|
||||
@Test
|
||||
public void testname() {
|
||||
|
||||
List<Project> projects = new ArrayList<>(Projects.PROJECTS);
|
||||
// Collections.reverse(projects);
|
||||
// Collections.sort(projects);
|
||||
|
||||
projects.stream().map(Project::getName).forEach(System.out::println);
|
||||
|
||||
System.out.println();
|
||||
|
||||
assertThat(projects.get(0), is(Projects.BUILD));
|
||||
assertThat(projects.get(1), is(Projects.COMMONS));
|
||||
}
|
||||
}
|
||||
@@ -22,4 +22,13 @@ public class SimpleIterationVersion implements IterationVersion {
|
||||
|
||||
private final Version version;
|
||||
private final Iteration iteration;
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.release.model.IterationVersion#isServiceIteration()
|
||||
*/
|
||||
@Override
|
||||
public boolean isServiceIteration() {
|
||||
return iteration.isServiceIteration();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,4 +39,18 @@ public class TrainsUnitTest {
|
||||
public void addsNewlyAddedModule() {
|
||||
assertThat(ReleaseTrains.HOPPER.getModule(Projects.ENVERS), is(notNullValue()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testname() {
|
||||
|
||||
Iterable<ModuleIteration> iterations = ReleaseTrains.HOPPER.getModuleIterations(Iteration.M1);
|
||||
|
||||
for (ModuleIteration iteration : iterations) {
|
||||
System.out.println(iteration);
|
||||
}
|
||||
|
||||
System.out.println();
|
||||
|
||||
iterations.forEach(System.out::println);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright 2015 the original author or 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 org.springframework.data.release.model;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link UpdateInformation}.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class UpdateInformationUnitTests {
|
||||
|
||||
TrainIteration hopperM1 = new TrainIteration(ReleaseTrains.HOPPER, Iteration.M1);
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void rejectsNullTrainIteration() {
|
||||
new UpdateInformation(null, Phase.CLEANUP);
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void rejectsNullPhase() {
|
||||
new UpdateInformation(hopperM1, null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void exposesMilestoneRepositoryForMilestone() {
|
||||
assertThat(new UpdateInformation(hopperM1, Phase.PREPARE).getRepository().getId(), is("spring-libs-milestone"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void exposesReleaseRepositoryForGA() {
|
||||
|
||||
Arrays.asList(Iteration.GA, Iteration.SR1).forEach(iteration -> {
|
||||
TrainIteration trainIteration = new TrainIteration(ReleaseTrains.HOPPER, iteration);
|
||||
assertThat(new UpdateInformation(trainIteration, Phase.PREPARE).getRepository().getId(),
|
||||
is("spring-libs-release"));
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void calculatesProjectVersionToSetCorrectly() {
|
||||
|
||||
UpdateInformation updateInformation = new UpdateInformation(hopperM1, Phase.PREPARE);
|
||||
assertThat(updateInformation.getProjectVersionToSet(Projects.JPA).toString(), is("1.10.0.M1"));
|
||||
|
||||
updateInformation = new UpdateInformation(hopperM1, Phase.CLEANUP);
|
||||
assertThat(updateInformation.getProjectVersionToSet(Projects.JPA).toString(), is("1.10.0.BUILD-SNAPSHOT"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user