JAVA-1848: Moved apache-meecrowave to apache-libraries

This commit is contained in:
sampadawagde 2020-06-12 12:12:26 +05:30
parent 06d2080523
commit 1f57916d37
8 changed files with 0 additions and 214 deletions

View File

@ -1,7 +0,0 @@
## Apache Meecrowave
This module contains articles about Apache Meecrowave
### Relevant Articles:
- [Building a Microservice with Apache Meecrowave](https://www.baeldung.com/apache-meecrowave)

View File

@ -1,65 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>apache-meecrowave</artifactId>
<version>0.0.1</version>
<name>apache-meecrowave</name>
<description>A sample REST API application with Meecrowave</description>
<parent>
<groupId>com.baeldung</groupId>
<artifactId>parent-modules</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.apache.meecrowave/meecrowave-core -->
<dependency>
<groupId>org.apache.meecrowave</groupId>
<artifactId>meecrowave-core</artifactId>
<version>${meecrowave-core.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.meecrowave/meecrowave-jpa -->
<dependency>
<groupId>org.apache.meecrowave</groupId>
<artifactId>meecrowave-jpa</artifactId>
<version>${meecrowave-jpa.version}</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>${okhttp.version}</version>
</dependency>
<dependency>
<groupId>org.apache.meecrowave</groupId>
<artifactId>meecrowave-junit</artifactId>
<version>${meecrowave-junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.meecrowave</groupId>
<artifactId>meecrowave-maven-plugin</artifactId>
<version>${meecrowave-maven-plugin.version}</version>
</plugin>
</plugins>
</build>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<meecrowave-junit.version>1.2.0</meecrowave-junit.version>
<okhttp.version>3.10.0</okhttp.version>
<meecrowave-jpa.version>1.2.1</meecrowave-jpa.version>
<meecrowave-core.version>1.2.1</meecrowave-core.version>
<meecrowave-maven-plugin.version>1.2.1</meecrowave-maven-plugin.version>
</properties>
</project>

View File

@ -1,30 +0,0 @@
package com.baeldung.meecrowave;
public class Article {
private String name;
private String author;
public Article() {
}
public Article(String name, String author) {
this.author = author;
this.name = name;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
}

View File

@ -1,32 +0,0 @@
package com.baeldung.meecrowave;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
@RequestScoped
@Path("article")
public class ArticleEndpoints {
@Inject
ArticleService articleService;
@GET
public Response getArticle() {
return Response.ok()
.entity(new Article("name", "author"))
.build();
}
@POST
public Response createArticle(Article article) {
return Response.status(Status.CREATED)
.entity(articleService.createArticle(article))
.build();
}
}

View File

@ -1,10 +0,0 @@
package com.baeldung.meecrowave;
import javax.enterprise.context.ApplicationScoped;
@ApplicationScoped
public class ArticleService {
public Article createArticle(Article article) {
return article;
}
}

View File

@ -1,16 +0,0 @@
package com.baeldung.meecrowave;
import org.apache.meecrowave.Meecrowave;
public class Server {
public static void main(String[] args) {
final Meecrowave.Builder builder = new Meecrowave.Builder();
builder.setScanningPackageIncludes("com.baeldung.meecrowave");
builder.setJaxrsMapping("/api/*");
builder.setJsonpPrettify(true);
try (Meecrowave meecrowave = new Meecrowave(builder)) {
meecrowave.bake().await();
}
}
}

View File

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
</pattern>
</encoder>
</appender>
<root level="INFO">
<appender-ref ref="STDOUT" />
</root>
</configuration>

View File

@ -1,41 +0,0 @@
package com.baeldung.meecrowave;
import static org.junit.Assert.assertEquals;
import java.io.IOException;
import org.apache.meecrowave.Meecrowave;
import org.apache.meecrowave.junit.MonoMeecrowave;
import org.apache.meecrowave.testing.ConfigurationInject;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
@RunWith(MonoMeecrowave.Runner.class)
public class ArticleEndpointsUnitTest {
@ConfigurationInject
private Meecrowave.Builder config;
private static OkHttpClient client;
@BeforeClass
public static void setup() {
client = new OkHttpClient();
}
@Test
public void whenRetunedArticle_thenCorrect() throws IOException {
final String base = "http://localhost:"+config.getHttpPort();
Request request = new Request.Builder()
.url(base+"/article")
.build();
Response response = client.newCall(request).execute();
assertEquals(200, response.code());
}
}