Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into release
Browse files Browse the repository at this point in the history
# Conflicts:
#	README.md
  • Loading branch information
xtermi2 committed Mar 26, 2021
2 parents 8bc6f25 + 25caa52 commit 063be53
Show file tree
Hide file tree
Showing 17 changed files with 113 additions and 21 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/maven-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
build-and-test-with-jdk:
strategy:
matrix:
java: [ 8, 9, 10, 11, 12, 13, 14, 15 ]
java: [ 8, 9, 10, 11, 12, 13, 14, 15, 16 ]
fail-fast: false
runs-on: ubuntu-18.04
steps:
Expand All @@ -40,7 +40,7 @@ jobs:
build-and-test-with-es-version:
strategy:
matrix:
elasticsearchVersion: [ "7.11.2", "7.10.2", "7.9.3", "7.8.1",
elasticsearchVersion: [ "7.12.0", "7.11.2", "7.10.2", "7.9.3", "7.8.1",
"7.7.1", "7.6.2", "7.5.2" ]
fail-fast: false
runs-on: ubuntu-18.04
Expand Down
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]
Copyright 2021 Andreas Keefer

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -202,7 +202,7 @@

----------

Copyright (c) 2019 Andreas Keefer
Copyright (c) 2021 Andreas Keefer

"Anti 996" License Version 1.0 (Draft)

Expand Down
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Successful executed migration scripts will not be executed again!

## 2 Features

- tested on Java 8, 9, 10, 11, 12, 13, 14 and 15
- tested on Java 8, 9, 10, 11, 12, 13, 14, 15 and 16
- runs on Spring-Boot 2.1, 2.2, 2.3 and 2.4 (and of course without Spring-Boot)
- runs on Elasticsearch version 7.5.0+
- highly configurable (e.g. location(s) of your migration files, migration files format pattern)
Expand Down Expand Up @@ -51,7 +51,7 @@ First add the latest version of Elasticsearch-Evolution spring boot starter as a
<dependency>
<groupId>com.senacor.elasticsearch.evolution</groupId>
<artifactId>spring-boot-starter-elasticsearch-evolution</artifactId>
<version>0.3.0</version>
<version>0.3.2</version>
</dependency>
```

Expand All @@ -75,7 +75,7 @@ First add the latest version of Elasticsearch-Evolution core as a dependency:
<dependency>
<groupId>com.senacor.elasticsearch.evolution</groupId>
<artifactId>elasticsearch-evolution-core</artifactId>
<version>0.3.0</version>
<version>0.3.2</version>
</dependency>
```

Expand Down Expand Up @@ -277,6 +277,16 @@ ElasticsearchEvolution.configure()

## 6 changelog

### v0.3.3-SNAPSHOT

- ...

### v0.3.2

- fixed issue [#36](https://github.com/senacor/elasticsearch-evolution/issues/36)
- added java 16 compatibility tests
- added Elasticsearch 7.12 compatibility tests

### v0.3.1

- fixed issue [#29](https://github.com/senacor/elasticsearch-evolution/issues/29)
Expand Down
2 changes: 1 addition & 1 deletion elasticsearch-evolution-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.senacor.elasticsearch.evolution</groupId>
<artifactId>elasticsearch-evolution-parent</artifactId>
<version>0.3.1</version>
<version>0.3.2</version>
<relativePath>../</relativePath>
</parent>
<artifactId>elasticsearch-evolution-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,12 @@ && isValidFilename(pathToCheck.getFileName().toString()))
}

