Skip to content

Commit

Permalink
Codestart customized package and class and more
Browse files Browse the repository at this point in the history
Fixes #11154
  • Loading branch information
ia3andy committed Aug 27, 2020
1 parent 94fafbc commit f6f959f
Show file tree
Hide file tree
Showing 70 changed files with 979 additions and 510 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ output-strategy:
language:
base:
data:
quarkus:
gradle-plugin:
id: io.quarkus
kotlin:
version: 1.3.72
shared-data:
quarkus:
gradle-plugin:
id: io.quarkus
buildtool:
build-dir: build
guide: https://quarkus.io/guides/gradle-tooling
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ output-strategy:
language:
base:
data:
quarkus:
gradle-plugin:
id: io.quarkus
kotlin:
version: 1.3.72
shared-data:
quarkus:
gradle-plugin:
id: io.quarkus
buildtool:
build-dir: build
guide: https://quarkus.io/guides/gradle-tooling
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
name: commandmode-example
ref: commandmode
type: example
fallback: true
type: code
tags: example
language:
base:
data:
main:
class-name: HelloCommando
package-name: org.acme.commandmode
greeting:
message: "hello"
default-name: "commando"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package {package-name};

import javax.enterprise.context.control.ActivateRequestContext;
import javax.inject.Inject;

import io.quarkus.runtime.Quarkus;
import io.quarkus.runtime.QuarkusApplication;
import io.quarkus.runtime.annotations.QuarkusMain;

