Example usage for javax.xml.ws Holder Holder

List of usage examples for javax.xml.ws Holder Holder

Introduction

In this page you can find the example usage for javax.xml.ws Holder Holder.

Prototype

public Holder() 

Source Link

Document

Creates a new holder with a null value.

Usage

From source file:net.cloudkit.enterprises.ws.SuperPassQueryTest.java

public static void main(String[] args) throws Exception {

    List<String> params = new ArrayList<>();
    // System.out.println(SuperPassQueryTest.class.getResource("/list.dat").toURI());
    Path path = Paths.get(SuperPassQueryTest.class.getResource("/list.dat").toURI());
    try (BufferedReader reader = Files.newBufferedReader(path, Charset.forName("UTF-8"))) {
        // System.out.println(reader.readLine().length());
        String line;/*  w  w w .ja  v  a  2s  .c o  m*/
        while ((line = reader.readLine()) != null) {
            // System.out.println("TEXT LINE:" + line);
            params.add(line);
        }
    }

    Path succeededFile = Paths.get(SuperPassQueryTest.class.getResource("/succeeded.dat").toURI());
    BufferedWriter succeededWriter = Files.newBufferedWriter(succeededFile, StandardCharsets.UTF_8,
            StandardOpenOption.APPEND);
    Path failedFile = Paths.get(SuperPassQueryTest.class.getResource("/failed.dat").toURI());
    BufferedWriter failedWriter = Files.newBufferedWriter(failedFile, StandardCharsets.UTF_8,
            StandardOpenOption.APPEND);

    for (String param : params) {
        try {
            /*
            StringTokenizer stringTokenizer = new StringTokenizer(param, ",");
            while(stringTokenizer.hasMoreTokens()){
            System.out.println("COUNT:" + stringTokenizer.countTokens());
            System.out.println("VALUE:" + stringTokenizer.nextToken());
            System.out.println("COUNT:" + stringTokenizer.countTokens());
            }
            */

            System.out.println("QUERY PARAMS:" + param);
            String[] paramArray = param.split(",");
            // System.out.println("VALUE:" + paramArray[0]);
            // System.out.println("VALUE:" + paramArray[1]);
            // System.out.println("VALUE:" + paramArray[2]);

            String value_1 = paramArray[0];
            String value_2 = paramArray[1];
            String value_3 = paramArray[2];

            String serviceName = "eport.superpass.spdec.DecQueryListService";
            byte[] requestContext = ("<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>\n"
                    + "<RequestContext>\n" + "    <Group name=\"SystemInfo\">\n"
                    + "        <Key name=\"NAME_FULL\">???</Key>\n"
                    + "        <Key name=\"ClientId\">5300001976914</Key>\n"
                    + "        <Key name=\"CertNo\">df630b</Key>\n"
                    + "        <Key name=\"SaicSysNo\">766350979</Key>\n"
                    + "        <Key name=\"DEP_IN_CODE\">5300</Key>\n"
                    + "        <Key name=\"REG_CO_CGAC\">4403180237</Key>\n"
                    + "        <Key name=\"ENT_SEQ_NO\">000000000000315537</Key>\n"
                    + "        <Key name=\"ENT_TYPE\">3</Key>\n"
                    + "        <Key name=\"IcCode\">8930000011040</Key>\n"
                    + "        <Key name=\"OperatorName\">?</Key>\n"
                    + "        <Key name=\"DEP_CODE_CHG\">5305</Key>\n"
                    + "        <Key name=\"SessionId\">AE2533938D521A9972186B07BBBEB244</Key>\n"
                    + "    </Group>\n" + "    <Group name=\"DataPresentation\">\n"
                    + "        <Key name=\"SignatureAlgorithm\"/>\n"
                    + "        <Key name=\"EncryptAlgorithm\"/>\n"
                    + "        <Key name=\"CompressAlgorithm\"/>\n" + "    </Group>\n"
                    + "    <Group name=\"Default\">\n"
                    + "        <Key name=\"clientSystemId\">0400620001</Key>\n"
                    + "        <Key name=\"needWebInvoke\">True</Key>\n" + "    </Group>\n"
                    + "</RequestContext>").getBytes();

            byte[] requestData = ("<?xml version=\"1.0\"?>\n"
                    + "<DecQueryListRequest xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\n"
                    + "  <OperType>0</OperType>\n" + "  <DecType>\n" + "    <TrnType>0</TrnType>\n"
                    + "    <IEFlag>" + value_3 + "</IEFlag>\n" + "    <DecSubType />\n" + "  </DecType>\n"
                    + "  <CopeCode>766350979</CopeCode>\n" + "  <AgentCode>4403180237</AgentCode>\n"
                    + "  <SeqNo>" + value_1 + "</SeqNo>\n" + "  <UserType>0</UserType>\n"
                    + "</DecQueryListRequest>").getBytes();

            Holder<byte[]> responseData = new Holder<>();

            // <?xml version="1.0" encoding="UTF-8" standalone="no"?><ResponseContext><ResponseCode>0</ResponseCode><ResponseMessage>success</ResponseMessage><ServiceResponseCode>0</ServiceResponseCode><ServiceResponseMessage>?</ServiceResponseMessage><ExceptionDetail/><Group name="DataPresentation"><Key name="CompressAlgorithm"/><Key name="SignatureAlgorithm"/><Key name="EncryptAlgorithm"/></Group></ResponseContext>
            // <?xml version="1.0" encoding="UTF-8" standalone="yes"?><DecQueryListResponse><QueryResponseData><EntryId>531820161181010544</EntryId><SeqNo>000000001139524197</SeqNo><BillNo>2016051920160523</BillNo><IEDate>20160621</IEDate><TradeMode>0615</TradeMode><ItemsNum>19</ItemsNum><TrafName></TrafName><Status>O</Status><AgentName>???</AgentName><IEFlag>I</IEFlag><CustomsCode>5318</CustomsCode><DeclTrnRel>0</DeclTrnRel><RetExplain>;?</RetExplain><NoticeDate>2016-06-29</NoticeDate><TradeName>()??</TradeName><ExtendField><DecDeclareSysType>2</DecDeclareSysType><TrnSysType>1</TrnSysType><AssureExamRet>0</AssureExamRet><RelatedDocumentType>  </RelatedDocumentType><DeclareSeqNo>                  </DeclareSeqNo><ExtendField53>P</ExtendField53><ExtendField>21                                                   P</ExtendField></ExtendField><EntryType>M</EntryType></QueryResponseData></DecQueryListResponse>
            // String responseContext = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?><ResponseContext><ResponseCode>0</ResponseCode><ResponseMessage>success</ResponseMessage><ServiceResponseCode>0</ServiceResponseCode><ServiceResponseMessage>?</ServiceResponseMessage><ExceptionDetail/><Group name=\"DataPresentation\"><Key name=\"CompressAlgorithm\"/><Key name=\"SignatureAlgorithm\"/><Key name=\"EncryptAlgorithm\"/></Group></ResponseContext>";
            // String queryListResponse = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><DecQueryListResponse><QueryResponseData><EntryId>531820161181010544</EntryId><SeqNo>000000001139524197</SeqNo><BillNo>2016051920160523</BillNo><IEDate>20160621</IEDate><TradeMode>0615</TradeMode><ItemsNum>19</ItemsNum><TrafName></TrafName><Status>O</Status><AgentName>???</AgentName><IEFlag>I</IEFlag><CustomsCode>5318</CustomsCode><DeclTrnRel>0</DeclTrnRel><RetExplain>;?</RetExplain><NoticeDate>2016-06-29</NoticeDate><TradeName>()??</TradeName><ExtendField><DecDeclareSysType>2</DecDeclareSysType><TrnSysType>1</TrnSysType><AssureExamRet>0</AssureExamRet><RelatedDocumentType>  </RelatedDocumentType><DeclareSeqNo>                  </DeclareSeqNo><ExtendField53>P</ExtendField53><ExtendField>21                                                   P</ExtendField></ExtendField><EntryType>M</EntryType></QueryResponseData></DecQueryListResponse>";

            String responseContext = new String(
                    superPass.service(serviceName, requestContext, requestData, responseData));
            String queryListResponse = new String(responseData.value);
            System.out.println("RESPONSE_CONTEXT:" + responseContext);
            System.out.println("QUERY_LIST_RESPONSE:" + queryListResponse);

            String serviceResponseCode = parsingReceiptStatus(responseContext);
            System.out.println("SERVICE_RESPONSE_CODE:" + serviceResponseCode);
            if (serviceResponseCode.equals("0")) {
                String data = parsingReceiptData(queryListResponse);
                System.out.println("DATA:" + data);
                succeededWriter.write(data);
                succeededWriter.flush();
            } else {
                failedWriter.write(param + "\n");
                failedWriter.flush();
            }
            Thread.sleep(6 * 1000);
        } catch (Exception e) {
            failedWriter.write(param + "\n");
            failedWriter.flush();
        }
    }
    succeededWriter.close();
    failedWriter.close();
}

