Merge branch '1.5.x' into 2.0.x

2.0.x
Andy Wilkinson 5 years ago
commit 256a0d636d

@ -59,7 +59,7 @@
<requirement
name="org.eclipse.jdt.feature.group"/>
<requirement
name="io.spring.javaformat.eclipse.feature.feature.group"/>
name="io.spring.javaformat.eclipse.feature.feature.group" versionRange="[0.0.14,0.0.15)"/>
<requirement
name="org.eclipse.jst.server_adapters.feature.feature.group"/>
<requirement

@ -24,7 +24,7 @@
</property>
</activation>
<properties>
<spring-javaformat.version>0.0.11</spring-javaformat.version>
<spring-javaformat.version>0.0.14</spring-javaformat.version>
<nohttp-checkstyle.version>0.0.1.RELEASE</nohttp-checkstyle.version>
</properties>
<build>
@ -37,7 +37,7 @@
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>8.18</version>
<version>8.22</version>
</dependency>
<dependency>
<groupId>io.spring.javaformat</groupId>

@ -359,7 +359,8 @@ public class InitCommandTests extends AbstractHttpClientMockTests {
}
private byte[] createFakeZipArchive(String fileName, String content) throws IOException {
try (ByteArrayOutputStream bos = new ByteArrayOutputStream(); ZipOutputStream zos = new ZipOutputStream(bos)) {
try (ByteArrayOutputStream bos = new ByteArrayOutputStream()) {
try (ZipOutputStream zos = new ZipOutputStream(bos)) {
ZipEntry entry = new ZipEntry(fileName);
zos.putNextEntry(entry);
zos.write(content.getBytes());
@ -367,6 +368,7 @@ public class InitCommandTests extends AbstractHttpClientMockTests {
return bos.toByteArray();
}
}
}
private static class TestableInitCommandOptionHandler extends InitCommand.InitOptionHandler {

@ -62,8 +62,10 @@ public class ConfigurationMetadataRepositoryJsonBuilderTests extends AbstractCon
@Test
public void severalRepositoriesNoConflict() throws IOException {
try (InputStream foo = getInputStreamFor("foo"); InputStream bar = getInputStreamFor("bar")) {
ConfigurationMetadataRepository repo = ConfigurationMetadataRepositoryJsonBuilder.create(foo, bar).build();
try (InputStream foo = getInputStreamFor("foo")) {
try (InputStream bar = getInputStreamFor("bar")) {
ConfigurationMetadataRepository repo = ConfigurationMetadataRepositoryJsonBuilder.create(foo, bar)
.build();
validateFoo(repo);
validateBar(repo);
assertThat(repo.getAllGroups()).hasSize(2);
@ -72,11 +74,14 @@ public class ConfigurationMetadataRepositoryJsonBuilderTests extends AbstractCon
assertThat(repo.getAllProperties()).hasSize(6);
}
}
}
@Test
public void repositoryWithRoot() throws IOException {
try (InputStream foo = getInputStreamFor("foo"); InputStream root = getInputStreamFor("root")) {
ConfigurationMetadataRepository repo = ConfigurationMetadataRepositoryJsonBuilder.create(foo, root).build();
try (InputStream foo = getInputStreamFor("foo")) {
try (InputStream root = getInputStreamFor("root")) {
ConfigurationMetadataRepository repo = ConfigurationMetadataRepositoryJsonBuilder.create(foo, root)
.build();
validateFoo(repo);
assertThat(repo.getAllGroups()).hasSize(2);
@ -85,11 +90,14 @@ public class ConfigurationMetadataRepositoryJsonBuilderTests extends AbstractCon
assertThat(repo.getAllProperties()).hasSize(5);
}
}
}
@Test
public void severalRepositoriesIdenticalGroups() throws IOException {
try (InputStream foo = getInputStreamFor("foo"); InputStream foo2 = getInputStreamFor("foo2")) {
ConfigurationMetadataRepository repo = ConfigurationMetadataRepositoryJsonBuilder.create(foo, foo2).build();
try (InputStream foo = getInputStreamFor("foo")) {
try (InputStream foo2 = getInputStreamFor("foo2")) {
ConfigurationMetadataRepository repo = ConfigurationMetadataRepositoryJsonBuilder.create(foo, foo2)
.build();
assertThat(repo.getAllGroups()).hasSize(1);
ConfigurationMetadataGroup group = repo.getAllGroups().get("spring.foo");
contains(group.getSources(), "org.acme.Foo", "org.acme.Foo2", "org.springframework.boot.FooProperties");
@ -102,6 +110,7 @@ public class ConfigurationMetadataRepositoryJsonBuilderTests extends AbstractCon
assertThat(repo.getAllProperties()).hasSize(5);
}
}
}
@Test
public void emptyGroups() throws IOException {
@ -116,8 +125,10 @@ public class ConfigurationMetadataRepositoryJsonBuilderTests extends AbstractCon
@Test
public void builderInstancesAreIsolated() throws IOException {
try (InputStream foo = getInputStreamFor("foo"); InputStream bar = getInputStreamFor("bar")) {
ConfigurationMetadataRepositoryJsonBuilder builder = ConfigurationMetadataRepositoryJsonBuilder.create();
try (InputStream foo = getInputStreamFor("foo")) {
try (InputStream bar = getInputStreamFor("bar")) {
ConfigurationMetadataRepositoryJsonBuilder builder = ConfigurationMetadataRepositoryJsonBuilder
.create();
ConfigurationMetadataRepository firstRepo = builder.withJsonResource(foo).build();
validateFoo(firstRepo);
ConfigurationMetadataRepository secondRepo = builder.withJsonResource(bar).build();
@ -131,6 +142,7 @@ public class ConfigurationMetadataRepositoryJsonBuilderTests extends AbstractCon
assertThat(secondRepo.getAllProperties()).hasSize(6);
}
}
}
private void validateFoo(ConfigurationMetadataRepository repo) {
ConfigurationMetadataGroup group = repo.getAllGroups().get("spring.foo");

@ -4,7 +4,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath("io.spring.javaformat:spring-javaformat-gradle-plugin:0.0.11")
classpath("io.spring.javaformat:spring-javaformat-gradle-plugin:0.0.14")
}
}

Loading…
Cancel
Save