use of io.javalin.Javalin in project helloworld-web by dbelob.
the class Application method main.
public static void main(String[] args) {
Javalin app = Javalin.create().start(8080);
app.get("/", ctx -> ctx.result("Hello, World!"));
app.get("/json", ctx -> ctx.json(new Entity("value")));
}
use of io.javalin.Javalin in project Artemis by mbizhani.
the class TestArtemis method test_error.
@Test
public void test_error() {
final Javalin app = Javalin.create().start(8080);
configure(app);
final int degree = 9;
try {
ArtemisExecutor.run(new Config("artemis-error").addVar("backEnd", "http://localhost:8080").setParallel(degree));
fail();
} catch (TestFailedException e) {
assertEquals(degree / 2 + degree % 2, e.getNoOfErrors());
assertEquals(degree, e.getDegree());
} catch (Exception e) {
log.error("test_error", e);
fail();
}
app.stop();
}
use of io.javalin.Javalin in project Artemis by mbizhani.
the class TestArtemis method test_devMode_baseUrlViaConfig.
@Test
public void test_devMode_baseUrlViaConfig() {
final String baseUrl = "http://localhost:7777";
final Javalin app = Javalin.create().start(7777);
configure(app);
ArtemisExecutor.run(new Config().setDevMode(true).setConsoleLog(false).setBaseUrl(baseUrl).setBaseDir("src/test/resources").addVar("backEnd", baseUrl));
app.stop();
}
use of io.javalin.Javalin in project Artemis by mbizhani.
the class TestArtemis method test_defaultConfig.
@Test
public void test_defaultConfig() {
final Javalin app = Javalin.create().start(8080);
configure(app);
ArtemisExecutor.run(new Config().addVar("backEnd", "http://localhost:8080").setParallel(1));
app.stop();
}
use of io.javalin.Javalin in project Artemis by mbizhani.
the class TestArtemis method test_devMode.
@Test
public void test_devMode() {
final Javalin app = Javalin.create().start(8080);
configure(app);
final File memFile = new File(".artemis-devMode.memory.json");
memFile.delete();
try {
ArtemisExecutor.run(new Config("artemis-devMode", "artemis").setDevMode(true).addVar("backEnd", "http://localhost:8080"));
fail();
} catch (TestFailedException e) {
assertEquals("Reached Break Point!", e.getMessage());
assertTrue(memFile.exists());
} catch (Exception e) {
log.error("test_error", e);
fail();
}
app.stop();
memFile.delete();
}
Aggregations