From source file:net.cloudkit.enterprises.ws.SuperPassParaProxyTest.java

public static void main(String[] args) throws Exception {

    // CodeLists_Const???XML?
    // MFT2008? RMFT8ChangeReasonCode (AlphaNumber)
    // 001   ?//  w  w  w .  j ava2s . c  o  m
    // 002   
    // 003   ?
    // 004   ????
    // 005   ????
    // 006   ??????
    // 007   ????
    // 008   ????
    // 009   ??????
    // 010   ????
    // 011   ???
    // 012   ?
    // 013   ?
    // 014   ?
    // 015   ??
    // 999   
    //
    // MFT2008 RMFT8DeclareTypeCode (AlphaNumber)
    // MT1401   ??
    // MT2401   ???
    // MT5401   ??
    // MT5402   ??
    // MT3402   ?
    // MT7402   ??
    // MT8401   ??
    // MT8402   ??
    // MT8403   ???
    // MT8404   ???
    // MT4401   ??
    // MT4402   ??
    // MT4403   ??
    // MT4404   ??
    // MT4405   ??
    // MT4406   ??
    //
    // MFT2008 RMFT8DeclareTypeCodeStat (AlphaNumber)
    // MT1401   ??
    // MT2401   ???
    // MT5401   ??
    // MT5402   ??
    // MT3402   ?
    // MT7402   ??
    // MT8401   ??
    // MT8402   ??
    // MT8403   ???
    // MT8404   ???
    // MT4401   ??
    // MT4402   ??
    // MT4403   ??
    // MT4404   ??
    // MT4405   ??
    // MT4406   ??
    //
    // MFT2008 RMFT8FunctionTypeCode (AlphaNumber)
    // 2   
    // 3   
    // T   
    // 5   ?
    // 9   ???
    // 0   ???
    // 11   
    //
    // MFT2008 (AlphaNumber) RMFT8ReponseTypeCode
    // M1   M1-
    // M2   M2-??
    // M3   QP
    // 01   01-?
    // 02   02-
    // 03   03-?
    // 11   11-
    // 12   12-
    // 13   13-??
    // T   T-
    // D   D-?
    // E1   E1-??
    // E2   E2-?
    // E3   E3-??
    // E4   E4-?
    //
    // ?  (AlphaNumber) MasterAffirmSign
    // 0   
    // 1   ?
    // 2   ?
    //
    // ? ? (AlphaNumber) DeclareType
    // 0   
    // 1   
    //
    // MFT2008?? RMFT8MobileTypeCode (AlphaNumber)
    // MT4403   ??
    // MT4404   ??
    // MT4405   ??
    // MT4406   ??
    //
    // ?  RMFT8MobileFuncCode (AlphaNumber)
    // M1   
    // M2   ??
    // M3   QP
    // 2   
    // 3   
    // T   
    // 5   ?
    // 9   ?
    // 0   (??)
    // 11   

    URL url = new URL("http://ceesb.chinaport.gov.cn/SuperPassParaProxy/Proxy_Services/SuperPass_Proxy?wsdl");
    QName qname = new QName("http://www.cneport.com/webservices/superpass", "SuperPass");
    Service service = Service.create(url, qname);
    SuperPass superPass = service.getPort(SuperPass.class);

    /*
    String serviceName = "eport.superpass.pub.para.CustomsFlagStatus";
    byte[] requestContext = "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?><RequestContext><Group name=\"SystemInfo\"><Key name=\"ClientId\">5300001128334</Key><Key name=\"CertNo\">c1f4bb</Key><Key name=\"SaicSysNo\">618882068</Key><Key name=\"DEP_IN_CODE\">5300</Key><Key name=\"REG_CO_CGAC\">4403941436</Key><Key name=\"ENT_SEQ_NO\">000000000000063462</Key><Key name=\"IcCode\">8800000246746</Key><Key name=\"OperatorName\"></Key><Key name=\"DEP_CODE_CHG\">5300</Key><Key name=\"NAME_FULL\">???</Key></Group><Group name=\"DataPresentation\"><Key name=\"SignatureAlgorithm\" /><Key name=\"EncryptAlgorithm\" /><Key name=\"CompressAlgorithm\" /></Group></RequestContext>".getBytes();
    byte[] requestData = "<?xml version=\"1.0\"?>\n<CustomsFlagStatusRequest xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\n<CustomsCode>5300</CustomsCode>\n</CustomsFlagStatusRequest>".getBytes();
    */

    // ??
    String serviceName = "eport.superpass.pub.para.LoadIntoMemory";
    byte[] requestContext = "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?><RequestContext><Group name=\"SystemInfo\"><Key name=\"ClientId\">5300001128334</Key><Key name=\"CertNo\">b6c29b</Key><Key name=\"SaicSysNo\">618882068</Key><Key name=\"DEP_IN_CODE\">5300</Key><Key name=\"REG_CO_CGAC\">4403941436</Key><Key name=\"ENT_SEQ_NO\">000000000000063462</Key><Key name=\"SessionId\">2015-7-14</Key><Key name=\"IcCode\">8910000270086</Key><Key name=\"OperatorName\">??</Key><Key name=\"DEP_CODE_CHG\">5300</Key><Key name=\"NAME_FULL\">???</Key></Group><Group name=\"DataPresentation\"><Key name=\"SignatureAlgorithm\" /><Key name=\"EncryptAlgorithm\" /><Key name=\"CompressAlgorithm\" /></Group></RequestContext>"
            .getBytes();
    // ? MFT8TrayType
    // SELECT TRAY_CODE,TRAY_NAME FROM MFT8_TRAY_TYPE ORDER BY TRAY_CODE
    // ??? RMFT8TransportType
    // SELECT CODE, NAME FROM mft8_transport_type ORDER BY CODE
    // ? RMFT8CustomsCode
    // SELECT customs_CODE, customs_NAME FROM customs ORDER BY customs_CODE
    // ??(CN003) RMFT8PortCode
    // SELECT CODE, CHNAME FROM mft8_location_name ORDER BY CODE
    // ? RMFT8Curr
    // SELECT CODE, NAME FROM MFT8_ROAD_CURR ORDER BY CODE
    // ? RMFT8ReceiptPlace
    // SELECT CODE, NAME FROM mft8_entity ORDER BY CODE
    // ? RMFT8CountryCode
    // SELECT CODE, NAME FROM mft8_country_code ORDER BY CODE
    // ?? RMFT8CustomStatus
    // SELECT CODE, NAME FROM MFT8_ROAD_CUSTOMS_STATUS ORDER BY CODE
    // ?? RMFT8TransPayCode
    // SELECT CODE, NAME FROM MFT8_ROAD_PAYMENT_METHOD ORDER BY CODE
    // ??(CN005) RMFT8WrapTypeCode
    // SELECT CODE, NAME FROM mft8_packaging ORDER BY CODE
    // ??? RMFT8TransLicCode
    // SELECT CODE, NAME FROM MFT8_CONTR_CAR_COND ORDER BY CODE
    // ?? RMFT8PortWorkCode
    // SELECT CODE, NAME FROM MFT8_HAND_INSTR ORDER BY CODE
    // ?? RMFT8CommunicationCode
    // SELECT CODE, NAME FROM mft8_communi_type ORDER BY CODE
    // ? RMFT8PostCode
    // SELECT CODE, NAME FROM mft8_post_code ORDER BY CODE
    //  RMFT8EquipSizeCode
    // SELECT CODE, SHAPE,LENGTH,HEIGHT,WIDTH FROM mft8_equip_size_type ORDER BY CODE
    // ??? RMFT8EquipSupCode
    // SELECT CODE, NAME FROM MFT8_EQUIP_SUP ORDER BY CODE
    // ?? RMFT8EquipFullCode
    // SELECT CODE, NAME FROM mft8_equip_full ORDER BY CODE
    // ?? RMFT8EquipSealCode
    // SELECT CODE, NAME FROM mft8_seal_agency ORDER BY CODE
    // ??? RMFT8DanGoodsCode
    // SELECT CODE, CHNAME FROM mft8_dan_goods ORDER BY CODE
    // ? RMFT8CusProCode
    // SELECT CODE, NAME FROM mft8_cus_procedure ORDER BY CODE
    // ?/? RMFT8TransportSplitCode
    // SELECT CODE, NAME FROM mft8_indication ORDER BY CODE
    // ?? RMFT8DamageAreaCode
    // SELECT CODE, NAME FROM MFT8_DAMAGE_AREA ORDER BY CODE
    // ?? RMFT8DamageTypeCode
    // SELECT CODE, NAME FROM MFT8_DAMAGE_TYPE_DES ORDER BY CODE
    // IATA?(UN005) RMFT8IATACode
    // SELECT CODE, NAME FROM mft8_iata_code ORDER BY CODE
    // ????(UN009) RMFT8LocodePort
    // SELECT CODE, NAME FROM mft8_un_locode_port ORDER BY CODE
    // RMFT8ComplexCode
    // SELECT CODE_TS, G_NAME FROM complex ORDER BY CODE_TS
    byte[] requestData = "<?xml version=\"1.0\"?>\n<LoadIntoMemoryRequest xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\n<QuerySql>SELECT CODE, NAME FROM mft8_un_locode_port ORDER BY CODE</QuerySql>\n</LoadIntoMemoryRequest>"
            .getBytes();

    Holder<byte[]> responseData = new Holder<byte[]>();
    System.out.println(new String(superPass.service(serviceName, requestContext, requestData, responseData)));

    // deflate 
    DeflateCompressorInputStream gis = new DeflateCompressorInputStream(
            new ByteArrayInputStream(responseData.value));
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    int count;
    byte data[] = new byte[1024];
    while ((count = gis.read(data, 0, 1024)) != -1) {
        baos.write(data, 0, count);
    }
    gis.close();

    data = baos.toByteArray();
    baos.flush();
    baos.close();

    System.out.println(new String(data));
    // System.out.println(new String(responseData.value, "UTF-8"));
}

