Skip to content

Instantly share code, notes, and snippets.

View hudsonmendes's full-sized avatar
🤓
Learning, Deep!

Hudson Leonardo MENDES hudsonmendes

🤓
Learning, Deep!
View GitHub Profile
@hudsonmendes
hudsonmendes / PhoneNumberFormatter.cs
Created April 4, 2017 20:56
PhoneNumberFormatter.cs (Broken)
using System.Text.RegularExpressions;
namespace Sample
{
public class PhoneNumberFormatter
{
private readonly string number;
public PhoneNumberFormatter(string number)
{
@hudsonmendes
hudsonmendes / project.json
Created April 4, 2017 20:48
project.json (V1)
{
"version": "1.0.0-*",
"buildOptions": {
"debugType": "portable"
},
"dependencies": {
"System.Runtime.Serialization.Primitives": "4.3.0",
"xunit": "2.1.0",
"dotnet-test-xunit": "1.0.0-rc2-build10015"
},
package com.hudsonmendes.microservice1;
import static org.hamcrest.Matchers.hasSize;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
import static org.springframework.http.MediaType.APPLICATION_JSON;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
spring:
application:
name: belfastjug-sample-01
data:
mongodb:
uri : ${MONGO_URL}
database: ${MONGO_DBNAME}
package com.hudsonmendes.microservice1;
import org.springframework.data.repository.CrudRepository;
public interface VisitorRepository extends CrudRepository<VisitorEntity, String> {
}
package com.hudsonmendes.microservice1;
import org.springframework.data.annotation.Id;
public class VisitorEntity {
@Id
private String id;
private String name;
package com.hudsonmendes.microservice1;
import static org.springframework.http.ResponseEntity.badRequest;
import static org.springframework.http.ResponseEntity.ok;
import static org.springframework.web.bind.annotation.RequestMethod.POST;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.UUID;
package com.hudsonmendes.microservice1;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
@SpringBootApplication
@EnableMongoRepositories
public class AppEntry {
public static void main(final String[] args) {
buildscript {
ext {
springBootVersion = "1.5.2.RELEASE"
gradleDockerVersion = "1.2"
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
FROM frolvlad/alpine-oraclejdk8:slim
ENV MONGO_URL mongodb://localhost/belfastjug_sample_01
EXPOSE 8080
RUN mkdir -p /app/
ADD build/libs/belfastjug-sample-01-0.0.1-SNAPSHOT.jar /app/belfastjug-sample-01.jar
ENTRYPOINT ["java", "-jar", "/app/belfastjug-sample-01.jar"]