private Stream<RawMigrationScript> readScriptsFromClassPath(String location) {
String locationWithoutPrefixAsPackageNotation = location.substring(CLASSPATH_PREFIX.length())
if (!location.endsWith("/")) {
// fixes https://github.com/senacor/elasticsearch-evolution/issues/36
// otherwise e.g. "...location_some_suffix" will also be found when search for "...location".
location = location + "/";
}
final String locationWithoutPrefixAsPackageNotation = location.substring(CLASSPATH_PREFIX.length())
.replace("/", ".");

final Collection<URL> urls = ClasspathHelper.forPackage(locationWithoutPrefixAsPackageNotation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,39 @@ void handlingDuplicates() {
new RawMigrationScript().setFileName("content.other").setContent("content!"));
}

@Test
void exclude_locations_with_suffix() {
MigrationScriptReaderImpl reader = new MigrationScriptReaderImpl(
singletonList("classpath:scriptreader/issue36/location"),
StandardCharsets.UTF_8,
"c",
singletonList(".http"));

List<RawMigrationScript> actual = reader.read();

// should not contain anything from "classpath:scriptreader/issue36/location_with_suffix"
assertThat(actual)
.containsExactlyInAnyOrder(
new RawMigrationScript().setFileName("content.http").setContent("content!"));
}

@Test
void handle_locations_with_suffix() {
MigrationScriptReaderImpl reader = new MigrationScriptReaderImpl(
Arrays.asList("classpath:scriptreader/issue36/location",
"classpath:scriptreader/issue36/location_with_suffix"),
StandardCharsets.UTF_8,
"c",
singletonList(".http"));

List<RawMigrationScript> actual = reader.read();

assertThat(actual)
.containsExactlyInAnyOrder(
new RawMigrationScript().setFileName("content.http").setContent("content!"),
new RawMigrationScript().setFileName("content_sub.http").setContent("sub content!"));
}

@Test
void withWrongProtocol() {
MigrationScriptReaderImpl reader = new MigrationScriptReaderImpl(
Expand Down Expand Up @@ -135,6 +168,42 @@ void normalPath() throws URISyntaxException {
new RawMigrationScript().setFileName("content_sub.http").setContent("sub content!"));
}

@Test
void exclude_locations_with_suffix() throws URISyntaxException {
URL resourceDirectory = resolveURL("scriptreader");
String absolutePathToScriptreader = Paths.get(resourceDirectory.toURI()).toFile().getAbsolutePath();
MigrationScriptReaderImpl reader = new MigrationScriptReaderImpl(
singletonList("file:"+absolutePathToScriptreader+"/issue36/location"),
StandardCharsets.UTF_8,
"c",
singletonList(".http"));

List<RawMigrationScript> actual = reader.read();

// should not contain anything from "classpath:scriptreader/issue36/location_with_suffix"
assertThat(actual)
.containsExactlyInAnyOrder(
new RawMigrationScript().setFileName("content.http").setContent("content!"));
}

@Test
void handle_locations_with_suffix() throws URISyntaxException {
URL resourceDirectory = resolveURL("scriptreader");
String absolutePathToScriptreader = Paths.get(resourceDirectory.toURI()).toFile().getAbsolutePath();
MigrationScriptReaderImpl reader = new MigrationScriptReaderImpl(
Arrays.asList("file:"+absolutePathToScriptreader+"/issue36/location",
"file:"+absolutePathToScriptreader+"/issue36/location_with_suffix"),
StandardCharsets.UTF_8,
"c",
singletonList(".http"));

List<RawMigrationScript> actual = reader.read();

assertThat(actual)
.containsExactlyInAnyOrder(
new RawMigrationScript().setFileName("content.http").setContent("content!"),
new RawMigrationScript().setFileName("content_sub.http").setContent("sub content!"));
}

@Test
void invalidPath() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public class EmbeddedElasticsearchExtension implements TestInstancePostProcessor
private static final Logger logger = LoggerFactory.getLogger(EmbeddedElasticsearchExtension.class);
private static final Namespace NAMESPACE = Namespace.create(ExtensionContext.class);
private static final SortedSet<String> SUPPORTED_ES_VERSIONS = Collections.unmodifiableSortedSet(new TreeSet<>(Arrays.asList(
"7.12.0",
"7.11.2",
"7.10.2",
"7.9.3",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
content!
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sub content!
13 changes: 9 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@

<groupId>com.senacor.elasticsearch.evolution</groupId>
<artifactId>elasticsearch-evolution-parent</artifactId>
<version>0.3.1</version>
<version>0.3.2</version>
<packaging>pom</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.4.3</version>
<version>2.4.4</version>
</parent>

<name>elasticsearch-evolution</name>
Expand All @@ -23,6 +23,11 @@
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
<license>
<name>Anti 996 License, Version 1.0 (Draft)</name>
<url>https://github.com/996icu/996.ICU/blob/master/LICENSE/</url>
<distribution>repo</distribution>
</license>
</licenses>

<scm>
Expand Down Expand Up @@ -51,8 +56,8 @@
<developers>
<developer>
<name>Andreas Keefer</name>
<email>andreas.keefer@senacor.com</email>
<organizationUrl>https://senacor.com/</organizationUrl>
<email>andreas.keefer@proxora.com</email>
<organizationUrl>https://www.proxora.com/</organizationUrl>
</developer>
</developers>

Expand Down
2 changes: 1 addition & 1 deletion spring-boot-starter-elasticsearch-evolution/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.senacor.elasticsearch.evolution</groupId>
<artifactId>elasticsearch-evolution-parent</artifactId>
<version>0.3.1</version>
<version>0.3.2</version>
<relativePath>../</relativePath>
</parent>
<artifactId>spring-boot-starter-elasticsearch-evolution</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion tests/migration-scripts/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.senacor.elasticsearch.evolution</groupId>
<artifactId>migration-scripts</artifactId>
<version>0.3.1</version>
<version>0.3.2</version>
<description>jar containing migration files</description>

<packaging>jar</packaging>
Expand Down
2 changes: 1 addition & 1 deletion tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.senacor.elasticsearch.evolution</groupId>
<artifactId>elasticsearch-evolution-parent</artifactId>
<version>0.3.1</version>
<version>0.3.2</version>
<relativePath>../</relativePath>
</parent>
<artifactId>tests</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion tests/test-spring-boot-2.1-scriptsInJarFile/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</parent>
<groupId>com.senacor.elasticsearch.evolution</groupId>
<artifactId>test-spring-boot-2.1-scriptsInJarFile</artifactId>
<version>0.3.1</version>
<version>0.3.2</version>
<description>Demo project for Spring Boot</description>

<properties>
Expand Down
2 changes: 1 addition & 1 deletion tests/test-spring-boot-2.2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</parent>
<groupId>com.senacor.elasticsearch.evolution</groupId>
<artifactId>test-spring-boot-2.2</artifactId>
<version>0.3.1</version>
<version>0.3.2</version>
<description>Demo project for Spring Boot</description>

<properties>
Expand Down
2 changes: 1 addition & 1 deletion tests/test-spring-boot-2.3/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</parent>
<groupId>com.senacor.elasticsearch.evolution</groupId>
<artifactId>test-spring-boot-2.3</artifactId>
<version>0.3.1</version>
<version>0.3.2</version>
<description>Demo project for Spring Boot</description>

<properties>
Expand Down
4 changes: 2 additions & 2 deletions tests/test-spring-boot-2.4/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.3</version>
<version>2.4.4</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.senacor.elasticsearch.evolution</groupId>
<artifactId>test-spring-boot-2.4</artifactId>
<version>0.3.1</version>
<version>0.3.2</version>
<description>Demo project for Spring Boot</description>

<properties>
Expand Down

0 comments on commit 063be53

Please sign in to comment.