Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add java code auto reformat to build #13

Merged
merged 3 commits into from
Aug 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
buildscript {
repositories {
mavenCentral()
}
}

allprojects {
group = "io.dataline.${rootProject.name}"
version = rootProject.file('.version').text.trim()
Expand Down
11 changes: 11 additions & 0 deletions conduit-commons/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
plugins {
id "com.diffplug.spotless" version "5.1.1"
}

compileJava.dependsOn 'spotlessApply'

spotless {
java {
googleJavaFormat('1.8')
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.google.common.base.Strings;

public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World" + Strings.repeat("!", 3));
}
public static void main(String[] args) {
System.out.println("Hello World" + Strings.repeat("!", 3));
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package io.dataline.conduit.commons;

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;

import org.junit.jupiter.api.Test;

class HelloWorldTest {
@Test
void name() {
assertEquals(1, 1);
}
}
@Test
void name() {
assertEquals(1, 1);
}
}
9 changes: 9 additions & 0 deletions conduit-server/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
plugins {
id 'application'
id "com.diffplug.spotless" version "5.1.1"
}

compileJava.dependsOn 'spotlessApply'

spotless {
java {
googleJavaFormat('1.8')
}
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,30 @@
import org.slf4j.LoggerFactory;

public class ServerApp {
private final static Logger LOGGER = LoggerFactory.getLogger(ServerApp.class);
private static final Logger LOGGER = LoggerFactory.getLogger(ServerApp.class);

public ServerApp() {
}
public ServerApp() {}

public void start() throws Exception {
Server server = new Server(8080);
public void start() throws Exception {
Server server = new Server(8080);

ServletContextHandler handler = new ServletContextHandler();
ServletContextHandler handler = new ServletContextHandler();

ResourceConfig rc = new ResourceConfig()
.registerClasses(PetApi.class);
ResourceConfig rc = new ResourceConfig().registerClasses(PetApi.class);

ServletHolder conduitServlet = new ServletHolder(new ServletContainer(rc));
ServletHolder conduitServlet = new ServletHolder(new ServletContainer(rc));

handler.addServlet(conduitServlet, "/api/v1/*");
handler.addServlet(conduitServlet, "/api/v1/*");

server.setHandler(handler);
server.setHandler(handler);

server.start();
server.join();
}
server.start();
server.join();
}

public static void main(String[] args) throws Exception {
LOGGER.info("Starting server...");
public static void main(String[] args) throws Exception {
LOGGER.info("Starting server...");

new ServerApp().start();
}
new ServerApp().start();
}
}
Original file line number Diff line number Diff line change
@@ -1,55 +1,50 @@
package io.dataline.conduit.server.apis;

import javax.validation.Valid;
import javax.ws.rs.Path;
import java.io.File;
import java.util.List;

import io.dataline.conduit.api.model.ModelApiResponse;
import io.dataline.conduit.api.model.Pet;
import java.io.File;
import java.util.List;
import javax.validation.Valid;
import javax.ws.rs.Path;

@Path("/pet")
public class PetApi implements io.dataline.conduit.api.PetApi {

@Override
public Pet addPet(@Valid Pet pet) {
return null;
}

@Override
public void deletePet(Long petId, String apiKey) {

}

@Override
public List<Pet> findPetsByStatus(String status) {
return null;
}

@Override
public List<Pet> findPetsByTags(List<String> tags) {
return null;
}

@Override
public Pet getPetById(Long petId) {
final Pet pet = new Pet();
pet.setId(petId);
return pet;
}

@Override
public Pet updatePet(@Valid Pet pet) {
return null;
}

@Override
public void updatePetWithForm(Long petId, String name, String status) {

}

@Override
public ModelApiResponse uploadFile(Long petId, String additionalMetadata, @Valid File body) {
return null;
}
@Override
public Pet addPet(@Valid Pet pet) {
return null;
}

@Override
public void deletePet(Long petId, String apiKey) {}

@Override
public List<Pet> findPetsByStatus(String status) {
return null;
}

@Override
public List<Pet> findPetsByTags(List<String> tags) {
return null;
}

@Override
public Pet getPetById(Long petId) {
final Pet pet = new Pet();
pet.setId(petId);
return pet;
}

@Override
public Pet updatePet(@Valid Pet pet) {
return null;
}

@Override
public void updatePetWithForm(Long petId, String name, String status) {}

@Override
public ModelApiResponse uploadFile(Long petId, String additionalMetadata, @Valid File body) {
return null;
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package io.dataline.conduit.server;

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;

import org.junit.jupiter.api.Test;

class ServerAppTest {
@Test
void name() {
assertEquals(1, 1);
}
@Test
void name() {
assertEquals(1, 1);
}
}