@QuarkusMain
public class {main.class-name} implements QuarkusApplication {

@Override
public int run(String... args) throws Exception {
final String name = args.length > 0 ? String.join(" ", args) : "{greeting.default-name}";
System.out.println("{greeting.message} " + name);
return 0;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package {package-name}

import javax.inject.Inject

import io.quarkus.runtime.QuarkusApplication
import io.quarkus.runtime.annotations.QuarkusMain

@QuarkusMain
class {main.class-name}: QuarkusApplication {

override fun run(vararg args: String?): Int {
val name = if (args.isNotEmpty()) args.joinToString(",") else "{greeting.default-name}"
println(name)
return 0
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ <h2>What can I do from here?</h2>
<p>If not already done, run the application in <em>dev mode</em> using: <code>{buildtool.cmd.dev}</code>.
</p>
<ul>
<li>Open the example <a href="{rest.path}" target="_blank">"/hello"</a> endpoint</li>
<li>Open the example <a href="{resource.path}" target="_blank">"/hello"</a> endpoint</li>
<li>Add REST resources, Servlets, functions and other services in <code>{language.dir.code}</code>.</li>
<li>Your static assets are located in <code>src/main/resources/META-INF/resources</code>.</li>
<li>Configure your application in <code>src/main/resources/{config.file-name}</code>.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
name: resteasy-example
ref: resteasy
type: example
type: code
tags: example
language:
base:
data:
rest:
resource:
class-name: ExampleResource
path: "/resteasy/hello"
response: "hello"
package-name: org.acme.resteasy
dependencies:
- io.quarkus:quarkus-resteasy
test-dependencies:
- io.rest-assured:rest-assured
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package org.acme.resteasy;
package {package-name};

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

@Path("{rest.path}")
public class ExampleResource {
@Path("{resource.path}")
public class {resource.class-name} {

@GET
@Produces(MediaType.TEXT_PLAIN)
public String hello() {
return "{rest.response}";
return "{resource.response}";
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package org.acme.resteasy;
package {package-name};

import io.quarkus.test.junit.NativeImageTest;

@NativeImageTest
public class NativeExampleResourceIT extends ExampleResourceTest {
public class Native{resource.class-name}IT extends {resource.class-name}Test {

// Execute the same tests but in native mode.
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.acme.resteasy;
package {package-name};

import io.quarkus.test.junit.QuarkusTest;
import org.junit.jupiter.api.Test;
Expand All @@ -7,15 +7,15 @@
import static org.hamcrest.CoreMatchers.is;

@QuarkusTest
public class ExampleResourceTest {
public class {resource.class-name}Test {

@Test
public void testHelloEndpoint() {
given()
.when().get("{rest.path}")
.when().get("{resource.path}")
.then()
.statusCode(200)
.body(is("{rest.response}"));
.body(is("{resource.response}"));
}

}
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package org.acme.resteasy
package {package-name}

import javax.ws.rs.GET
import javax.ws.rs.Path
import javax.ws.rs.Produces
import javax.ws.rs.core.MediaType

@Path("{rest.path}")
class ExampleResource {
@Path("{resource.path}")
class {resource.class-name} {

@GET
@Produces(MediaType.TEXT_PLAIN)
fun hello() = "{rest.response}"
fun hello() = "{resource.response}"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package {package-name}

import io.quarkus.test.junit.NativeImageTest

@NativeImageTest
class Native{resource.class-name}IT : {resource.class-name}Test()
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
package org.acme.resteasy
package {package-name}

import io.quarkus.test.junit.QuarkusTest
import io.restassured.RestAssured.given
import org.hamcrest.CoreMatchers.`is`
import org.junit.jupiter.api.Test

@QuarkusTest
class ExampleResourceTest {
class {resource.class-name}Test {

@Test
fun testHelloEndpoint() {
given()
.`when`().get("{rest.path}")
.`when`().get("{resource.path}")
.then()
.statusCode(200)
.body(`is`("{rest.response}"))
.body(`is`("{resource.response}"))
}

}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package org.acme.resteasy
package {package-name}

import javax.ws.rs.\{GET, Path, Produces}
import javax.ws.rs.core.MediaType

@Path("{rest.path}")
class ExampleResource {
@Path("{resource.path}")
class {resource.class-name} {

@GET
@Produces(Array[String](MediaType.TEXT_PLAIN))
def hello() = "{rest.response}"
def hello() = "{resource.response}"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package {package-name}

import io.quarkus.test.junit.NativeImageTest

@NativeImageTest
class Native{resource.class-name}IT extends {resource.class-name}Test
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
package org.acme.resteasy
package {package-name}

import io.quarkus.test.junit.QuarkusTest
import io.restassured.RestAssured.given
import org.hamcrest.CoreMatchers.`is`
import org.junit.jupiter.api.Test

@QuarkusTest
class ExampleResourceTest {
class {resource.class-name}Test {

@Test
def testHelloEndpoint() = {
given()
.`when`().get("{rest.path}")
.`when`().get("{resource.path}")
.then()
.statusCode(200)
.body(`is`("{rest.response}"))
.body(`is`("{resource.response}"))
}

}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@
#
# Then, build the image with:
#
# docker build -f src/main/docker/Dockerfile.jvm -t quarkus/{project.artifact-id}-jvm .
# docker build -f src/main/docker/Dockerfile.fast-jar -t quarkus/{project.artifact-id}-fast-jar .
#
# Then run the container using:
#
# docker run -i --rm -p 8080:8080 quarkus/{project.artifact-id}-jvm
# docker run -i --rm -p 8080:8080 quarkus/{project.artifact-id}-fast-jar
#
# If you want to include the debug port into your docker image
# you will have to expose the debug port (default 5005) like this : EXPOSE 8080 5050
#
# Then run the container using :
#
# docker run -i --rm -p 8080:8080 -p 5005:5005 -e JAVA_ENABLE_DEBUG="true" quarkus/{project.artifact-id}-jvm
# docker run -i --rm -p 8080:8080 -p 5005:5005 -e JAVA_ENABLE_DEBUG="true" quarkus/{project.artifact-id}-fast-jar
#
###
FROM {dockerfile.fast-jar.from}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
---
name: amazon-lambda-example
ref: amazon-lambda
type: example
type: code
tags:
- example
- compatibility-issues
language:
base:
shared-data:
Expand Down
Loading

0 comments on commit f6f959f

Please sign in to comment.