This guide will get you started using Spark on Heroku/Cedar. Spark is basically a clone of Sinatra for Java. 'Nuff said.
Create a single Java main class in src/main/java/HelloWorld.java:
:::java
import static spark.Spark.*;
import spark.*;
| SCSS |
| package com.example | |
| import groovy.util.logging.Slf4j | |
| import org.springframework.boot.SpringApplication | |
| import org.springframework.boot.autoconfigure.EnableAutoConfiguration | |
| import org.springframework.context.ApplicationContext | |
| import org.springframework.context.annotation.ComponentScan | |
| import org.springframework.context.annotation.Configuration | |
| import org.springframework.context.annotation.Import | |
| import org.springframework.web.servlet.config.annotation.EnableWebMvc |
| package qa.com.espressospoonstructure.screenObjects; | |
| import android.support.test.espresso.ViewInteraction; | |
| import org.hamcrest.Matcher; | |
| import static android.support.test.espresso.Espresso.onView; | |
| import static android.support.test.espresso.action.ViewActions.clearText; | |
| import static android.support.test.espresso.action.ViewActions.click; | |
| import static android.support.test.espresso.action.ViewActions.scrollTo; |
| package qa.com.espressospoonstructure.tests; | |
| import org.junit.Test; | |
| import qa.com.espressospoonstructure.screenObjects.LoginScreen; | |
| import static android.support.test.espresso.assertion.ViewAssertions.matches; | |
| import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed; | |
| public class TestLoginScreen extends BaseTestCase<MainActivity> { |
| package com.example.hzaier.myapplicationkt.dsl | |
| import org.junit.Test | |
| interface Matcher<T> { | |
| fun test(lhs: T) | |
| infix fun or(other: Matcher<T>): Matcher<T> = object : Matcher<T> { | |
| override fun test(lhs: T) { |
| import android.support.annotation.NonNull; | |
| import android.support.annotation.Nullable; | |
| import android.support.v4.util.ArrayMap; | |
| import java.io.IOException; | |
| import java.util.Collections; | |
| import java.util.Map; | |
| import java.util.regex.Matcher; | |
| import java.util.regex.Pattern; |
| import android.support.annotation.NonNull; | |
| import android.support.annotation.Nullable; | |
| import android.support.v4.util.ArrayMap; | |
| import java.io.IOException; | |
| import java.util.Collections; | |
| import java.util.Map; | |
| import java.util.regex.Matcher; | |
| import java.util.regex.Pattern; |
| import io.reactivex.Observable | |
| import io.reactivex.subjects.PublishSubject | |
| import java.util.* | |
| fun main(args: Array<String>) { | |
| val vm = VM(Repo()) | |
| vm.observableData.subscribe { | |
| println("from sub1 $it") | |
| } | |
| Thread.sleep(3333) |
| @RequiresApi(Build.VERSION_CODES.P) | |
| fun StrictMode.VmPolicy.Builder.detectAllExpect(ignoredViolationPackageName: String, justVerbose: Boolean = true): StrictMode.VmPolicy.Builder { | |
| return detectAll() | |
| .penaltyListener(Executors.newSingleThreadExecutor(), StrictMode.OnVmViolationListener | |
| { | |
| it.filter(ignoredViolationPackageName, justVerbose) | |
| }) | |
| } |