From source file:io.servicecomb.foundation.vertx.VertxUtils.java

public static <VERTICLE extends AbstractVerticle> boolean blockDeploy(Vertx vertx, Class<VERTICLE> cls,
        DeploymentOptions options) throws InterruptedException {
    Holder<Boolean> result = new Holder<>();

    CountDownLatch latch = new CountDownLatch(1);
    vertx.deployVerticle(cls.getName(), options, ar -> {
        result.value = ar.succeeded();//from   w w w  . jav a  2s .c  o  m

        if (ar.failed()) {
            LOGGER.error("deploy vertx failed, cause ", ar.cause());
        }

        latch.countDown();
    });

    latch.await();

    return result.value;
}

From source file:net.orpiske.dcd.dispatcher.impl.WebServicesDispatcher.java

private void callService(final MetaData metaData) {
    HeaderType headerType = newHeader(metaData);
    SourceType sourceType = newSource(metaData);
    CspType cspType = newCsp(metaData);/*from  w w  w . j  a v a 2 s .  co  m*/
    XMLGregorianCalendar reportDate = newReportDate(metaData);

    Holder<Integer> code = new Holder<Integer>();
    Holder<String> message = new Holder<String>();

    servicePort.loadService(headerType, sourceType, cspType, reportDate, code, message);
}

From source file:com.counter.IntegrationTest.java

public void testAdd() throws Exception {
    Bus bus = new SpringBusFactory().createBus("client.xml");

    BusFactory.setDefaultBus(bus);/*from   w  ww  .ja  v  a  2s. c  o  m*/
    CounterFactoryService counters = new CounterFactoryService(
            new URL("http://localhost:55555/counterFactory?wsdl"));
    CounterFactoryPortType factory = counters.getCounterFactoryPortTypePort();

    W3CEndpointReference epr = factory.createCounter();
    CounterService service = new CounterService();
    CounterPortType counter = service.getPort(epr, CounterPortType.class);
    assertEquals(counter.add(10), 10);
    assertEquals(counter.add(10), 20);
    assertEquals(counter.add(10), 30);
    assertEquals(((JAXBElement) counter.getResourceProperty(new QName("http://counter.com", "Value")).getAny()
            .get(0)).getValue(), 30);
    counter.setTerminationTime(Calendar.getInstance(), new Holder<Calendar>(), new Holder<Calendar>());
}

From source file:org.apache.servicemix.camel.nmr.CxfMessageTest.java

public void testInvokingServiceFromCXFClient() throws Exception {

    URL wsdlURL = getClass().getClassLoader().getResource("person.wsdl");

    System.out.println(wsdlURL);//from w  w  w .jav a  2  s.c  o  m
    PersonService ss = new PersonService(wsdlURL,
            new QName("http://servicemix.apache.org/samples/wsdl-first", "PersonService"));
    Person client = ss.getSoap();
    ClientProxy.getClient(client).getOutInterceptors().add(new LoggingOutInterceptor());
    ClientProxy.getClient(client).getInInterceptors().add(new LoggingInInterceptor());
    Holder<String> personId = new Holder<String>();
    personId.value = "world";
    Holder<String> ssn = new Holder<String>();
    Holder<String> name = new Holder<String>();
    client.getPerson(personId, ssn, name);
    assertEquals("we should get the right answer from router", "Bonjour", name.value);
}

From source file:com.evolveum.midpoint.cli.ninja.action.ExportAction.java

private void executeGet(ModelPortType port, Writer writer) throws FaultMessage, IOException, JAXBException {
    SelectorQualifiedGetOptionsType options = createOptions();

    QName type = ObjectType.getType(getParams().getType());
    if (type == null) {
        type = ObjectType.OBJECT.getType();
    }/*from   w w w. j  ava  2  s.c  o m*/

    Holder<com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType> object = new Holder<>();
    Holder<OperationResultType> result = new Holder<>();

    port.getObject(type, getParams().getOid(), options, object, result);

    ToolsUtils.serializeObject(object.value, writer);
}

From source file:org.apache.servicemix.camel.nmr.AttachmentTest.java

public void testAttachment() throws Exception {
    TestMtom mtomPort = createPort(MTOM_SERVICE, MTOM_PORT, TestMtom.class, true);
    try {//from w  w w.j  a  v  a2  s .  co m

        Holder<DataHandler> param = new Holder<DataHandler>();

        param.value = new DataHandler(new ByteArrayDataSource("foobar".getBytes(), "application/octet-stream"));

        Holder<String> name = new Holder<String>("call detail");
        mtomPort.testXop(name, param);
        assertEquals("call detailfoobar", name.value);
        assertNotNull(param.value);
        InputStream bis = param.value.getDataSource().getInputStream();
        byte b[] = new byte[10];
        bis.read(b, 0, 10);
        String attachContent = new String(b);
        assertEquals(attachContent, "testfoobar");
    } catch (UndeclaredThrowableException ex) {
        throw (Exception) ex.getCause();
    }

}

From source file:com.evolveum.midpoint.testing.wstest.TestReportServices.java

@Test
public void test010ListNodes() throws Exception {
    final String TEST_NAME = "test010ListNodes";
    displayTestTitle(TEST_NAME);//from  www .  ja v a  2  s.  c om

    Holder<ObjectListType> objectListHolder = new Holder<>();
    Holder<OperationResultType> resultHolder = new Holder<>();

    // WHEN
    displayWhen(TEST_NAME);
    modelPort.searchObjects(ModelClientUtil.getTypeQName(NodeType.class), null, null, objectListHolder,
            resultHolder);

    // THEN
    displayThen(TEST_NAME);
    assertSuccess(resultHolder);
    ObjectListType objectList = objectListHolder.value;
    for (ObjectType searchResult : objectList.getObject()) {
        display(searchResult);
        if (!(searchResult instanceof NodeType)) {
            AssertJUnit.fail("Got wrong type " + searchResult);
        }
        nodeOriginalOid = searchResult.getOid();
    }
    assertEquals("Unexpected number of nodes", 1, objectList.getObject().size());
}

From source file:com.evolveum.midpoint.cli.ninja.action.ExportAction.java

private void executeSearch(ModelPortType port, Writer writer)
        throws FaultMessage, IOException, JAXBException, SAXException {

    SelectorQualifiedGetOptionsType options = createOptions();

    QName type = ObjectType.getType(getParams().getType());
    if (type == null) {
        type = ObjectType.OBJECT.getType();
    }// w w  w . j a v  a 2  s .  c o m

    int count = 0;
    int currentSize = 1;
    Holder<ObjectListType> list = new Holder<>();
    Holder<OperationResultType> result = new Holder<>();
    while (currentSize > 0) {
        QueryType query = createQuery(count);
        port.searchObjects(type, query, options, list, result);

        OperationResultType res = result.value;
        if (!OperationResultStatusType.SUCCESS.equals(res.getStatus()) && !getParams().isIgnore()) {
            printInfoMessage("Search returned {}, reason: ", res.getStatus(), res.getMessage());
            if (getParams().isVerbose()) {
                printInfoMessage("Operation result:\n{}", ToolsUtils.serializeObject(res));
            }
            break;
        }

        ObjectListType objList = list.value;
        if (getParams().isVerbose()) {
            printInfoMessage("Search returned {}, status: {}/{}", res.getStatus(), count, objList.getCount());
        }

        List<com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType> objects = objList.getObject();
        currentSize = objects.size();

        for (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType object : objects) {
            ToolsUtils.serializeObject(object, writer);
            writer.write('\n');
        }
        count += currentSize;
    }
}