Codota Logo
JobInfo.newJobInfo
Code IndexAdd Codota to your IDE (free)

How to use
newJobInfo
method
in
de.otto.edison.jobs.domain.JobInfo

Best Java code snippets using de.otto.edison.jobs.domain.JobInfo.newJobInfo (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
StringBuilder s =
  • Codota Iconnew StringBuilder()
  • Codota Iconnew StringBuilder(32)
  • Codota IconString str;new StringBuilder(str)
  • Smart code suggestions by Codota
}
origin: otto-de/edison-microservice

private JobInfo createJobInfo(final String jobType) {
  return newJobInfo(uuidProvider.getUuid(), jobType, clock,
      systemInfo.getHostname());
}
origin: otto-de/edison-microservice

private JobInfo.Builder defaultJobInfo() {
  return newJobInfo(JOB_ID, JOB_TYPE, clock, HOSTNAME).copy();
}
origin: otto-de/edison-microservice

  private JobInfo defaultJobInfo(String jobId, int secondsAgo) {
    OffsetDateTime lastUpdated = OffsetDateTime.ofInstant(now(clock).minus(secondsAgo, SECONDS), systemDefault());
    return newJobInfo(jobId, "someJobType", OffsetDateTime.MIN, lastUpdated, Optional.empty(), OK, emptyList(), clock, "someHostname");
  }
}
origin: otto-de/edison-microservice

  private JobInfo someRunningJobInfo(final String jobId, final String type, final OffsetDateTime started) {
    return JobInfo.newJobInfo(
        jobId,
        type,
        started, started.plus(1, SECONDS), Optional.empty(), OK,
        Collections.emptyList(),
        systemDefaultZone(),
        "localhost"
    );
  }
}
origin: otto-de/edison-microservice

@Test
public void shouldReturnAllJobs() throws IOException {
  // given
  JobInfo firstJob = newJobInfo("42", "TEST", fixed(ofEpochMilli(0), systemDefault()), "localhost");
  JobInfo secondJob = newJobInfo("42", "TEST", fixed(ofEpochMilli(1), systemDefault()), "localhost");
  when(jobService.findJobs(Optional.<String>empty(), 100)).thenReturn(asList(firstJob, secondJob));
  // when
  Object job = jobsController.getJobsAsJson(null, 100, false, false, mock(HttpServletRequest.class));
  // then
  assertThat(job, is(asList(representationOf(firstJob, null, false, "", ""), representationOf(secondJob, null, false, "", ""))));
}
origin: otto-de/edison-microservice

  private JobInfo jobInfoWithRuntime(int finishAmount, ChronoUnit unit) {
    final Clock clock = fixed(Instant.now(), systemDefault());
    final OffsetDateTime startTime = now(clock);
    final OffsetDateTime finishedTime = startTime.plus(finishAmount, unit);
    return newJobInfo("foo", "TEST", startTime, finishedTime, of(finishedTime), OK, emptyList(), clock, "localhost");
  }
}
origin: otto-de/edison-microservice

@Test
@SuppressWarnings("unchecked")
public void shouldReturnAllJobsOfTypeAsHtml() {
  JobInfo firstJob = newJobInfo("42", "SOME_TYPE", systemDefaultZone(), "localhost");
  when(jobService.findJobs(Optional.of("SOME_TYPE"), 100)).thenReturn(asList(firstJob));
  ModelAndView modelAndView = jobsController.getJobsAsHtml("SOME_TYPE", 100, false, mock(HttpServletRequest.class));
  List<JobRepresentation> jobs = (List<JobRepresentation>) modelAndView.getModel().get("jobs");
  assertThat(jobs, is(asList(representationOf(firstJob, null, false, "", ""))));
}
origin: otto-de/edison-microservice

