Tabnine Logo
JobControl.getStatus
Code IndexAdd Tabnine to your IDE (free)

How to use
getStatus
method
in
com.emc.ecs.sync.rest.JobControl

Best Java code snippets using com.emc.ecs.sync.rest.JobControl.getStatus (Showing top 11 results out of 315)

origin: EMCECS/ecs-sync

public void setJobControl(int jobId, JobControl jobControl) {
  EcsSync sync = syncCache.get(jobId);
  if (sync == null) throw new JobNotFoundException("the specified job ID does not exist");
  if (jobControl.getThreadCount() > 0) {
    sync.setThreadCount(jobControl.getThreadCount());
  }
  if (jobControl.getStatus() != null) {
    switch (jobControl.getStatus()) {
      case Stopped:
        sync.terminate();
        break;
      case Paused:
        sync.pause();
        break;
      case Running:
        sync.resume();
        break;
    }
  }
}
origin: EMCECS/ecs-sync

@After
public void stopRestServer() throws InterruptedException {
  if (restServer != null) restServer.stop(0);
  restServer = null;
  // wait for all jobs to stop to prevent leakage into other tests
  for (JobInfo jobInfo : SyncJobService.getInstance().getAllJobs().getJobs()) {
    while (!SyncJobService.getInstance().getJobControl(jobInfo.getJobId()).getStatus().isFinalState())
      Thread.sleep(500);
    SyncJobService.getInstance().deleteJob(jobInfo.getJobId(), false);
  }
}
origin: EMCECS/ecs-sync

@Test
public void testCreateDelete() throws Exception {
  SyncConfig syncConfig = new SyncConfig();
  syncConfig.setSource(new TestConfig().withObjectCount(10).withMaxSize(10240).withDiscardData(false));
  syncConfig.setTarget(new TestConfig().withReadData(true).withDiscardData(false));
  // create sync job
  ClientResponse response = client.resource(endpoint).path("/job").put(ClientResponse.class, syncConfig);
  String jobIdStr = response.getHeaders().getFirst("x-emc-job-id");
  try {
    Assert.assertEquals(response.getEntity(String.class), 201, response.getStatus());
    response.close(); // must close all responses
    Assert.assertNotNull(jobIdStr);
    int jobId = Integer.parseInt(jobIdStr);
    // wait for job to complete
    while (!client.resource(endpoint).path("/job/" + jobId + "/control").get(JobControl.class).getStatus().isFinalState()) {
      Thread.sleep(1000);
    }
    // get status (should be complete)
    JobControl jobControl = client.resource(endpoint).path("/job/" + jobId + "/control").get(JobControl.class);
    Assert.assertNotNull(jobControl);
    Assert.assertEquals(JobControlStatus.Complete, jobControl.getStatus());
  } finally {
    // delete job
    response = client.resource(endpoint).path("/job/" + jobIdStr).delete(ClientResponse.class);
    if (response.getStatus() != 200)
      log.warn("could not delete job: {}", response.getEntity(String.class));
    response.close(); // must close all responses
  }
}
origin: EMCECS/ecs-sync

  while (client.resource(endpoint).path("/job/" + jobId + "/control").get(JobControl.class).getStatus() == JobControlStatus.Initializing) {
    Thread.sleep(500);
  Assert.assertEquals(JobControlStatus.Stopped, jobControl.getStatus());
} finally {
origin: EMCECS/ecs-sync

while (!client.resource(endpoint).path("/job/" + jobId1 + "/control").get(JobControl.class).getStatus().isFinalState()
    && !client.resource(endpoint).path("/job/" + jobId2 + "/control").get(JobControl.class).getStatus().isFinalState()
    && !client.resource(endpoint).path("/job/" + jobId3 + "/control").get(JobControl.class).getStatus().isFinalState()) {
  Thread.sleep(1000);
origin: EMCECS/ecs-sync

while (client.resource(endpoint).path("/job/" + jobId + "/control").get(JobControl.class).getStatus() == JobControlStatus.Initializing) {
  Thread.sleep(500);
origin: EMCECS/ecs-sync

while (client.resource(endpoint).path("/job/" + jobId + "/control").get(JobControl.class).getStatus() == JobControlStatus.Initializing) {
  Thread.sleep(500);
Assert.assertEquals(JobControlStatus.Stopped, jobControl.getStatus());
origin: EMCECS/ecs-sync

@Test
public void testGetJob() throws Exception {
  SyncConfig syncConfig = new SyncConfig();
  syncConfig.setSource(new TestConfig().withObjectCount(10).withMaxSize(10240).withDiscardData(false));
  syncConfig.setTarget(new TestConfig().withReadData(true).withDiscardData(false));
  // create sync job
  ClientResponse response = client.resource(endpoint).path("/job").put(ClientResponse.class, syncConfig);
  String jobId = response.getHeaders().getFirst("x-emc-job-id");
  try {
    Assert.assertEquals(response.getEntity(String.class), 201, response.getStatus());
    response.close(); // must close all responses
    // get job
    SyncConfig syncConfig2 = client.resource(endpoint).path("/job/" + jobId).get(SyncConfig.class);
    Assert.assertNotNull(syncConfig2);
    Assert.assertEquals(syncConfig, syncConfig2);
    // wait for job to complete
    while (!client.resource(endpoint).path("/job/" + jobId + "/control").get(JobControl.class).getStatus().isFinalState()) {
      Thread.sleep(1000);
    }
  } finally {
    // delete job
    response = client.resource(endpoint).path("/job/" + jobId).delete(ClientResponse.class);
    if (response.getStatus() != 200)
      log.warn("could not delete job: {}", response.getEntity(String.class));
    response.close(); // must close all responses
  }
}
origin: EMCECS/ecs-sync

while (client.resource(endpoint).path("/job/" + jobId + "/control").get(JobControl.class).getStatus() == JobControlStatus.Initializing) {
  Thread.sleep(200);
Assert.assertEquals(JobControlStatus.Paused, jobControl.getStatus());
Assert.assertEquals(2, jobControl.getThreadCount());
Assert.assertEquals(JobControlStatus.Running, jobControl.getStatus());
Assert.assertEquals(2, jobControl.getThreadCount());
while (!client.resource(endpoint).path("/job/" + jobId + "/control").get(JobControl.class).getStatus().isFinalState()) {
  Thread.sleep(1000);
Assert.assertEquals(JobControlStatus.Complete, jobControl.getStatus());
origin: EMCECS/ecs-sync

  while (!client.resource(endpoint).path("/job/" + jobId + "/control").get(JobControl.class).getStatus().isFinalState()) {
    Thread.sleep(1000);
  Assert.assertEquals(JobControlStatus.Complete, jobControl.getStatus());
} finally {
origin: EMCECS/ecs-sync

while (client.resource(endpoint).path("/job/" + jobId + "/control").get(JobControl.class).getStatus() == JobControlStatus.Initializing) {
  Thread.sleep(500);
while (!client.resource(endpoint).path("/job/" + jobId + "/control").get(JobControl.class).getStatus().isFinalState()) {
  Thread.sleep(1000);
Assert.assertEquals(JobControlStatus.Complete, jobControl.getStatus());
com.emc.ecs.sync.restJobControlgetStatus

Popular methods of JobControl

  • <init>
  • getThreadCount
  • setStatus
  • setThreadCount

Popular in Java

  • Updating database using SQL prepared statement
  • compareTo (BigDecimal)
  • addToBackStack (FragmentTransaction)
  • runOnUiThread (Activity)
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now