Search in sources :

Example 1 with ServiceId

use of co.cask.cdap.proto.id.ServiceId in project cdap by caskdata.

the class ServiceClientTestRun method stopService.

/**
 * Stop the ArgService of the AppReturnsArgs app
 */
private void stopService(ApplicationId app) throws Exception {
    ServiceId service = app.service(AppReturnsArgs.SERVICE);
    programClient.stop(service);
    assertProgramStopped(programClient, service);
}
Also used : ServiceId(co.cask.cdap.proto.id.ServiceId)

Example 2 with ServiceId

use of co.cask.cdap.proto.id.ServiceId in project cdap by caskdata.

the class ServiceClientTestRun method startService.

/**
 * Start the ArgService of the AppReturnsArgs app
 */
private void startService(ApplicationId app, Map<String, String> propMap) throws Exception {
    ServiceId service = app.service(AppReturnsArgs.SERVICE);
    programClient.start(service, false, propMap);
    assertProgramRunning(programClient, service);
}
Also used : ServiceId(co.cask.cdap.proto.id.ServiceId)

Example 3 with ServiceId

use of co.cask.cdap.proto.id.ServiceId in project cdap by caskdata.

the class HttpEndpointPrefixCompleter method complete.

@Override
public int complete(String buffer, int cursor, List<CharSequence> candidates) {
    Map<String, String> arguments = ArgumentParser.getArguments(buffer, PATTERN);
    ProgramIdArgument programIdArgument = ArgumentParser.parseProgramId(arguments.get(SERVICE_ID));
    if (programIdArgument != null) {
        ServiceId service;
        if (arguments.get(APP_VERSION) == null) {
            service = cliConfig.getCurrentNamespace().app(programIdArgument.getAppId()).service(programIdArgument.getProgramId());
        } else {
            service = cliConfig.getCurrentNamespace().app(programIdArgument.getAppId(), arguments.get(APP_VERSION)).service(programIdArgument.getProgramId());
        }
        completer.setEndpoints(getEndpoints(service, arguments.get(METHOD)));
    } else {
        completer.setEndpoints(Collections.<String>emptyList());
    }
    return super.complete(buffer, cursor, candidates);
}
Also used : ProgramIdArgument(co.cask.cdap.cli.ProgramIdArgument) ServiceId(co.cask.cdap.proto.id.ServiceId)

Example 4 with ServiceId

use of co.cask.cdap.proto.id.ServiceId in project cdap by caskdata.

the class HttpMethodPrefixCompleter method complete.

@Override
public int complete(String buffer, int cursor, List<CharSequence> candidates) {
    Map<String, String> arguments = ArgumentParser.getArguments(buffer, PATTERN);
    ProgramIdArgument programIdArgument = ArgumentParser.parseProgramId(arguments.get(SERVICE_ID));
    if (programIdArgument != null) {
        ServiceId service;
        if (arguments.get(APP_VERSION) == null) {
            service = cliConfig.getCurrentNamespace().app(programIdArgument.getAppId()).service(programIdArgument.getProgramId());
        } else {
            service = cliConfig.getCurrentNamespace().app(programIdArgument.getAppId(), arguments.get(APP_VERSION)).service(programIdArgument.getProgramId());
        }
        completer.setEndpoints(getMethods(service));
    } else {
        completer.setEndpoints(Collections.<String>emptyList());
    }
    return super.complete(buffer, cursor, candidates);
}
Also used : ProgramIdArgument(co.cask.cdap.cli.ProgramIdArgument) ServiceId(co.cask.cdap.proto.id.ServiceId)

Example 5 with ServiceId

use of co.cask.cdap.proto.id.ServiceId in project cdap by caskdata.

the class CLIMainTest method testRuntimeArgs.

@Test
public void testRuntimeArgs() throws Exception {
    String qualifiedServiceId = String.format("%s.%s", FakeApp.NAME, PrefixedEchoHandler.NAME);
    ServiceId service = NamespaceId.DEFAULT.app(FakeApp.NAME).service(PrefixedEchoHandler.NAME);
    testServiceRuntimeArgs(qualifiedServiceId, service);
}
Also used : ServiceId(co.cask.cdap.proto.id.ServiceId) Test(org.junit.Test)

Aggregations

ServiceId (co.cask.cdap.proto.id.ServiceId)16 Test (org.junit.Test)5 ProgramIdArgument (co.cask.cdap.cli.ProgramIdArgument)2 CommandInputError (co.cask.cdap.cli.exception.CommandInputError)2 ApplicationId (co.cask.cdap.proto.id.ApplicationId)2 HttpResponse (co.cask.common.http.HttpResponse)2 URL (java.net.URL)2 ServiceHttpEndpoint (co.cask.cdap.api.service.http.ServiceHttpEndpoint)1 RowMaker (co.cask.cdap.cli.util.RowMaker)1 Table (co.cask.cdap.cli.util.table.Table)1 FlowletId (co.cask.cdap.proto.id.FlowletId)1 ProgramId (co.cask.cdap.proto.id.ProgramId)1 HttpMethod (co.cask.common.http.HttpMethod)1 HttpRequest (co.cask.common.http.HttpRequest)1 TypeToken (com.google.common.reflect.TypeToken)1 File (java.io.File)1 Map (java.util.Map)1