@Test
public void shouldFindAll() {
  // given
  repository.createOrUpdate(newJobInfo("oldest", "FOO", fixed(Instant.now().minusSeconds(1), systemDefault()), "localhost"));
  repository.createOrUpdate(newJobInfo("youngest", "FOO", fixed(Instant.now(), systemDefault()), "localhost"));
  // when
  final List<JobInfo> jobInfos = repository.findAll();
  // then
  assertThat(jobInfos.size(), is(2));
  assertThat(jobInfos.get(0).getJobId(), is("youngest"));
  assertThat(jobInfos.get(1).getJobId(), is("oldest"));
}
origin: otto-de/edison-microservice

@Test
public void shouldFindStatusOfJob() throws Exception {
  //Given
  final String type = "TEST";
  JobInfo jobInfo = newJobInfo("1", type, systemDefaultZone(), "localhost");
  repository.createOrUpdate(jobInfo);
  //When
  JobStatus status = repository.findStatus("1");
  //Then
  assertThat(status, is(JobStatus.OK));
}
origin: otto-de/edison-microservice

@Test
public void shouldFindRunningJobsWithoutUpdatedSinceSpecificDate() throws Exception {
  // given
  repository.createOrUpdate(newJobInfo("deadJob", "FOO", fixed(Instant.now().minusSeconds(10), systemDefault()), "localhost"));
  repository.createOrUpdate(newJobInfo("running", "FOO", fixed(Instant.now(), systemDefault()), "localhost"));
  // when
  final List<JobInfo> jobInfos = repository.findRunningWithoutUpdateSince(now().minus(5, ChronoUnit.SECONDS));
  // then
  assertThat(jobInfos, IsCollectionWithSize.hasSize(1));
  assertThat(jobInfos.get(0).getJobId(), is("deadJob"));
}
origin: otto-de/edison-microservice

@Test
public void shouldRunJob() {
  // given:
  String jobType = "bar";
  when(jobRunnable.getJobDefinition()).thenReturn(someJobDefinition(jobType));
  // when:
  Optional<String> optionalJobId = jobService.startAsyncJob(jobType);
  // then:
  final JobInfo expectedJobInfo = JobInfo.newJobInfo(optionalJobId.get(), jobType, clock, systemInfo.hostname);
  verify(executorService).execute(any(Runnable.class));
  verify(jobRepository).createOrUpdate(expectedJobInfo);
  verify(jobRunnable).execute();
  verify(jobMetaService).aquireRunLock(expectedJobInfo.getJobId(), expectedJobInfo.getJobType());
}
origin: otto-de/edison-microservice

@Test
public void shouldFindJobInfoByUri() {
  // given
  InMemJobRepository repository = new InMemJobRepository();
  // when
  JobInfo job = newJobInfo(randomUUID().toString(), "MYJOB", clock, "localhost");
  repository.createOrUpdate(job);
  // then
  assertThat(repository.findOne(job.getJobId()), isPresent());
}
origin: otto-de/edison-microservice

@Test
public void shouldNotRemoveRunningJobs() {
  // given
  final String testUri = "test";
  repository.createOrUpdate(newJobInfo(testUri, "FOO", systemDefaultZone(), "localhost"));
  // when
  repository.removeIfStopped(testUri);
  // then
  assertThat(repository.size(), is(1L));
}
origin: otto-de/edison-microservice

@Test
public void shouldKillJob() {
  OffsetDateTime now = OffsetDateTime.now(clock);
  JobInfo jobInfo = JobInfo.newJobInfo("superId", "superType", clock, HOSTNAME);
  when(jobRepository.findOne("superId")).thenReturn(Optional.of(jobInfo));
  jobService.killJob("superId");
  JobInfo expected = jobInfo.copy().setStatus(JobInfo.JobStatus.DEAD).setStopped(now).setLastUpdated(now).build();
  verify(jobMetaService).releaseRunLock("superType");
  verify(jobRepository).createOrUpdate(expected);
}
origin: otto-de/edison-microservice

