Skip to content

Quickstart tests failing #168

@Boltzmann

Description

@Boltzmann

After using the workaround given in #162 I have problems executing the tests.

mvn clean test gives

[ERROR] testRetrieveServiceDocument  Time elapsed: 0 s  <<< ERROR!
java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'flywayInitializer' defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Invocation of init method failed; nested exception is org.flywaydb.core.api.FlywayException: Found more than one migration with version 1.0
Offenders:
-> C:\Users\localuser\Development\trippinWindows\target\classes\db\migration\V1_0__jpa.sql (SQL)
-> C:\Users\localuser\Development\trippinWindows\file:\C:\Users\localuser\.m2\repository\com\github\SAP\olingo-jpa-processor-v4\odata-jpa-test\1.0.8\odata-jpa-test-1.0.8.jar!\db\migration\V1_0__olingo.sql (SQL)
Caused by: org.flywaydb.core.api.FlywayException:
Found more than one migration with version 1.0
Offenders:
-> C:\Users\localuser\Development\trippinWindows\target\classes\db\migration\V1_0__jpa.sql (SQL)
-> C:\Users\localuser\Development\trippinWindows\file:\C:\Users\localuser\.m2\repository\com\github\SAP\olingo-jpa-processor-v4\odata-jpa-test\1.0.8\odata-jpa-test-1.0.8.jar!\db\migration\V1_0__olingo.sql (SQL)

[INFO]
[INFO] Results:
[INFO]
[ERROR] Errors:
[ERROR]   ControllerTest.testCreateInstance » IllegalState Failed to load ApplicationCon...
[ERROR]   ControllerTest.testCreateInstanceDeep » IllegalState Failed to load Applicatio...
[ERROR]   ControllerTest.testCreateInstanceWithBatch » IllegalState Failed to load Appli...
[ERROR]   ControllerTest.testRetrieveMetadataDocument » IllegalState Failed to load Appl...
[ERROR]   ControllerTest.testRetrieveServiceDocument » IllegalState Failed to load Appli...
[INFO]
[ERROR] Tests run: 6, Failures: 0, Errors: 5, Skipped: 0

I had to change pom.xml, because com.sap.olingo is not retrievable from maven

<project xmlns="http://maven.apache.org/POM/4.0.0"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
	
	<modelVersion>4.0.0</modelVersion>
	<groupId>com.example</groupId>
	<artifactId>trippin</artifactId>
	<version>1.0-SNAPSHOT</version>
	<packaging>jar</packaging>


	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		 <version>2.6.2</version>
		<relativePath />
	</parent>

	<properties>
		<processor.version>1.0.8</processor.version>
		<java.version>1.8</java.version>
        <eclipselink.version>2.7.9</eclipselink.version>
        <jpa.version>2.2.1</jpa.version>
	</properties>

	<repositories>
		<repository>
			<id>jitpack.io</id>
			<url>https://jitpack.io</url>
		</repository>
	</repositories>

	<dependencies>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
			<exclusions>
				<exclusion>
					<groupId>junit</groupId>
					<artifactId>junit</artifactId>
				</exclusion>
			</exclusions>			
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-data-jpa</artifactId>
			<exclusions>
				<exclusion>
					<groupId>org.hibernate</groupId>
					<artifactId>hibernate-entitymanager</artifactId>
				</exclusion>
				<exclusion>
					<groupId>org.hibernate</groupId>
					<artifactId>hibernate-core</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.eclipse.persistence</groupId>
			<artifactId>javax.persistence</artifactId>
			<version>${jpa.version}</version>
			<scope>compile</scope>
		</dependency>
		<dependency>
			<groupId>org.eclipse.persistence</groupId>
			<artifactId>eclipselink</artifactId>
			<version>${eclipselink.version}</version>
		</dependency>
		<dependency>
			<groupId>com.github.SAP</groupId>
			<artifactId>olingo-jpa-processor-v4</artifactId>
			<version>${processor.version}</version>
		</dependency>			
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-configuration-processor</artifactId>
			<optional>true</optional>
		</dependency>
		<dependency>
			<groupId>org.flywaydb</groupId>
			<artifactId>flyway-core</artifactId>
			<version>8.4.0</version>
		</dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <version>2.1.210</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.hsqldb</groupId>
            <artifactId>hsqldb</artifactId>
            <scope>runtime</scope>
        </dependency>           
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-devtools</artifactId>
			<optional>true</optional>
		</dependency>
		<dependency>
			<groupId>io.rest-assured</groupId>
			<artifactId>spring-mock-mvc</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.junit.jupiter</groupId>
			<artifactId>junit-jupiter</artifactId>
			<version>5.8.1</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.junit.platform</groupId>
			<artifactId>junit-platform-launcher</artifactId>
			<version>1.8.1</version><!--$NO-MVN-MAN-VER$-->
			<scope>test</scope>
		</dependency>	
	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
			</plugin>
		</plugins>
	</build>
</project>

My file structure is

.
├── pom.xml
└── src
    ├── main
    │   ├── java
    │   │   └── com
    │   │       └── example
    │   │           ├── SpringApp.java
    │   │           ├── config
    │   │           │   ├── EclipseLinkJpaConfiguration.java
    │   │           │   └── ProcessorConfiguration.java
    │   │           ├── controller
    │   │           │   └── ODataController.java
    │   │           └── model
    │   │               ├── EntityTemplate.java
    │   │               ├── ValueObjectTemplate.java
    │   │               └── ValueObjectTemplateKey.java
    │   └── resources
    │       ├── application-test.yml
    │       ├── application.yml
    │       └── db
    │           └── migration
    │               └── V1_0__jpa.sql
    └── test
        ├── java
        │   └── com
        │       └── example
        │           ├── AppTest.java
        │           └── integrationtest
        │               └── ControllerTest.java
        └── resources
            └── requests
                └── CreateEntityViaBatch.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions