Tabnine Logo
RestartServiceInstancesStatus
Code IndexAdd Tabnine to your IDE (free)

How to use
RestartServiceInstancesStatus
in
co.cask.cdap.proto

Best Java code snippets using co.cask.cdap.proto.RestartServiceInstancesStatus (Showing top 7 results out of 315)

origin: co.cask.cdap/cdap-app-fabric

@Override
public synchronized void setRestartInstanceRequest(String serviceName, long startTimeMs, long endTimeMs,
                          boolean isSuccess, int instanceId) {
 Preconditions.checkNotNull(serviceName, "Service name should not be null.");
 Preconditions.checkArgument(instanceId >= 0, "Instance id has to be greater than or equal to zero.");
 RestartStatus status = isSuccess ? RestartStatus.SUCCESS : RestartStatus.FAILURE;
 RestartServiceInstancesStatus restartStatus =
  new RestartServiceInstancesStatus(serviceName, startTimeMs, endTimeMs, status, ImmutableSet.of(instanceId));
 String toJson = GSON.toJson(restartStatus, RestartServiceInstancesStatus.class);
 table.put(Bytes.toBytes(serviceName + "-restart"), Bytes.toBytes(toJson));
}
origin: cdapio/cdap

@Test
public void testRestartInstances() throws Exception {
 String path = String.format("%s/system/services/%s/restart", Constants.Gateway.API_VERSION_3,
               Constants.Service.APP_FABRIC_HTTP);
 HttpResponse response = doPost(path);
 Assert.assertEquals(HttpResponseStatus.OK.code(), response.getResponseCode());
 path = String.format("%s/system/services/%s/latest-restart", Constants.Gateway.API_VERSION_3,
            Constants.Service.APP_FABRIC_HTTP);
 response = doGet(path);
 Assert.assertEquals(HttpResponseStatus.OK.code(), response.getResponseCode());
 RestartServiceInstancesStatus result = GSON.fromJson(response.getResponseBodyAsString(),
                            RestartServiceInstancesStatus.class);
 Assert.assertNotNull(result);
 Assert.assertEquals(Constants.Service.APP_FABRIC_HTTP, result.getServiceName());
 Assert.assertEquals(RestartServiceInstancesStatus.RestartStatus.SUCCESS, result.getStatus());
}
origin: cdapio/cdap

 @Test
 public void testInvalidIdRestartInstances() throws Exception {
  String path = String.format("%s/system/services/%s/instances/1000/restart", Constants.Gateway.API_VERSION_3,
                Constants.Service.APP_FABRIC_HTTP);
  HttpResponse response = doPost(path);

  Assert.assertEquals(HttpResponseStatus.BAD_REQUEST.code(), response.getResponseCode());

  path = String.format("%s/system/services/%s/latest-restart", Constants.Gateway.API_VERSION_3,
             Constants.Service.APP_FABRIC_HTTP);
  response = doGet(path);

  Assert.assertEquals(HttpResponseStatus.OK.code(), response.getResponseCode());

  RestartServiceInstancesStatus result = GSON.fromJson(response.getResponseBodyAsString(),
                             RestartServiceInstancesStatus.class);

  Assert.assertNotNull(result);
  Assert.assertEquals(Constants.Service.APP_FABRIC_HTTP, result.getServiceName());
  Assert.assertEquals(RestartServiceInstancesStatus.RestartStatus.FAILURE, result.getStatus());
 }
}
origin: cdapio/cdap

@Test
public void testSingleIdRestartInstances() throws Exception {
 String path = String.format("%s/system/services/%s/instances/0/restart", Constants.Gateway.API_VERSION_3,
               Constants.Service.APP_FABRIC_HTTP);
 HttpResponse response = doPost(path);
 Assert.assertEquals(HttpResponseStatus.OK.code(), response.getResponseCode());
 path = String.format("%s/system/services/%s/latest-restart", Constants.Gateway.API_VERSION_3,
            Constants.Service.APP_FABRIC_HTTP);
 response = doGet(path);
 Assert.assertEquals(HttpResponseStatus.OK.code(), response.getResponseCode());
 RestartServiceInstancesStatus result = GSON.fromJson(response.getResponseBodyAsString(),
                            RestartServiceInstancesStatus.class);
 Assert.assertNotNull(result);
 Assert.assertEquals(Constants.Service.APP_FABRIC_HTTP, result.getServiceName());
 Assert.assertEquals(RestartServiceInstancesStatus.RestartStatus.SUCCESS, result.getStatus());
}
origin: cdapio/cdap

@Override
public synchronized void setRestartInstanceRequest(String serviceName, long startTimeMs, long endTimeMs,
                          boolean isSuccess, int instanceId) {
 Preconditions.checkNotNull(serviceName, "Service name should not be null.");
 Preconditions.checkArgument(instanceId >= 0, "Instance id has to be greater than or equal to zero.");
 RestartStatus status = isSuccess ? RestartStatus.SUCCESS : RestartStatus.FAILURE;
 RestartServiceInstancesStatus restartStatus =
  new RestartServiceInstancesStatus(serviceName, startTimeMs, endTimeMs, status, ImmutableSet.of(instanceId));
 String toJson = GSON.toJson(restartStatus, RestartServiceInstancesStatus.class);
 table.put(Bytes.toBytes(serviceName + "-restart"), Bytes.toBytes(toJson));
}
origin: cdapio/cdap

@Override
public synchronized void setRestartAllInstancesRequest(String serviceName, long startTimeMs, long endTimeMs,
                            boolean isSuccess) {
 Preconditions.checkNotNull(serviceName, "Service name should not be null.");
 RestartStatus status = isSuccess ? RestartStatus.SUCCESS : RestartStatus.FAILURE;
 Integer serviceInstance = getServiceInstance(serviceName);
 int instanceCount = (serviceInstance == null) ? 0 : serviceInstance;
 Set<Integer> instancesToRestart = Ranges.closedOpen(0, instanceCount).asSet(DiscreteDomains.integers());
 RestartServiceInstancesStatus restartStatus =
  new RestartServiceInstancesStatus(serviceName, startTimeMs, endTimeMs, status, instancesToRestart);
 String toJson = GSON.toJson(restartStatus, RestartServiceInstancesStatus.class);
 table.put(Bytes.toBytes(serviceName + "-restart"), Bytes.toBytes(toJson));
}
origin: co.cask.cdap/cdap-app-fabric

@Override
public synchronized void setRestartAllInstancesRequest(String serviceName, long startTimeMs, long endTimeMs,
                            boolean isSuccess) {
 Preconditions.checkNotNull(serviceName, "Service name should not be null.");
 RestartStatus status = isSuccess ? RestartStatus.SUCCESS : RestartStatus.FAILURE;
 Integer serviceInstance = getServiceInstance(serviceName);
 int instanceCount = (serviceInstance == null) ? 0 : serviceInstance;
 Set<Integer> instancesToRestart = Ranges.closedOpen(0, instanceCount).asSet(DiscreteDomains.integers());
 RestartServiceInstancesStatus restartStatus =
  new RestartServiceInstancesStatus(serviceName, startTimeMs, endTimeMs, status, instancesToRestart);
 String toJson = GSON.toJson(restartStatus, RestartServiceInstancesStatus.class);
 table.put(Bytes.toBytes(serviceName + "-restart"), Bytes.toBytes(toJson));
}
co.cask.cdap.protoRestartServiceInstancesStatus

Javadoc

Class to describe status of restart instances of service request.

Most used methods

  • <init>
  • getServiceName
  • getStatus

Popular in Java

  • Finding current android device location
  • getContentResolver (Context)
  • addToBackStack (FragmentTransaction)
  • getApplicationContext (Context)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • Collectors (java.util.stream)
  • Logger (org.slf4j)
    The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that loggin
  • Top Vim 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