@Test
public void shouldStopJob() {
  OffsetDateTime now = OffsetDateTime.now(clock);
  Clock earlierClock = offset(clock, Duration.of(-1, MINUTES));
  JobInfo jobInfo = JobInfo.newJobInfo("superId", "superType", earlierClock, HOSTNAME);
  when(jobRepository.findOne("superId")).thenReturn(Optional.of(jobInfo));
  jobService.stopJob("superId");
  JobInfo expected = jobInfo.copy().setStatus(JobInfo.JobStatus.OK).setStopped(now).setLastUpdated(now).build();
  verify(jobMetaService).releaseRunLock("superType");
  verify(jobRepository).createOrUpdate(expected);
}
origin: otto-de/edison-microservice

private JobInfo someJobInfo(final String jobId) {
  return JobInfo.newJobInfo(
      jobId,
      "SOME_JOB",
      now(), now(), Optional.of(now()), OK,
      asList(
          jobMessage(Level.INFO, "foo", now()),
          jobMessage(Level.WARNING, "bar", now())),
      systemDefaultZone(),
      "localhost"
  );
}
origin: otto-de/edison-microservice

private JobInfo jobInfo(final String jobId, final String type) {
  return JobInfo.newJobInfo(
      jobId,
      type,
      now(), now(), Optional.of(now()), OK,
      asList(
          jobMessage(Level.INFO, "foo", now()),
          jobMessage(Level.WARNING, "bar", now())),
      systemDefaultZone(),
      "localhost"
  );
}
origin: otto-de/edison-microservice

  private JobInfo jobInfo(final String jobId, final String type) {
    return JobInfo.newJobInfo(
        jobId,
        type,
        now(), now(), Optional.of(now()), OK,
        asList(
            jobMessage(Level.INFO, "foo", now()),
            jobMessage(Level.WARNING, "bar", now())),
        systemDefaultZone(),
        "localhost"
    );
  }
}
origin: de.otto.edison/edison-mongo

@Override
protected final JobInfo decode(final Document document) {
  return newJobInfo(
      document.getString(JobStructure.ID.key()),
      document.getString(JobStructure.JOB_TYPE.key()),
      DateTimeConverters.toOffsetDateTime(document.getDate(JobStructure.STARTED.key())),
      DateTimeConverters.toOffsetDateTime(document.getDate(JobStructure.LAST_UPDATED.key())),
      ofNullable(DateTimeConverters.toOffsetDateTime(document.getDate(JobStructure.STOPPED.key()))),
      JobStatus.valueOf(document.getString(JobStructure.STATUS.key())),
      getMessagesFrom(document),
      clock,
      document.getString(JobStructure.HOSTNAME.key()));
}
origin: otto-de/edison-microservice

@Override
protected final JobInfo decode(final Document document) {
  return newJobInfo(
      document.getString(JobStructure.ID.key()),
      document.getString(JobStructure.JOB_TYPE.key()),
      toOffsetDateTime(document.getDate(JobStructure.STARTED.key())),
      toOffsetDateTime(document.getDate(JobStructure.LAST_UPDATED.key())),
      ofNullable(toOffsetDateTime(document.getDate(JobStructure.STOPPED.key()))),
      JobStatus.valueOf(document.getString(JobStructure.STATUS.key())),
      getMessagesFrom(document),
      clock,
      document.getString(JobStructure.HOSTNAME.key()));
}
de.otto.edison.jobs.domainJobInfonewJobInfo

Popular methods of JobInfo

  • getJobId
  • getJobType
  • getLastUpdated
  • getMessages
  • getStarted
  • getStatus
  • getStopped
  • isStopped
  • copy
  • getHostname
  • <init>
  • builder
  • <init>,
  • builder,
  • equals,
  • getClock,
  • hashCode

Popular in Java

  • Making http post requests using okhttp
  • notifyDataSetChanged (ArrayAdapter)
  • getResourceAsStream (ClassLoader)
    Returns a stream for the resource with the specified name. See #getResource(String) for a descriptio
  • requestLocationUpdates (LocationManager)
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • KeyStore (java.security)
    This class represents an in-memory collection of keys and certificates. It manages two types of entr
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • LinkedHashMap (java.util)
    Hash table and linked list implementation of the Map interface, with predictable iteration order. Th
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now