Skip to content

Instantly share code, notes, and snippets.

@jake-lewis
Created August 27, 2018 21:24
Show Gist options
  • Save jake-lewis/616ba34165e09f9d4a72305d61d7b5ee to your computer and use it in GitHub Desktop.
Save jake-lewis/616ba34165e09f9d4a72305d61d7b5ee to your computer and use it in GitHub Desktop.
import com.logdyn.controllers.RepositoryController;
import com.logdyn.model.Task;
import com.logdyn.model.Timer;
import com.logdyn.model.WorkLog;
import com.logdyn.model.auth.BasicAuthenticator;
import java.net.URL;
import java.util.Optional;
class Scratch {
public static void main(String[] args) {
try {
URL testUrl = new URL("http://192.168.0.240:8080/browse/KP-10");
RepositoryController.addRepository(testUrl,
new BasicAuthenticator("logdyn","YeovilApprentices2017"));
Optional<Task> task = RepositoryController.getTask(testUrl);
Optional<WorkLog> workLog = task.map(Task::getCurrentWorkLog);
Optional<Timer> timer = workLog.map(WorkLog::getTimer);
timer.ifPresent(Timer::start);
Thread.sleep(1_000);
timer.ifPresent(Timer::stop);
workLog.ifPresent(w -> w.commentProperty().set("Test3"));
RepositoryController.getRepository(testUrl).get().submitTask(task.get());
} catch (Exception e) {
e.printStackTrace();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment