package com.ibm.streamsx.rest;

import java.io.IOException;
import java.math.BigInteger;

import com.ibm.streamsx.topology.internal.streams.InvokeCancel;

class StreamsConnectionImpl extends AbstractStreamsConnection {

    private final String userName;

    StreamsConnectionImpl(String userName, String authorization,
            String resourcesUrl, boolean allowInsecure) throws IOException {
        super(authorization, resourcesUrl, allowInsecure);
        this.userName = userName;
    }

    @Override
    String getAuthorization() {
        return authorization;
    }

    @Override
    boolean cancelJob(Instance instance, String jobId) throws IOException {

        // TODO - correct domain id
        InvokeCancel cancelJob = new InvokeCancel(null, instance.getId(), new BigInteger(jobId), userName);
        try {
            return cancelJob.invoke(false) == 0;
        } catch (Exception e) {
            throw new RESTException("Unable to cancel job " + jobId
                    + " in instance " + instance.getId(), e);
        }
    }
}

@@ -669,44 +669,8 @@
  %7B%0A%0A
-        // TODO - correct domain id%0A
     
@@ -719,12 +719,53 @@
 cel(
-null
+%0A                instance.getDomain().getId()
 , in
@@ -779,16 +779,32 @@
 getId(),
+%0A               
  new Big

Use the correct main for cancel job