Skip to content

Commit

Permalink
Moved everything to java and new bug with kotlin quarkusio/quarkus#1969
Browse files Browse the repository at this point in the history
  • Loading branch information
cristhiank committed Apr 10, 2019
1 parent f12afd1 commit 92ef0e8
Show file tree
Hide file tree
Showing 19 changed files with 308 additions and 159 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
target/
*.iml
.idea/
.DS_Store
.classpath
.factorypath
.project
.settings/
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ Test project for reported quarkus bugs

List:

- https://stackoverflow.com/questions/55233662/how-add-flyway-dependency-and-build-native-image-quarkus-java-lang-classnotfound
- https://github.com/quarkusio/quarkus/issues/1575
- https://github.com/quarkusio/quarkus/issues/1650
- https://github.com/quarkusio/quarkus/issues/1828
- ~~https://stackoverflow.com/questions/55233662/how-add-flyway-dependency-and-build-native-image-quarkus-java-lang-classnotfound~~
- ~~https://github.com/quarkusio/quarkus/issues/1575 Flyway support~~
- ~~https://github.com/quarkusio/quarkus/issues/1650 MP-Config Multiple injection~~
- ~~https://github.com/quarkusio/quarkus/issues/1828 Test instance per class JUnit~~
- https://github.com/quarkusio/quarkus/issues/1969 Panache repository in Kotlin test
41 changes: 21 additions & 20 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@
<version>1.0-SNAPSHOT</version>
<properties>
<surefire-plugin.version>2.22.0</surefire-plugin.version>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<kotlin.version>1.3.21</kotlin.version>
<maven.compiler.source>1.8</maven.compiler.source>
<!-- Use 0.11.0 until https://github.com/quarkusio/quarkus/issues/1650 is solved-->
<quarkus.version>0.11.0</quarkus.version>
<quarkus.version>0.13.1</quarkus.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencyManagement>
Expand All @@ -33,45 +32,45 @@
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-arc</artifactId>
<artifactId>quarkus-kotlin</artifactId>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
<version>${kotlin.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5</artifactId>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<scope>test</scope>
<artifactId>quarkus-resteasy-jsonb</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-kotlin</artifactId>
<artifactId>quarkus-arc</artifactId>
</dependency>
<!-- Disabled until available on upstream/master
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-flyway</artifactId>
<version>999-SNAPSHOT</version>
</dependency>
-->
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
<version>5.2.4</version>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-orm-panache</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
<testSourceDirectory>${project.basedir}/src/test/kotlin</testSourceDirectory>
<plugins>
<plugin>
<groupId>io.quarkus</groupId>
Expand Down Expand Up @@ -125,6 +124,8 @@
</compilerPlugins>
<pluginOptions>
<option>all-open:annotation=javax.ws.rs.Path</option>
<option>all-open:annotation=javax.enterprise.context.Dependent</option>
<option>all-open:annotation=javax.enterprise.context.ApplicationScoped</option>
</pluginOptions>
</configuration>
</plugin>
Expand Down
30 changes: 30 additions & 0 deletions src/main/java/org/acme/rest/GreetingResource.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package org.acme.rest;

import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

@Path("/bug")
public class GreetingResource {

@Inject
GreetingService service;
@Inject
OtherService otherService;

@GET
@Path("/1575")
@Produces(MediaType.TEXT_PLAIN)
public String helloBug1575() {
return service.helloBug1575();
}

@GET
@Path("/1650")
@Produces(MediaType.TEXT_PLAIN)
public String helloBug1650() {
return otherService.helloBug1650();
}
}
40 changes: 40 additions & 0 deletions src/main/java/org/acme/rest/GreetingService.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package org.acme.rest;

import javax.enterprise.context.Dependent;
import javax.inject.Inject;

import org.eclipse.microprofile.config.inject.ConfigProperty;
import org.flywaydb.core.Flyway;

@Dependent
class GreetingService {

@Inject
@ConfigProperty(name = "quarkus.datasource.url")
String dbURL;
@Inject
@ConfigProperty(name = "quarkus.datasource.username")
String user;
@Inject
@ConfigProperty(name = "quarkus.datasource.password")
String pass;
// INJECTION (repeated) bug #1650
@Inject
@ConfigProperty(name = "custom.config")
String custom;


String helloBug1575() {
var flyway = Flyway.configure()
.dataSource( dbURL, user, pass )
.baselineOnMigrate( true )
.load();
flyway.baseline();
flyway.migrate();
return "Hello ITS OK";
}

String helloBug1828() {
return "IT WORKS";
}
}
22 changes: 22 additions & 0 deletions src/main/java/org/acme/rest/OtherService.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package org.acme.rest;

import javax.enterprise.context.Dependent;
import javax.inject.Inject;

import org.eclipse.microprofile.config.inject.ConfigProperty;

/**
* @author cristhiank on 2019-03-22
**/
@Dependent
class OtherService {
// INJECTION (repeated) bug #1650
@Inject
@ConfigProperty(name = "custom.config")
String customConfig;

String helloBug1650() {
System.out.println( "Config=" + customConfig );
return customConfig;
}
}
27 changes: 27 additions & 0 deletions src/main/java/org/acme/rest/panache/EntityRepositoryEndpoint.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package org.acme.rest.panache;

import java.util.UUID;
import javax.inject.Inject;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

/**
* @author cristhiank on 2019-04-09
**/
@Path("/test-entity")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public class EntityRepositoryEndpoint {
@Inject
TestEntityRepository repository;

@GET
@Path("/{id}")
public TestEntity findById(@PathParam("id") UUID id) {
return repository.findById( id );
}
}
14 changes: 14 additions & 0 deletions src/main/java/org/acme/rest/panache/TestEntity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.acme.rest.panache;

import java.util.UUID;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;

@Entity
public class TestEntity {
@Id
@GeneratedValue
public UUID id;
public String name;
}
14 changes: 14 additions & 0 deletions src/main/java/org/acme/rest/panache/TestEntityRepository.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.acme.rest.panache;

import java.util.UUID;
import javax.enterprise.context.Dependent;

import io.quarkus.hibernate.orm.panache.PanacheRepositoryBase;

/**
* @author cristhiank on 2019-04-09
*
**/
@Dependent
public class TestEntityRepository implements PanacheRepositoryBase<TestEntity, UUID> {
}
26 changes: 0 additions & 26 deletions src/main/kotlin/org/acme/rest/GreetingResource.kt

This file was deleted.

37 changes: 0 additions & 37 deletions src/main/kotlin/org/acme/rest/GreetingService.kt

This file was deleted.

23 changes: 0 additions & 23 deletions src/main/kotlin/org/acme/rest/OtherService.kt

This file was deleted.

3 changes: 2 additions & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ quarkus.datasource.url:jdbc:h2:mem:quarked_flyway
quarkus.datasource.driver:org.h2.Driver
quarkus.datasource.username:sa
quarkus.datasource.password:sa
custom.config=CUSTOMIZED
custom.config=CUSTOMIZED
quarkus.hibernate-orm.database.generation=drop-and-create
Loading

0 comments on commit 92ef0e8

Please sign in to comment.