1

I am new to the DataStage world and I am trying to start the process() method by myself.

"Why do you want to do that?"

Sadly, I have not the hands on DataStage directly, I am "just" the Java developer in charge of creating the Java classes that will be used by DataStage. My goal is to know what my classes do exactly without the DataStage treatment in the picture to be able to debug and explain the process.

"What have you tried?"

My approach so far was to "simulate" the Configuration interface in order to call the validateConfiguration() method to have the InputLink set up before calling the process() method. But I don't know how to "simulate" a Configuration object with my data.

I have considered use a mock of my Configuration or of my InputLink objects but I don't know how to do that either.

It's time to show you some code:

First, the class that extends com.ibm.is.cc.javastage.api.Processor class:

public class DownloadExportOutputDatastage extends Processor {
    @Override
    public boolean validateConfiguration(Configuration configuration, boolean b) throws Exception 
    {
        this.m_inputLink = configuration.getInputLink(0);
        this.m_outputLink = configuration.getOutputLink(0);

        return true;
    }

    @Override
    public Capabilities getCapabilities() {
        Capabilities capabilities = new Capabilities();
        // ...
        return capabilities;
    }

    @Override
    public void process() throws Exception {
        InputRecord inputRecord;
        while ((inputRecord = this.m_inputLink.readRecord()) != null) { // How to use a custom inputLink with my data in it
            DownloadExportOutput objDownloadExportOutput = new DownloadExportOutput();
            objDownloadExportOutput.setRequestId((String) inputRecord.getValue("idrequest")); // The only value that I need in my Record

            // My custom process here

            OutputRecord outputRecord = this.m_outputLink.getOutputRecord();
            outputRecord.setValue("body", soapContent);
            this.m_outputLink.writeRecord(outputRecord);
        }
    }
}

Finally, what I have tried:

public class main {

    public static void main(String[] args) throws Exception {
        StandaloneConfiguration standaloneConfiguration = new StandaloneConfiguration(); // A custom implementation of the DataStage Configuration interface
        DownloadExportOutputDatastage sample = new DownloadExportOutputDatastage(); // The class that you can see above
        sample.validateConfiguration(standaloneConfiguration, true); // I try to load an InputLink but don't know what to put in it
        sample.getCapabilities();
        sample.process(); // Get a NPE because of my empty InputLink
    }
}

0 Answers0