package com.sun.ts.tests.jaxws.wsa.w2j.document.literal.delimiter;

import com.sun.ts.lib.util.*;
import com.sun.ts.lib.porting.*;
import com.sun.ts.lib.harness.*;
import jakarta.xml.soap.SOAPBody;
import jakarta.xml.soap.SOAPException;
import com.sun.ts.tests.jaxws.wsa.common.ActionNotSupportedException;
import com.sun.ts.tests.jaxws.common.*;
import java.net.URL;
import jakarta.xml.ws.*;
import jakarta.xml.soap.*;
import java.util.Properties;
import javax.xml.namespace.QName;
import com.sun.javatest.Status;
import javax.naming.InitialContext;

public class Client extends ServiceEETest {

    // The webserver defaults (overidden by harness properties)
    private static final String PROTOCOL = "http";

    private static final String HOSTNAME = "localhost";

    private static final int PORTNUM = 8000;

    // The webserver host and port property names (harness properties)
    private static final String WEBSERVERHOSTPROP = "webServerHost";

    private static final String WEBSERVERPORTPROP = "webServerPort";

    private static final String MODEPROP = "platform.mode";

    String modeProperty = null;

    private static final String PKG_NAME = "com.sun.ts.tests.jaxws.wsa.w2j.document.literal.delimiter.";

    private TSURL ctsurl = new TSURL();

    private Properties props = null;

    private String hostname = HOSTNAME;

    private int portnum = PORTNUM;

    // URL properties used by the test
    private static final String ENDPOINT_URL = "wsaw2jdldelimitertest.endpoint.1";

    private static final String WSDLLOC_URL = "wsaw2jdldelimitertest.wsdlloc.1";

    private String url = null;

    // service and port information
    private static final String NAMESPACEURI = "urn:example.com";

    private static final String SERVICE_NAME = "AddNumbersService";

    private static final String PORT_NAME = "AddNumbersPort";

    private QName SERVICE_QNAME = new QName(NAMESPACEURI, SERVICE_NAME);

    private QName PORT_QNAME = new QName(NAMESPACEURI, PORT_NAME);

    private URL wsdlurl = null;

    AddNumbersPortType port = null;

    static AddNumbersService service = null;

    private void getTestURLs() throws Exception {
        TestUtil.logMsg("Get URL's used by the test");
        String file = JAXWS_Util.getURLFromProp(ENDPOINT_URL);
        url = ctsurl.getURLString(PROTOCOL, hostname, portnum, file);
        file = JAXWS_Util.getURLFromProp(WSDLLOC_URL);
        wsdlurl = ctsurl.getURL(PROTOCOL, hostname, portnum, file);
        TestUtil.logMsg("Service Endpoint URL: " + url);
        TestUtil.logMsg("WSDL Location URL:    " + wsdlurl);
    }

    private void getPortStandalone() throws Exception {
        port = (AddNumbersPortType) JAXWS_Util.getPort(wsdlurl, SERVICE_QNAME, AddNumbersService.class, PORT_QNAME, AddNumbersPortType.class);
        TestUtil.logMsg("port=" + port);
        JAXWS_Util.setTargetEndpointAddress(port, url);
    }

    private void getPortJavaEE() throws Exception {
        TestUtil.logMsg("Obtain service via WebServiceRef annotation");
        TestUtil.logMsg("service=" + service);
        port = (AddNumbersPortType) service.getAddNumbersPort();
        TestUtil.logMsg("port=" + port);
        TestUtil.logMsg("Obtained port");
        JAXWS_Util.dumpTargetEndpointAddress(port);
    }

    public static void main(String[] args) {
        Client theTests = new Client();
        Status s = theTests.run(args, System.out, System.err);
        s.exit();
    }

    /* Test setup */
    public void setup(String[] args, Properties p) throws Fault {
        props = p;
        boolean pass = true;
        try {
            hostname = p.getProperty(WEBSERVERHOSTPROP);
            if (hostname == null)
                pass = false;
            else if (hostname.equals(""))
                pass = false;
            try {
                portnum = Integer.parseInt(p.getProperty(WEBSERVERPORTPROP));
            } catch (Exception e) {
                TestUtil.printStackTrace(e);
                pass = false;
            }
            modeProperty = p.getProperty(MODEPROP);
            if (modeProperty.equals("standalone")) {
                getTestURLs();
                getPortStandalone();
            } else {
                TestUtil.logMsg("WebServiceRef is not set in Client (get it from specific vehicle)");
                service = (AddNumbersService) getSharedObject();
                getTestURLs();
                getPortJavaEE();
            }
        } catch (Exception e) {
            TestUtil.printStackTrace(e);
            throw new Fault("setup failed:", e);
        }
        if (!pass) {
            TestUtil.logErr("Please specify host & port of web server " + "in config properties: " + WEBSERVERHOSTPROP + ", " + WEBSERVERPORTPROP);
            throw new Fault("setup failed:");
        }
        logMsg("setup ok");
    }

    public void cleanup() throws Fault

    /*
   * @testName: testURNDefaultInputOutputActions
   *
   * @assertion_ids: WSAMD:SPEC:4004; WSAMD:SPEC:4004.1; WSAMD:SPEC:4004.2;
   *
   * @test_Strategy: Test default action pattern for WSDL input/output with URN
   * targetNamespace
   *
   */
    public void testURNDefaultInputOutputActions() throws Fault {
        TestUtil.logMsg("testURNDefaultInputOutputActions");
        boolean pass = true;
        try {
            int result = port.addNumbers(10, 10);
            if (result != 20) {
                TestUtil.logErr("result mismatch, expected 20, received " + result);
                pass = false;
            } else
                TestUtil.logMsg("result match");
        } catch (Exception e) {
            TestUtil.logErr("Caught exception: " + e.getMessage());
            TestUtil.printStackTrace(e);
            throw new Fault("testURNDefaultInputOutputActions failed", e);
        }
        if (!pass)
            throw new Fault("testURNDefaultInputOutputActions failed");
    }

    /*
   * @testName: testURNDefaultFaultAction
   *
   * @assertion_ids: WSAMD:SPEC:4004; WSAMD:SPEC:4004.3;
   *
   * @test_Strategy: Test default action pattern for WSDL fault with URN
   * targetNamespace
   *
   */
    public void testURNDefaultFaultAction() throws Fault {
        TestUtil.logMsg("testURNDefaultFaultAction");
        boolean pass = true;
        try {
            port.addNumbers(-10, 10);
            TestUtil.logErr("AddNumbersFault_Exception must be thrown");
            pass = false;
        } catch (AddNumbersFault_Exception ex) {
            TestUtil.logMsg("AddNumbersFault_Exception was thrown as expected");
        } catch (Exception e) {
            TestUtil.logErr("Caught exception: " + e.getMessage());
            TestUtil.printStackTrace(e);
            throw new Fault("testURNDefaultFaultAction failed", e);
        }
        if (!pass)
            throw new Fault("testURNDefaultAddFaultAction failed");
    }

    /*
   * @testName: testURNExplicitInputOutputActions
   *
   * @assertion_ids: WSAMD:SPEC:4004; WSAMD:SPEC:4003; WSAMD:SPEC:4003.1;
   * WSAMD:SPEC:4003.1; JAXWS:SPEC:2077; JAXWS:SPEC:2078; JAXWS:SPEC:2079;
   *
   * @test_Strategy: Test explicit association for WSDL input/output with URN
   * targetNamespace
   *
   */
    public void testURNExplicitInputOutputActions() throws Fault {
        TestUtil.logMsg("testURNExplicitInputOutputActions");
        boolean pass = true;
        try {
            int result = port.addNumbers2(10, 10);
            if (result != 20) {
                TestUtil.logErr("result mismatch, expected 20, received " + result);
                pass = false;
            } else
                TestUtil.logMsg("result match");
        } catch (Exception e) {
            TestUtil.logErr("Caught exception: " + e.getMessage());
            TestUtil.printStackTrace(e);
            throw new Fault("testURNExplicitInputOutputActions failed", e);
        }
        if (!pass)
            throw new Fault("testURNExplicitInputOutputActions failed");
    }

    /*
   * @testName: testURNExplicitFaultAction
   *
   * @assertion_ids: WSAMD:SPEC:4004; WSAMD:SPEC:4003; WSAMD:SPEC:4003.3;
   * JAXWS:SPEC:2080; JAXWS:SPEC:2081; JAXWS:SPEC:2082; JAXWS:SPEC:2083;
   *
   * @test_Strategy: Test explicit association for WSDL fault with URN
   * targetNamespace
   *
   */
    public void testURNExplicitFaultAction() throws Fault {
        TestUtil.logMsg("testURNExplicitFaultAction");
        boolean pass = true;
        try {
            int result = port.addNumbers2(-10, 10);
            TestUtil.logErr("AddNumbersFault_Exception must be thrown");
            pass = false;
        } catch (AddNumbersFault_Exception ex) {
            TestUtil.logMsg("AddNumbersFault_Exception was thrown as expected");
        } catch (Exception e) {
            TestUtil.logErr("Caught exception: " + e.getMessage());
            TestUtil.printStackTrace(e);
            throw new Fault("testURNExplicitFaultAction failed", e);
        }
        if (!pass)
            throw new Fault("testURNExplicitFaultAction failed");
    }
}


package com.sun.ts.tests.jaxws.wsa.w2j.document.literal.delimiter;

import com.sun.ts.lib.util.*;
import com.sun.ts.lib.porting.*;
import com.sun.ts.lib.harness.*;
import jakarta.xml.soap.SOAPBody;
import jakarta.xml.soap.SOAPException;
import com.sun.ts.tests.jaxws.wsa.common.ActionNotSupportedException;
import com.sun.ts.tests.jaxws.common.*;
import java.net.URL;
import jakarta.xml.ws.*;
import jakarta.xml.soap.*;
import java.util.Properties;
import javax.xml.namespace.QName;
import com.sun.javatest.Status;
import javax.naming.InitialContext;

public class Client extends ServiceEETest {

    // The webserver defaults (overidden by harness properties)
    private static final String PROTOCOL = "http";

    private static final String HOSTNAME = "localhost";

    private static final int PORTNUM = 8000;

    // The webserver host and port property names (harness properties)
    private static final String WEBSERVERHOSTPROP = "webServerHost";

    private static final String WEBSERVERPORTPROP = "webServerPort";

    private static final String MODEPROP = "platform.mode";

    String modeProperty = null;

    private static final String PKG_NAME = "com.sun.ts.tests.jaxws.wsa.w2j.document.literal.delimiter.";

    private TSURL ctsurl = new TSURL();

    private Properties props = null;

    private String hostname = HOSTNAME;

    private int portnum = PORTNUM;

    // URL properties used by the test
    private static final String ENDPOINT_URL = "wsaw2jdldelimitertest.endpoint.1";

    private static final String WSDLLOC_URL = "wsaw2jdldelimitertest.wsdlloc.1";

    private String url = null;

    // service and port information
    private static final String NAMESPACEURI = "urn:example.com";

    private static final String SERVICE_NAME = "AddNumbersService";

    private static final String PORT_NAME = "AddNumbersPort";

    private QName SERVICE_QNAME = new QName(NAMESPACEURI, SERVICE_NAME);

    private QName PORT_QNAME = new QName(NAMESPACEURI, PORT_NAME);

    private URL wsdlurl = null;

    AddNumbersPortType port = null;

    static AddNumbersService service = null;

    private void getTestURLs() throws Exception {
        TestUtil.logMsg("Get URL's used by the test");
        String file = JAXWS_Util.getURLFromProp(ENDPOINT_URL);
        url = ctsurl.getURLString(PROTOCOL, hostname, portnum, file);
        file = JAXWS_Util.getURLFromProp(WSDLLOC_URL);
        wsdlurl = ctsurl.getURL(PROTOCOL, hostname, portnum, file);
        TestUtil.logMsg("Service Endpoint URL: " + url);
        TestUtil.logMsg("WSDL Location URL:    " + wsdlurl);
    }

    private void getPortStandalone() throws Exception {
        port = (AddNumbersPortType) JAXWS_Util.getPort(wsdlurl, SERVICE_QNAME, AddNumbersService.class, PORT_QNAME, AddNumbersPortType.class);
        TestUtil.logMsg("port=" + port);
        JAXWS_Util.setTargetEndpointAddress(port, url);
    }

    private void getPortJavaEE() throws Exception {
        TestUtil.logMsg("Obtain service via WebServiceRef annotation");
        TestUtil.logMsg("service=" + service);
        port = (AddNumbersPortType) service.getAddNumbersPort();
        TestUtil.logMsg("port=" + port);
        TestUtil.logMsg("Obtained port");
        JAXWS_Util.dumpTargetEndpointAddress(port);
    }

    public static void main(String[] args) {
        Client theTests = new Client();
        Status s = theTests.run(args, System.out, System.err);
        s.exit();
    }

    /* Test setup */
    public void setup(String[] args, Properties p) throws Fault {
        props = p;
        boolean pass = true;
        try {
            hostname = p.getProperty(WEBSERVERHOSTPROP);
            if (hostname == null)
                pass = false;
            else if (hostname.equals(""))
                pass = false;
            try {
                portnum = Integer.parseInt(p.getProperty(WEBSERVERPORTPROP));
            } catch (Exception e) {
                TestUtil.printStackTrace(e);
                pass = false;
            }
            modeProperty = p.getProperty(MODEPROP);
            if (modeProperty.equals("standalone")) {
                getTestURLs();
                getPortStandalone();
            } else {
                TestUtil.logMsg("WebServiceRef is not set in Client (get it from specific vehicle)");
                service = (AddNumbersService) getSharedObject();
                getTestURLs();
                getPortJavaEE();
            }
        } catch (Exception e) {
            TestUtil.printStackTrace(e);
            throw new Fault("setup failed:", e);
        }
        if (!pass) {
            TestUtil.logErr("Please specify host & port of web server " + "in config properties: " + WEBSERVERHOSTPROP + ", " + WEBSERVERPORTPROP);
            throw new Fault("setup failed:");
        }
        logMsg("setup ok");
    }

    public void cleanup() throws Fault {
        logMsg("cleanup ok");
    }

    /*
   * @testName: testURNDefaultInputOutputActions
   *
   * @assertion_ids: WSAMD:SPEC:4004; WSAMD:SPEC:4004.1; WSAMD:SPEC:4004.2;
   *
   * @test_Strategy: Test default action pattern for WSDL input/output with URN
   * targetNamespace
   *
   */
    public void testURNDefaultInputOutputActions() throws Fault {
        TestUtil.logMsg("testURNDefaultInputOutputActions");
        boolean pass = true;
        try {
            int result = port.addNumbers(10, 10);
            if (result != 20) {
                TestUtil.logErr("result mismatch, expected 20, received " + result);
                pass = false;
            } else
                TestUtil.logMsg("result match");
        } catch (Exception e) {
            TestUtil.logErr("Caught exception: " + e.getMessage());
            TestUtil.printStackTrace(e);
            throw new Fault("testURNDefaultInputOutputActions failed", e);
        }
        if (!pass)
            throw new Fault("testURNDefaultInputOutputActions failed");
    }

    /*
   * @testName: testURNDefaultFaultAction
   *
   * @assertion_ids: WSAMD:SPEC:4004; WSAMD:SPEC:4004.3;
   *
   * @test_Strategy: Test default action pattern for WSDL fault with URN
   * targetNamespace
   *
   */
    public void testURNDefaultFaultAction() throws Fault {
        TestUtil.logMsg("testURNDefaultFaultAction");
        boolean pass = true;
        try {
            port.addNumbers(-10, 10);
            TestUtil.logErr("AddNumbersFault_Exception must be thrown");
            pass = false;
        } catch (AddNumbersFault_Exception ex) {
            TestUtil.logMsg("AddNumbersFault_Exception was thrown as expected");
        } catch (Exception e) {
            TestUtil.logErr("Caught exception: " + e.getMessage());
            TestUtil.printStackTrace(e);
            throw new Fault("testURNDefaultFaultAction failed", e);
        }
        if (!pass)
            throw new Fault("testURNDefaultAddFaultAction failed");
    }

    /*
   * @testName: testURNExplicitInputOutputActions
   *
   * @assertion_ids: WSAMD:SPEC:4004; WSAMD:SPEC:4003; WSAMD:SPEC:4003.1;
   * WSAMD:SPEC:4003.1; JAXWS:SPEC:2077; JAXWS:SPEC:2078; JAXWS:SPEC:2079;
   *
   * @test_Strategy: Test explicit association for WSDL input/output with URN
   * targetNamespace
   *
   */
    public void testURNExplicitInputOutputActions() throws Fault {
        TestUtil.logMsg("testURNExplicitInputOutputActions");
        boolean pass = tr

        try {
            int result = port.addNumbers2(10, 10);
            if (result != 20) {
                TestUtil.logErr("result mismatch, expected 20, received " + result);
                pass = false;
            } else
                TestUtil.logMsg("result match");
        } catch (Exception e) {
            TestUtil.logErr("Caught exception: " + e.getMessage());
            TestUtil.printStackTrace(e);
            throw new Fault("testURNExplicitInputOutputActions failed", e);
        }
        if (!pass)
            throw new Fault("testURNExplicitInputOutputActions failed");
    }

    /*
   * @testName: testURNExplicitFaultAction
   *
   * @assertion_ids: WSAMD:SPEC:4004; WSAMD:SPEC:4003; WSAMD:SPEC:4003.3;
   * JAXWS:SPEC:2080; JAXWS:SPEC:2081; JAXWS:SPEC:2082; JAXWS:SPEC:2083;
   *
   * @test_Strategy: Test explicit association for WSDL fault with URN
   * targetNamespace
   *
   */
    public void testURNExplicitFaultAction() throws Fault {
        TestUtil.logMsg("testURNExplicitFaultAction");
        boolean pass = true;
        try {
            int result = port.addNumbers2(-10, 10);
            TestUtil.logErr("AddNumbersFault_Exception must be thrown");
            pass = false;
        } catch (AddNumbersFault_Exception ex) {
            TestUtil.logMsg("AddNumbersFault_Exception was thrown as expected");
        } catch (Exception e) {
            TestUtil.logErr("Caught exception: " + e.getMessage());
            TestUtil.printStackTrace(e);
            throw new Fault("testURNExplicitFaultAction failed", e);
        }
        if (!pass)
            throw new Fault("testURNExplicitFaultAction failed");
    }
}


try {
                portnum = Integer.parseInt(p.getProperty(WEBSERVERPORTPROP));
            } catch (Exception e) {
                TestUtil.printStackTrace(e);
                pass = false;
            }

package com.sun.ts.tests.jaxws.wsa.w2j.document.literal.delimiter;

import com.sun.ts.lib.util.*;
import com.sun.ts.lib.porting.*;
import com.sun.ts.lib.harness.*;
import jakarta.xml.soap.SOAPBody;
import jakarta.xml.soap.SOAPException;
import com.sun.ts.tests.jaxws.wsa.common.ActionNotSupportedException;
import com.sun.ts.tests.jaxws.common.*;
import java.net.URL;
import jakarta.xml.ws.*;
import jakarta.xml.soap.*;
import java.util.Properties;
import javax.xml.namespace.QName;
import com.sun.javatest.Status;
import javax.naming.InitialContext;

public class Client extends ServiceEETest {

    // The webserver defaults (overidden by harness properties)
    private static final String PROTOCOL = "http";

    private static final String HOSTNAME = "localhost";

    private static final int PORTNUM = 8000;

    // The webserver host and port property names (harness properties)
    private static final String WEBSERVERHOSTPROP = "webServerHost";

    private static final String WEBSERVERPORTPROP = "webServerPort";

    private static final String MODEPROP = "platform.mode";

    String modeProperty = null;

    private static final String PKG_NAME = "com.sun.ts.tests.jaxws.wsa.w2j.document.literal.delimiter.";

    private TSURL ctsurl = new TSURL();

    private Properties props = null;

    private String hostname = HOSTNAME;

    private int portnum = PORTNUM;

    // URL properties used by the test
    private static final String ENDPOINT_URL = "wsaw2jdldelimitertest.endpoint.1";

    private static final String WSDLLOC_URL = "wsaw2jdldelimitertest.wsdlloc.1";

    private String url = null;

    // service and port information
    private static final String NAMESPACEURI = "urn:example.com";

    private static final String SERVICE_NAME = "AddNumbersService";

    private static final String PORT_NAME = "AddNumbersPort";

    private QName SERVICE_QNAME = new QName(NAMESPACEURI, SERVICE_NAME);

    private QName PORT_QNAME = new QName(NAMESPACEURI, PORT_NAME);

    private URL wsdlurl = null;

    AddNumbersPortType port = null;

    static AddNumbersService service = null;

    private void getTestURLs() throws Exception {
        TestUtil.logMsg("Get URL's used by the test");
        String file = JAXWS_Util.getURLFromProp(ENDPOINT_URL);
        url = ctsurl.getURLString(PROTOCOL, hostname, portnum, file);
        file = JAXWS_Util.getURLFromProp(WSDLLOC_URL);
        wsdlurl = ctsurl.getURL(PROTOCOL, hostname, portnum, file);
        TestUtil.logMsg("Service Endpoint URL: " + url);
        TestUtil.logMsg("WSDL Location URL:    " + wsdlurl);
    }

    private void getPortStandalone() throws Exception {
        port = (AddNumbersPortType) JAXWS_Util.getPort(wsdlurl, SERVICE_QNAME, AddNumbersService.class, PORT_QNAME, AddNumbersPortType.class);
        TestUtil.logMsg("port=" + port);
        JAXWS_Util.setTargetEndpointAddress(port, url);
    }

    private void getPortJavaEE() throws Exception {
        TestUtil.logMsg("Obtain service via WebServiceRef annotation");
        TestUtil.logMsg("service=" + service);
        port = (AddNumbersPortType) service.getAddNumbersPort();
        TestUtil.logMsg("port=" + port);
        TestUtil.logMsg("Obtained port");
        JAXWS_Util.dumpTargetEndpointAddress(port);
    }

    public static void main(String[] args) {
        Client theTests = new Client();
        Status s = theTests.run(args, System.out, System.err);
        s.exit();
    }

    /* Test setup */
    public void setup(String[] args, Properties p) throws Fault {
        props = p;
        boolean pass = true;
        try {
            hostname = p.getProperty(WEBSERVERHOSTPROP);
            if (hostname == null)
                pass = false;
            else if (hostname.equals(""))
                pass = false;

            modeProperty = p.getProperty(MODEPROP);
            if (modeProperty.equals("standalone")) {
                getTestURLs();
                getPortStandalone();
            } else {
                TestUtil.logMsg("WebServiceRef is not set in Client (get it from specific vehicle)");
                service = (AddNumbersService) getSharedObject();
                getTestURLs();
                getPortJavaEE();
            }
        } catch (Exception e) {
            TestUtil.printStackTrace(e);
            throw new Fault("setup failed:", e);
        }
        if (!pass) {
            TestUtil.logErr("Please specify host & port of web server " + "in config properties: " + WEBSERVERHOSTPROP + ", " + WEBSERVERPORTPROP);
            throw new Fault("setup failed:");
        }
        logMsg("setup ok");
    }

    public void cleanup() throws Fault {
        logMsg("cleanup ok");
    }

    /*
   * @testName: testURNDefaultInputOutputActions
   *
   * @assertion_ids: WSAMD:SPEC:4004; WSAMD:SPEC:4004.1; WSAMD:SPEC:4004.2;
   *
   * @test_Strategy: Test default action pattern for WSDL input/output with URN
   * targetNamespace
   *
   */
    public void testURNDefaultInputOutputActions() throws Fault {
        TestUtil.logMsg("testURNDefaultInputOutputActions");
        boolean pass = true;
        try {
            int result = port.addNumbers(10, 10);
            if (result != 20) {
                TestUtil.logErr("result mismatch, expected 20, received " + result);
                pass = false;
            } else
                TestUtil.logMsg("result match");
        } catch (Exception e) {
            TestUtil.logErr("Caught exception: " + e.getMessage());
            TestUtil.printStackTrace(e);
            throw new Fault("testURNDefaultInputOutputActions failed", e);
        }
        if (!pass)
            throw new Fault("testURNDefaultInputOutputActions failed");
    }

    /*
   * @testName: testURNDefaultFaultAction
   *
   * @assertion_ids: WSAMD:SPEC:4004; WSAMD:SPEC:4004.3;
   *
   * @test_Strategy: Test default action pattern for WSDL fault with URN
   * targetNamespace
   *
   */
    public void testURNDefaultFaultAction() throws Fault {
        TestUtil.logMsg("testURNDefaultFaultAction");
        boolean pass = true;
        try {
            port.addNumbers(-10, 10);
            TestUtil.logErr("AddNumbersFault_Exception must be thrown");
            pass = false;
        } catch (AddNumbersFault_Exception ex) {
            TestUtil.logMsg("AddNumbersFault_Exception was thrown as expected");
        } catch (Exception e) {
            TestUtil.logErr("Caught exception: " + e.getMessage());
            TestUtil.printStackTrace(e);
            throw new Fault("testURNDefaultFaultAction failed", e);
        }
        if (!pass)
            throw new Fault("testURNDefaultAddFaultAction failed");
    }

    /*
   * @testName: testURNExplicitInputOutputActions
   *
   * @assertion_ids: WSAMD:SPEC:4004; WSAMD:SPEC:4003; WSAMD:SPEC:4003.1;
   * WSAMD:SPEC:4003.1; JAXWS:SPEC:2077; JAXWS:SPEC:2078; JAXWS:SPEC:2079;
   *
   * @test_Strategy: Test explicit association for WSDL input/output with URN
   * targetNamespace
   *
   */
    public void testURNExplicitInputOutputActions() throws Fault {
        TestUtil.logMsg("testURNExplicitInputOutputActions");
        boolean pass = true;
        try {
            int result = port.addNumbers2(10, 10);
            if (result != 20) {
                TestUtil.logErr("result mismatch, expected 20, received " + result);
                pass = false;
            } else
                TestUtil.logMsg("result match");
        } catch (Exception e) {
            TestUtil.logErr("Caught exception: " + e.getMessage());
            TestUtil.printStackTrace(e);
            throw new Fault("testURNExplicitInputOutputActions failed", e);
        }
        if (!pass)
            throw new Fault("testURNExplicitInputOutputActions failed");
    }

    /*
   * @testName: testURNExplicitFaultAction
   *
   * @assertion_ids: WSAMD:SPEC:4004; WSAMD:SPEC:4003; WSAMD:SPEC:4003.3;
   * JAXWS:SPEC:2080; JAXWS:SPEC:2081; JAXWS:SPEC:2082; JAXWS:SPEC:2083;
   *
   * @test_Strategy: Test explicit association for WSDL fault with URN
   * targetNamespace
   *
   */
    public void testURNExplicitFaultAction() throws Fault {
        TestUtil.logMsg("testURNExplicitFaultAction");
        boolean pass = true;
        try {
            int result = port.addNumbers2(-10, 10);
            TestUtil.logErr("AddNumbersFault_Exception must be thrown");
            pass = false;
        } catch (AddNumbersFault_Exception ex) {
            TestUtil.logMsg("AddNumbersFault_Exception was thrown as expected");
        } catch (Exception e) {
            TestUtil.logErr("Caught exception: " + e.getMessage());
            TestUtil.printStackTrace(e);
            throw new Fault("testURNExplicitFaultAction failed", e);
        }
        if (!pass)
            throw new Fault("testURNExplicitFaultAction failed");
    }
}


@Override
    protected void doUpgrade() throws Exception

package com.liferay.message.boards.internal.upgrade.v4_0_0;

import com.liferay.portal.kernel.upgrade.UpgradeProcess;

/**
 * @author Preston Crary
 */
public class MBCategoryThreadCountUpgradeProcess extends UpgradeProcess {

{
        runSQL("alter table MBCategory drop column threadCount");
    }
}


{
        runSQL("alter table MBCategory drop column threadCount");
    }

package com.liferay.message.boards.internal.upgrade.v4_0_0;

import com.liferay.portal.kernel.upgrade.UpgradeProcess;

/**
 * @author Preston Crary
 */
public class MBCategoryThreadCountUpgradeProcess extends UpgradeProcess {

    @Override
    protected void doUpgrade() throws Exception


runSQL("alter table MBCategory drop column threadCount");

package com.liferay.message.boards.internal.upgrade.v4_0_0;

import com.liferay.portal.kernel.upgrade.UpgradeProcess;

/**
 * @author Preston Crary
 */
public class MBCategoryThreadCountUpgradeProcess extends UpgradeProcess {

    @Override
    protected void doUpgrade() throws Exception {


/**
 * The present code is developed in the scope of the joint LINAGORA -
 * Université Joseph Fourier - Floralis research program and is designated
 * as a "Result" pursuant to the terms and conditions of the LINAGORA
 * - Université Joseph Fourier - Floralis research program. Each copyright
 * holder of Results enumerated here above fully & independently holds complete
 */
package net.roboconf.core.commands;

import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import net.roboconf.core.errors.ErrorCode;
import net.roboconf.core.model.ParsingError;
import net.roboconf.core.utils.Utils;

/**
 * @author Vincent Zurczak - Linagora
 */
public class EmailCommandInstruction extends AbstractCommandInstruction {

    static final String PREFIX = "email";

    private String msg;

    private final List<String> tos = new ArrayList<>();

    /**
     * Constructor.
     * @param context
     * @param instruction
     * @param line
     */
    EmailCommandInstruction(Context context, String instruction, int line) {
        super(context, instruction, line);
        Pattern p = Pattern.compile(PREFIX + "\\s+(.*)\\s*with\\s+(.*)", Pattern.CASE_INSENSITIVE);
        Matcher m = p.matcher(instruction);
        if (m.matches()) {
            this.syntaxicallyCorrect = true;
            this.tos.addAll(Utils.splitNicely(m.group(1), ","));
            this.msg = m.group(2).trim().replace("\\n", "\n");
        }
    }

    /*
	 * (non-Javadoc)
	 * @see net.roboconf.core.commands.AbstractCommandInstruction#doValidate()
	 */
    @Override
    public List<ParsingError> doValidate() {
        List<ParsingError> result = new ArrayList<>();
        if (Utils.isEmptyOrWhitespaces(this.msg))
            result.add(error(ErrorCode.CMD_EMAIL_NO_MESSAGE));
        return result;
    }

    /**
     * @return the msg
     */

{
        return this.msg;
    }

    /**
     * @return the tos
     */
    public List<String> getTos() {
        return this.tos;
    }
}


/**
 * The present code is developed in the scope of the joint LINAGORA -
 * Université Joseph Fourier - Floralis research program and is designated
 * as a "Result" pursuant to the terms and conditions of the LINAGORA
 * - Université Joseph Fourier - Floralis research program. Each copyright
 * holder of Results enumerated here above fully & independently holds complete
 */
package net.roboconf.core.commands;

import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import net.roboconf.core.errors.ErrorCode;
import net.roboconf.core.model.ParsingError;
import net.roboconf.core.utils.Utils;

/**
 * @author Vincent Zurczak - Linagora
 */
public class EmailCommandInstruction extends AbstractCommandInstruction {

    static final String PREFIX = "email";

    private String msg;

    private final List<String> tos = new ArrayList<>();

    /**
     * Constructor.
     * @param context
     * @param instruction
     * @param line
     */
    EmailCommandInstruction(Context context, String instruction, int line) {
        super(context, instruction, line);
        Pattern p = Pattern.compile(PREFIX + "\\s+(.*)\\s*with\\s+(.*)", Pattern.CASE_INSENSITIVE);
        Matcher m = p.matcher(instruction);
        if (m.matches()) {
            this.syntaxicallyCorrect = true;
            this.tos.addAll(Utils.splitNicely(m.group(1), ","));
            this.msg = m.group(2).trim().replace("\\n", "\n");
        }
    }

    /*
	 * (non-Javadoc)
	 * @see net.roboconf.core.commands.AbstractCommandInstruction#doValidate()
	 */
    @Override
    public List<ParsingError> doValidate() {
        List<ParsingError> result = new ArrayList<>();
        if (Utils.isEmptyOrWhitespaces(this.msg))
            result.add(error(ErrorCode.CMD_EMAIL_NO_MESSAGE));
        return result;
    }

    /**
     * @return the msg
     */
    public String getMsg() {
        return this.msg;
    }

    /**
     * @return the tos
     */
    public List<String> getTos()


/**
 * The present code is developed in the scope of the joint LINAGORA -
 * Université Joseph Fourier - Floralis research program and is designated
 * as a "Result" pursuant to the terms and conditions of the LINAGORA
 * - Université Joseph Fourier - Floralis research program. Each copyright
 * holder of Results enumerated here above fully & independently holds complete
 */
package net.roboconf.core.commands;

import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import net.roboconf.core.errors.ErrorCode;
import net.roboconf.core.model.ParsingError;
import net.roboconf.core.utils.Utils;

/**
 * @author Vincent Zurczak - Linagora
 */
public class EmailCommandInstruction extends AbstractCommandInstruction {

    static final String PREFIX = "email";

    private String msg;

    private final List<String> tos = new ArrayList<>();

    /**
     * Constructor.
     * @param context
     * @param instruction
     * @param line
     */
    EmailCommandInstruction(Context context, String instruction, int line) {
        super(context, instruction, line);
        Pattern p = Pattern.compile(PREFIX + "\\s+(.*)\\s*with\\s+(.*)", Pattern.CASE_INSENSITIVE);
        Matcher m = p.matcher(instruction);
        if (m.matches()) {
            this.syntaxicallyCorrect = true;
            this.tos.addAll(Utils.splitNicely(m.group(1), ","));
            this.msg = m.group(2).trim().replace("\\n", "\n");
        }
    }

    /*
	 * (non-Javadoc)
	 * @see net.roboconf.core.commands.AbstractCommandInstruction#doValidate()
	 */
    @Override
    public List<ParsingError> doValidate() {
        List<ParsingError> result = new ArrayList<>();
        if (Utils.isEmptyOrWhitespaces(this.msg))
            result.add(error(ErrorCode.CMD_EMAIL_NO_MESSAGE));
        return res

    }

    /**
     * @return the msg
     */
    public String getMsg() {
        return this.msg;
    }

    /**
     * @return the tos
     */
    public List<String> getTos() {
        return this.tos;
    }
}


public List<String> getTos() {
        return this.tos;
    }

/**
 * The present code is developed in the scope of the joint LINAGORA -
 * Université Joseph Fourier - Floralis research program and is designated
 * as a "Result" pursuant to the terms and conditions of the LINAGORA
 * - Université Joseph Fourier - Floralis research program. Each copyright
 * holder of Results enumerated here above fully & independently holds complete
 */
package net.roboconf.core.commands;

import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import net.roboconf.core.errors.ErrorCode;
import net.roboconf.core.model.ParsingError;
import net.roboconf.core.utils.Utils;

/**
 * @author Vincent Zurczak - Linagora
 */
public class EmailCommandInstruction extends AbstractCommandInstruction {

    static final String PREFIX = "email";

    private String msg;

    private final List<String> tos = new ArrayList<>();

    /**
     * Constructor.
     * @param context
     * @param instruction
     * @param line
     */
    EmailCommandInstruction(Context context, String instruction, int line) {
        super(context, instruction, line);
        Pattern p = Pattern.compile(PREFIX + "\\s+(.*)\\s*with\\s+(.*)", Pattern.CASE_INSENSITIVE);
        Matcher m = p.matcher(instruction);
        if (m.matches()) {
            this.syntaxicallyCorrect = true;
            this.tos.addAll(Utils.splitNicely(m.group(1), ","));
            this.msg = m.group(2).trim().replace("\\n", "\n");
        }
    }

    /*
	 * (non-Javadoc)
	 * @see net.roboconf.core.commands.AbstractCommandInstruction#doValidate()
	 */
    @Override
    public List<ParsingError> doValidate() {
        List<ParsingError> result = new ArrayList<>();
        if (Utils.isEmptyOrWhitespaces(this.msg))
            result.add(error(ErrorCode.CMD_EMAIL_NO_MESSAGE));
        return result;
    }

    /**
     * @return the msg
     */
    public String getMsg() {
        return this.msg;
    }

    /**
     * @return the tos
     */


public static void waitUntil(Supplier<Boolean> condition, int timeout, int interval) throws TimeoutException, InterruptedException

package org.bonitasoft.studio.tests.util;

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Supplier;

public class Await {

{
        var countDownLatch = new CountDownLatch(1);
        var shouldExitThread = new AtomicBoolean();
        shouldExitThread.set(false);
        new Thread(() -> {
            var result = false;
            while (!result && !shouldExitThread.get()) {
                result = condition.get();
                try {
                    Thread.sleep(interval);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
            if (result) {
                countDownLatch.countDown();
            }
        }, "Wait condition thread").start();
        if (!countDownLatch.await(timeout, TimeUnit.MILLISECONDS)) {
            shouldExitThread.set(true);
            throw new TimeoutException(String.format("Failed to evaluate condtion after %sms", timeout));
        }
    }
}


package org.bonitasoft.studio.tests.util;

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Supplier;

public class Await {

    public static void waitUntil(Supplier<Boolean> condition, int timeout, int interval) throws TimeoutException, InterruptedException {
        var countDownLatch = new CountDownLatch(1);
        var shouldExitThread = new Atomi

        shouldExitThread.set(false);
        new Thread(() -> {
            var result = false;
            while (!result && !shouldExitThread.get()) {
                result = condition.get();
                try {
                    Thread.sleep(interval);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
            if (result) {
                countDownLatch.countDown();
            }
        }, "Wait condition thread").start();
        if (!countDownLatch.await(timeout, TimeUnit.MILLISECONDS)) {
            shouldExitThread.set(true);
            throw new TimeoutException(String.format("Failed to evaluate condtion after %sms", timeout));
        }
    }
}


while (!result && !shouldExitThread.get()) {
                result = condition.get();
                try {
                    Thread.sleep(interval);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }

package org.bonitasoft.studio.tests.util;

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Supplier;

public class Await {

    public static void waitUntil(Supplier<Boolean> condition, int timeout, int interval) throws TimeoutException, InterruptedException {
        var countDownLatch = new CountDownLatch(1);
        var shouldExitThread = new AtomicBoolean();
        shouldExitThread.set(false);
        new Thread(() -> {
            var result = false;

            if (result) {
                countDownLatch.countDown();
            }
        }, "Wait condition thread").start();
        if (!countDownLatch.await(timeout, TimeUnit.MILLISECONDS)) {
            shouldExitThread.set(true);
            throw new TimeoutException(String.format("Failed to evaluate condtion after %sms", timeout));
        }
    }
}


try {
                    Thread.sleep(interval);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }

package org.bonitasoft.studio.tests.util;

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Supplier;

public class Await {

    public static void waitUntil(Supplier<Boolean> condition, int timeout, int interval) throws TimeoutException, InterruptedException {
        var countDownLatch = new CountDownLatch(1);
        var shouldExitThread = new AtomicBoolean();
        shouldExitThread.set(false);
        new Thread(() -> {
            var result = false;
            while (!result && !shouldExitThread.get()) {
                result = condition.get();

            }
            if (result) {
                countDownLatch.countDown();
            }
        }, "Wait condition thread").start();
        if (!countDownLatch.await(timeout, TimeUnit.MILLISECONDS)) {
            shouldExitThread.set(true);
            throw new TimeoutException(String.format("Failed to evaluate condtion after %sms", timeout));
        }
    }
}


package com.alibaba.nacos.config.server.service.merge;

import com.alibaba.nacos.config.server.manager.TaskManager;
import com.alibaba.nacos.config.server.model.ConfigInfo;
import com.alibaba.nacos.config.server.model.ConfigInfoAggr;
import com.alibaba.nacos.config.server.model.ConfigInfoChanged;
import com.alibaba.nacos.config.server.model.Page;
import com.alibaba.nacos.config.server.service.PersistService;
import com.alibaba.nacos.config.server.utils.ContentUtils;
import com.alibaba.nacos.config.server.utils.TimeUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import static com.alibaba.nacos.core.utils.SystemUtils.LOCAL_IP;

/**
 * 数据聚合服务。
 * <p>
 * 启动时做全量聚合 + 修改数据触发的单条聚合
 *
 * @author jiuRen
 */
@Service
public class MergeDatumService {

    private PersistService persistService;

    static final int INIT_THREAD_COUNT = 40;

    static final AtomicInteger FINISHED = new AtomicInteger();

    static int total = 0;

    @Autowired
    public MergeDatumService(PersistService persistService) {
        this.persistService = persistService;
        mergeTasks = new TaskManager("com.alibaba.nacos.MergeDatum");
        mergeTasks.setDefaultTaskProcessor(new MergeTaskProcessor(persistService, this));
    }

    static List<List<ConfigInfoChanged>> splitList(List<ConfigInfoChanged> list, int count) {
        List<List<ConfigInfoChanged>> result = new ArrayList<List<ConfigInfoChanged>>(count);
        for (int i = 0; i < count; i++) {
            result.add(new ArrayList<ConfigInfoChanged>());
        }
        for (int i = 0; i < list.size(); i++) {
            ConfigInfoChanged config = list.get(i);
            result.get(i % count).add(config);
        }
        return result;
    }

    /**
     * 数据变更后调用，添加聚合任务
     */
    public void addMergeTask(String dataId, String groupId, String tenant, String tag, String clientIp) {
        MergeDataTask task = new MergeDataTask(dataId, groupId, tenant, tag, clientIp);
        mergeTasks.addTask(task.getId(), task);
    }

    /**
     * 数据变更后调用，添加聚合任务
     */
    public void addMergeTask(String dataId, String groupId, String tenant, String clientIp) {
        MergeDataTask task = new MergeDataTask(dataId, groupId, tenant, clientIp);
        mergeTasks.addTask(task.getId(), task);
    }

{
        for (ConfigInfoChanged item : persistService.findAllAggrGroup()) {
            addMergeTask(item.getDataId(), item.getGroup(), item.getTenant(), LOCAL_IP);
        }
    }

    class MergeAllDataWorker extends Thread {

        static final int PAGE_SIZE = 10000;

        private List<ConfigInfoChanged> configInfoList;

        public MergeAllDataWorker(List<ConfigInfoChanged> configInfoList) {
            super("MergeAllDataWorker");
            this.configInfoList = configInfoList;
        }

        @Override
        public void run() {
            for (ConfigInfoChanged configInfo : configInfoList) {
                String dataId = configInfo.getDataId();
                String group = configInfo.getGroup();
                String tenant = configInfo.getTenant();
                try {
                    List<ConfigInfoAggr> datumList = new ArrayList<ConfigInfoAggr>();
                    int rowCount = persistService.aggrConfigInfoCount(dataId, group, tenant);
                    int pageCount = (int) Math.ceil(rowCount * 1.0 / PAGE_SIZE);
                    for (int pageNo = 1; pageNo <= pageCount; pageNo++) {
                        Page<ConfigInfoAggr> page = persistService.findConfigInfoAggrByPage(dataId, group, tenant, pageNo, PAGE_SIZE);
                        if (page != null) {
                            datumList.addAll(page.getPageItems());
                            log.info("[merge-query] {}, {}, size/total={}/{}", dataId, group, datumList.size(), rowCount);
                        }
                    }
                    final Timestamp time = TimeUtils.getCurrentTime();
                    // 聚合
                    if (datumList.size() > 0) {
                        ConfigInfo cf = MergeTaskProcessor.merge(dataId, group, tenant, datumList);
                        persistService.insertOrUpdate(null, null, cf, time, null, false);
                        log.info("[merge-ok] {}, {}, size={}, length={}, md5={}, content={}", dataId, group, datumList.size(), cf.getContent().length(), cf.getMd5(), ContentUtils.truncateContent(cf.getContent()));
                    } else // 删除
                    {
                        persistService.removeConfigInfo(dataId, group, tenant, LOCAL_IP, null);
                        log.warn("[merge-delete] delete config info because no datum. dataId=" + dataId + ", groupId=" + group);
                    }
                } catch (Exception e) {
                    log.info("[merge-error] " + dataId + ", " + group + ", " + e.toString(), e);
                }
                FINISHED.incrementAndGet();
                if (FINISHED.get() % 100 == 0) {
                    log.info("[all-merge-dump] {} / {}", FINISHED.get(), total);
                }
            }
            log.info("[all-merge-dump] {} / {}", FINISHED.get(), total);
        }
    }

    private static final Logger log = LoggerFactory.getLogger(MergeDatumService.class);

    final TaskManager mergeTasks;
}


{
        MergeDataTask task = new MergeDataTask(dataId, groupId, tenant, clientIp);
        mergeTasks.addTask(task.getId(), task);
    }

package com.alibaba.nacos.config.server.service.merge;

import com.alibaba.nacos.config.server.manager.TaskManager;
import com.alibaba.nacos.config.server.model.ConfigInfo;
import com.alibaba.nacos.config.server.model.ConfigInfoAggr;
import com.alibaba.nacos.config.server.model.ConfigInfoChanged;
import com.alibaba.nacos.config.server.model.Page;
import com.alibaba.nacos.config.server.service.PersistService;
import com.alibaba.nacos.config.server.utils.ContentUtils;
import com.alibaba.nacos.config.server.utils.TimeUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import static com.alibaba.nacos.core.utils.SystemUtils.LOCAL_IP;

/**
 * 数据聚合服务。
 * <p>
 * 启动时做全量聚合 + 修改数据触发的单条聚合
 *
 * @author jiuRen
 */
@Service
public class MergeDatumService {

    private PersistService persistService;

    static final int INIT_THREAD_COUNT = 40;

    static final AtomicInteger FINISHED = new AtomicInteger();

    static int total = 0;

    @Autowired
    public MergeDatumService(PersistService persistService) {
        this.persistService = persistService;
        mergeTasks = new TaskManager("com.alibaba.nacos.MergeDatum");
        mergeTasks.setDefaultTaskProcessor(new MergeTaskProcessor(persistService, this));
    }

    static List<List<ConfigInfoChanged>> splitList(List<ConfigInfoChanged> list, int count) {
        List<List<ConfigInfoChanged>> result = new ArrayList<List<ConfigInfoChanged>>(count);
        for (int i = 0; i < count; i++) {
            result.add(new ArrayList<ConfigInfoChanged>());
        }
        for (int i = 0; i < list.size(); i++) {
            ConfigInfoChanged config = list.get(i);
            result.get(i % count).add(config);
        }
        return result;
    }

    /**
     * 数据变更后调用，添加聚合任务
     */
    public void addMergeTask(String dataId, String groupId, String tenant, String tag, String clientIp) {
        MergeDataTask task = new MergeDataTask(dataId, groupId, tenant, tag, clientIp);
        mergeTasks.addTask(task.getId(), task);
    }

    /**
     * 数据变更后调用，添加聚合任务
     */
    public void addMergeTask(String dataId, String groupId, String tenant, String clientIp)

    public void mergeAll() {
        for (ConfigInfoChanged item : persistService.findAllAggrGroup()) {
            addMergeTask(item.getDataId(), item.getGroup(), item.getTenant(), LOCAL_IP);
        }
    }

    class MergeAllDataWorker extends Thread {

        static final int PAGE_SIZE = 10000;

        private List<ConfigInfoChanged> configInfoList;

        public MergeAllDataWorker(List<ConfigInfoChanged> configInfoList) {
            super("MergeAllDataWorker");
            this.configInfoList = configInfoList;
        }

        @Override
        public void run() {
            for (ConfigInfoChanged configInfo : configInfoList) {
                String dataId = configInfo.getDataId();
                String group = configInfo.getGroup();
                String tenant = configInfo.getTenant();
                try {
                    List<ConfigInfoAggr> datumList = new ArrayList<ConfigInfoAggr>();
                    int rowCount = persistService.aggrConfigInfoCount(dataId, group, tenant);
                    int pageCount = (int) Math.ceil(rowCount * 1.0 / PAGE_SIZE);
                    for (int pageNo = 1; pageNo <= pageCount; pageNo++) {
                        Page<ConfigInfoAggr> page = persistService.findConfigInfoAggrByPage(dataId, group, tenant, pageNo, PAGE_SIZE);
                        if (page != null) {
                            datumList.addAll(page.getPageItems());
                            log.info("[merge-query] {}, {}, size/total={}/{}", dataId, group, datumList.size(), rowCount);
                        }
                    }
                    final Timestamp time = TimeUtils.getCurrentTime();
                    // 聚合
                    if (datumList.size() > 0) {
                        ConfigInfo cf = MergeTaskProcessor.merge(dataId, group, tenant, datumList);
                        persistService.insertOrUpdate(null, null, cf, time, null, false);
                        log.info("[merge-ok] {}, {}, size={}, length={}, md5={}, content={}", dataId, group, datumList.size(), cf.getContent().length(), cf.getMd5(), ContentUtils.truncateContent(cf.getContent()));
                    } else // 删除
                    {
                        persistService.removeConfigInfo(dataId, group, tenant, LOCAL_IP, null);
                        log.warn("[merge-delete] delete config info because no datum. dataId=" + dataId + ", groupId=" + group);
                    }
                } catch (Exception e) {
                    log.info("[merge-error] " + dataId + ", " + group + ", " + e.toString(), e);
                }
                FINISHED.incrementAndGet();
                if (FINISHED.get() % 100 == 0) {
                    log.info("[all-merge-dump] {} / {}", FINISHED.get(), total);
                }
            }
            log.info("[all-merge-dump] {} / {}", FINISHED.get(), total);
        }
    }

    private static final Logger log = LoggerFactory.getLogger(MergeDatumService.class);

    final TaskManager mergeTasks;
}


result = new ArrayList<List<ConfigInfoChanged>>(count);

package com.alibaba.nacos.config.server.service.merge;

import com.alibaba.nacos.config.server.manager.TaskManager;
import com.alibaba.nacos.config.server.model.ConfigInfo;
import com.alibaba.nacos.config.server.model.ConfigInfoAggr;
import com.alibaba.nacos.config.server.model.ConfigInfoChanged;
import com.alibaba.nacos.config.server.model.Page;
import com.alibaba.nacos.config.server.service.PersistService;
import com.alibaba.nacos.config.server.utils.ContentUtils;
import com.alibaba.nacos.config.server.utils.TimeUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import static com.alibaba.nacos.core.utils.SystemUtils.LOCAL_IP;

/**
 * 数据聚合服务。
 * <p>
 * 启动时做全量聚合 + 修改数据触发的单条聚合
 *
 * @author jiuRen
 */
@Service
public class MergeDatumService {

    private PersistService persistService;

    static final int INIT_THREAD_COUNT = 40;

    static final AtomicInteger FINISHED = new AtomicInteger();

    static int total = 0;

    @Autowired
    public MergeDatumService(PersistService persistService) {
        this.persistService = persistService;
        mergeTasks = new TaskManager("com.alibaba.nacos.MergeDatum");
        mergeTasks.setDefaultTaskProcessor(new MergeTaskProcessor(persistService, this));
    }

    static List<List<ConfigInfoChanged>> splitList(List<ConfigInfoChanged> list, int count) {
        List<List<ConfigInfoChanged>>

        for (int i = 0; i < count; i++) {
            result.add(new ArrayList<ConfigInfoChanged>());
        }
        for (int i = 0; i < list.size(); i++) {
            ConfigInfoChanged config = list.get(i);
            result.get(i % count).add(config);
        }
        return result;
    }

    /**
     * 数据变更后调用，添加聚合任务
     */
    public void addMergeTask(String dataId, String groupId, String tenant, String tag, String clientIp) {
        MergeDataTask task = new MergeDataTask(dataId, groupId, tenant, tag, clientIp);
        mergeTasks.addTask(task.getId(), task);
    }

    /**
     * 数据变更后调用，添加聚合任务
     */
    public void addMergeTask(String dataId, String groupId, String tenant, String clientIp) {
        MergeDataTask task = new MergeDataTask(dataId, groupId, tenant, clientIp);
        mergeTasks.addTask(task.getId(), task);
    }

    public void mergeAll() {
        for (ConfigInfoChanged item : persistService.findAllAggrGroup()) {
            addMergeTask(item.getDataId(), item.getGroup(), item.getTenant(), LOCAL_IP);
        }
    }

    class MergeAllDataWorker extends Thread {

        static final int PAGE_SIZE = 10000;

        private List<ConfigInfoChanged> configInfoList;

        public MergeAllDataWorker(List<ConfigInfoChanged> configInfoList) {
            super("MergeAllDataWorker");
            this.configInfoList = configInfoList;
        }

        @Override
        public void run() {
            for (ConfigInfoChanged configInfo : configInfoList) {
                String dataId = configInfo.getDataId();
                String group = configInfo.getGroup();
                String tenant = configInfo.getTenant();
                try {
                    List<ConfigInfoAggr> datumList = new ArrayList<ConfigInfoAggr>();
                    int rowCount = persistService.aggrConfigInfoCount(dataId, group, tenant);
                    int pageCount = (int) Math.ceil(rowCount * 1.0 / PAGE_SIZE);
                    for (int pageNo = 1; pageNo <= pageCount; pageNo++) {
                        Page<ConfigInfoAggr> page = persistService.findConfigInfoAggrByPage(dataId, group, tenant, pageNo, PAGE_SIZE);
                        if (page != null) {
                            datumList.addAll(page.getPageItems());
                            log.info("[merge-query] {}, {}, size/total={}/{}", dataId, group, datumList.size(), rowCount);
                        }
                    }
                    final Timestamp time = TimeUtils.getCurrentTime();
                    // 聚合
                    if (datumList.size() > 0) {
                        ConfigInfo cf = MergeTaskProcessor.merge(dataId, group, tenant, datumList);
                        persistService.insertOrUpdate(null, null, cf, time, null, false);
                        log.info("[merge-ok] {}, {}, size={}, length={}, md5={}, content={}", dataId, group, datumList.size(), cf.getContent().length(), cf.getMd5(), ContentUtils.truncateContent(cf.getContent()));
                    } else // 删除
                    {
                        persistService.removeConfigInfo(dataId, group, tenant, LOCAL_IP, null);
                        log.warn("[merge-delete] delete config info because no datum. dataId=" + dataId + ", groupId=" + group);
                    }
                } catch (Exception e) {
                    log.info("[merge-error] " + dataId + ", " + group + ", " + e.toString(), e);
                }
                FINISHED.incrementAndGet();
                if (FINISHED.get() % 100 == 0) {
                    log.info("[all-merge-dump] {} / {}", FINISHED.get(), total);
                }
            }
            log.info("[all-merge-dump] {} / {}", FINISHED.get(), total);
        }
    }

    private static final Logger log = LoggerFactory.getLogger(MergeDatumService.class);

    final TaskManager mergeTasks;
}


public void addMergeTask(String dataId, String groupId, String tenant, String clientIp) {
        MergeDataTask task = new MergeDataTask(dataId, groupId, tenant, clientIp);
        mergeTasks.addTask(task.getId(), task);
    }

package com.alibaba.nacos.config.server.service.merge;

import com.alibaba.nacos.config.server.manager.TaskManager;
import com.alibaba.nacos.config.server.model.ConfigInfo;
import com.alibaba.nacos.config.server.model.ConfigInfoAggr;
import com.alibaba.nacos.config.server.model.ConfigInfoChanged;
import com.alibaba.nacos.config.server.model.Page;
import com.alibaba.nacos.config.server.service.PersistService;
import com.alibaba.nacos.config.server.utils.ContentUtils;
import com.alibaba.nacos.config.server.utils.TimeUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import static com.alibaba.nacos.core.utils.SystemUtils.LOCAL_IP;

/**
 * 数据聚合服务。
 * <p>
 * 启动时做全量聚合 + 修改数据触发的单条聚合
 *
 * @author jiuRen
 */
@Service
public class MergeDatumService {

    private PersistService persistService;

    static final int INIT_THREAD_COUNT = 40;

    static final AtomicInteger FINISHED = new AtomicInteger();

    static int total = 0;

    @Autowired
    public MergeDatumService(PersistService persistService) {
        this.persistService = persistService;
        mergeTasks = new TaskManager("com.alibaba.nacos.MergeDatum");
        mergeTasks.setDefaultTaskProcessor(new MergeTaskProcessor(persistService, this));
    }

    static List<List<ConfigInfoChanged>> splitList(List<ConfigInfoChanged> list, int count) {
        List<List<ConfigInfoChanged>> result = new ArrayList<List<ConfigInfoChanged>>(count);
        for (int i = 0; i < count; i++) {
            result.add(new ArrayList<ConfigInfoChanged>());
        }
        for (int i = 0; i < list.size(); i++) {
            ConfigInfoChanged config = list.get(i);
            result.get(i % count).add(config);
        }
        return result;
    }

    /**
     * 数据变更后调用，添加聚合任务
     */
    public void addMergeTask(String dataId, String groupId, String tenant, String tag, String clientIp) {
        MergeDataTask task = new MergeDataTask(dataId, groupId, tenant, tag, clientIp);
        mergeTasks.addTask(task.getId(), task);
    }

    /**
     * 数据变更后调用，添加聚合任务
     */


for (int pageNo = 1; pageNo <= pageCount; pageNo++) {
                        Page<ConfigInfoAggr> page = persistService.findConfigInfoAggrByPage(dataId, group, tenant, pageNo, PAGE_SIZE);
                        if (page != null) {
                            datumList.addAll(page.getPageItems());
                            log.info("[merge-query] {}, {}, size/total={}/{}", dataId, group, datumList.size(), rowCount);
                        }
                    }

package com.alibaba.nacos.config.server.service.merge;

import com.alibaba.nacos.config.server.manager.TaskManager;
import com.alibaba.nacos.config.server.model.ConfigInfo;
import com.alibaba.nacos.config.server.model.ConfigInfoAggr;
import com.alibaba.nacos.config.server.model.ConfigInfoChanged;
import com.alibaba.nacos.config.server.model.Page;
import com.alibaba.nacos.config.server.service.PersistService;
import com.alibaba.nacos.config.server.utils.ContentUtils;
import com.alibaba.nacos.config.server.utils.TimeUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import static com.alibaba.nacos.core.utils.SystemUtils.LOCAL_IP;

/**
 * 数据聚合服务。
 * <p>
 * 启动时做全量聚合 + 修改数据触发的单条聚合
 *
 * @author jiuRen
 */
@Service
public class MergeDatumService {

    private PersistService persistService;

    static final int INIT_THREAD_COUNT = 40;

    static final AtomicInteger FINISHED = new AtomicInteger();

    static int total = 0;

    @Autowired
    public MergeDatumService(PersistService persistService) {
        this.persistService = persistService;
        mergeTasks = new TaskManager("com.alibaba.nacos.MergeDatum");
        mergeTasks.setDefaultTaskProcessor(new MergeTaskProcessor(persistService, this));
    }

    static List<List<ConfigInfoChanged>> splitList(List<ConfigInfoChanged> list, int count) {
        List<List<ConfigInfoChanged>> result = new ArrayList<List<ConfigInfoChanged>>(count);
        for (int i = 0; i < count; i++) {
            result.add(new ArrayList<ConfigInfoChanged>());
        }
        for (int i = 0; i < list.size(); i++) {
            ConfigInfoChanged config = list.get(i);
            result.get(i % count).add(config);
        }
        return result;
    }

    /**
     * 数据变更后调用，添加聚合任务
     */
    public void addMergeTask(String dataId, String groupId, String tenant, String tag, String clientIp) {
        MergeDataTask task = new MergeDataTask(dataId, groupId, tenant, tag, clientIp);
        mergeTasks.addTask(task.getId(), task);
    }

    /**
     * 数据变更后调用，添加聚合任务
     */
    public void addMergeTask(String dataId, String groupId, String tenant, String clientIp) {
        MergeDataTask task = new MergeDataTask(dataId, groupId, tenant, clientIp);
        mergeTasks.addTask(task.getId(), task);
    }

    public void mergeAll() {
        for (ConfigInfoChanged item : persistService.findAllAggrGroup()) {
            addMergeTask(item.getDataId(), item.getGroup(), item.getTenant(), LOCAL_IP);
        }
    }

    class MergeAllDataWorker extends Thread {

        static final int PAGE_SIZE = 10000;

        private List<ConfigInfoChanged> configInfoList;

        public MergeAllDataWorker(List<ConfigInfoChanged> configInfoList) {
            super("MergeAllDataWorker");
            this.configInfoList = configInfoList;
        }

        @Override
        public void run() {
            for (ConfigInfoChanged configInfo : configInfoList) {
                String dataId = configInfo.getDataId();
                String group = configInfo.getGroup();
                String tenant = configInfo.getTenant();
                try {
                    List<ConfigInfoAggr> datumList = new ArrayList<ConfigInfoAggr>();
                    int rowCount = persistService.aggrConfigInfoCount(dataId, group, tenant);
                    int pageCount = (int) Math.ceil(rowCount * 1.0 / PAGE_SIZE);

                    final Timestamp time = TimeUtils.getCurrentTime();
                    // 聚合
                    if (datumList.size() > 0) {
                        ConfigInfo cf = MergeTaskProcessor.merge(dataId, group, tenant, datumList);
                        persistService.insertOrUpdate(null, null, cf, time, null, false);
                        log.info("[merge-ok] {}, {}, size={}, length={}, md5={}, content={}", dataId, group, datumList.size(), cf.getContent().length(), cf.getMd5(), ContentUtils.truncateContent(cf.getContent()));
                    } else // 删除
                    {
                        persistService.removeConfigInfo(dataId, group, tenant, LOCAL_IP, null);
                        log.warn("[merge-delete] delete config info because no datum. dataId=" + dataId + ", groupId=" + group);
                    }
                } catch (Exception e) {
                    log.info("[merge-error] " + dataId + ", " + group + ", " + e.toString(), e);
                }
                FINISHED.incrementAndGet();
                if (FINISHED.get() % 100 == 0) {
                    log.info("[all-merge-dump] {} / {}", FINISHED.get(), total);
                }
            }
            log.info("[all-merge-dump] {} / {}", FINISHED.get(), total);
        }
    }

    private static final Logger log = LoggerFactory.getLogger(MergeDatumService.class);

    final TaskManager mergeTasks;
}


package org.iplass.mtp.impl.tenant.web;

import org.codehaus.groovy.GroovyBugError;
import org.iplass.mtp.command.RequestContext;
import org.iplass.mtp.impl.core.ExecuteContext;
import org.iplass.mtp.impl.core.TenantContext;
import org.iplass.mtp.impl.metadata.MetaData;
import org.iplass.mtp.impl.script.Script;
import org.iplass.mtp.impl.script.ScriptContext;
import org.iplass.mtp.impl.script.ScriptEngine;
import org.iplass.mtp.impl.tenant.MetaTenant.MetaTenantHandler;
import org.iplass.mtp.impl.tenant.MetaTenantConfig;
import org.iplass.mtp.impl.util.ObjectUtil;
import org.iplass.mtp.tenant.Tenant;
import org.iplass.mtp.tenant.web.TenantWebInfo;
import org.iplass.mtp.util.StringUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class MetaTenantWebInfo extends MetaTenantConfig<TenantWebInfo> {

    private static final long serialVersionUID = -8722898685664541128L;

    private static final Logger logger = LoggerFactory.getLogger(MetaTenantWebInfo.class);

    private boolean usePreview;

    private String loginUrlSelector;

    /**
     * 再認証URLセレクター
     */
    private String reAuthUrlSelector;

    private String errorUrlSelector;

    /**
     * HOMEのURL
     */
    private String homeUrl;

    private String urlForRequest;

    public MetaTenantWebInfo() {
    }

    public boolean isUsePreview() {
        return usePreview;
    }

    public void setUsePreview(boolean usePreview) {
        this.usePreview = usePreview;
    }

    public String getLoginUrlSelector() {
        return loginUrlSelector;
    }

    public void setLoginUrlSelector(String loginUrlSelector) {
        this.loginUrlSelector = loginUrlSelector;
    }

    public String getReAuthUrlSelector() {
        return reAuthUrlSelector;
    }

    public void setReAuthUrlSelector(String reAuthUrlSelector) {
        this.reAuthUrlSelector = reAuthUrlSelector;
    }

    public String getErrorUrlSelector() {
        return errorUrlSelector;
    }

    public void setErrorUrlSelector(String errorUrlSelector) {
        this.errorUrlSelector = errorUrlSelector;
    }

{
        this.homeUrl = homeUrl;
    }

    public String getHomeUrl() {
        return homeUrl;
    }

    public String getUrlForRequest() {
        return urlForRequest;
    }

    public void setUrlForRequest(String urlForRequest) {
        this.urlForRequest = urlForRequest;
    }

    @Override
    public MetaData copy() {
        return ObjectUtil.deepCopy(this);
    }

    @Override
    public void applyConfig(TenantWebInfo definition) {
        setUsePreview(definition.isUsePreview());
        setLoginUrlSelector(definition.getLoginUrlSelector());
        setReAuthUrlSelector(definition.getReAuthUrlSelector());
        setErrorUrlSelector(definition.getErrorUrlSelector());
        setHomeUrl(definition.getHomeUrl());
        setUrlForRequest(definition.getUrlForRequest());
    }

    @Override
    public TenantWebInfo currentConfig() {
        TenantWebInfo definition = new TenantWebInfo();
        definition.setUsePreview(usePreview);
        definition.setLoginUrlSelector(loginUrlSelector);
        definition.setReAuthUrlSelector(reAuthUrlSelector);
        definition.setErrorUrlSelector(errorUrlSelector);
        definition.setHomeUrl(getHomeUrl());
        definition.setUrlForRequest(getUrlForRequest());
        return definition;
    }

    @Override
    public MetaTenantWebInfoRuntime createRuntime(MetaTenantHandler tenantRuntime) {
        return new MetaTenantWebInfoRuntime(tenantRuntime);
    }

    public class MetaTenantWebInfoRuntime extends MetaTenantConfigRuntime {

        private static final String SCRIPT_PREFIX_LOGIN_URL_SELECTOR = "MetaTenantHandler_loginUrlSelector";

        private static final String SCRIPT_PREFIX_REAUTH_URL_SELECTOR = "MetaTenantHandler_reAuthUrlSelector";

        private static final String SCRIPT_PREFIX_ERROR_URL_SELECTOR = "MetaTenantHandler_errorUrlSelector";

        private Script loginUrlSelectorScript;

        private Script reAuthUrlSelectorScript;

        private Script errorUrlSelectorScript;

        public MetaTenantWebInfoRuntime(MetaTenantHandler tenantRuntime) {
            TenantContext tc = ExecuteContext.getCurrentContext().getTenantContext();
            ScriptEngine scriptEngine = tc.getScriptEngine();
            try {
                if (!StringUtil.isEmpty(loginUrlSelector)) {
                    loginUrlSelectorScript = scriptEngine.createScript(loginUrlSelector, SCRIPT_PREFIX_LOGIN_URL_SELECTOR + "_" + tenantRuntime.getMetaData().getId());
                }
                // 再認証URLセレクター
                if (!StringUtil.isEmpty(reAuthUrlSelector)) {
                    reAuthUrlSelectorScript = scriptEngine.createScript(reAuthUrlSelector, SCRIPT_PREFIX_REAUTH_URL_SELECTOR + "_" + tenantRuntime.getMetaData().getId());
                }
                if (!StringUtil.isEmpty(errorUrlSelector)) {
                    errorUrlSelectorScript = scriptEngine.createScript(errorUrlSelector, SCRIPT_PREFIX_ERROR_URL_SELECTOR + "_" + tenantRuntime.getMetaData().getId());
                }
            } catch (GroovyBugError | NoClassDefFoundError e) {
                setIllegalStateException(new RuntimeException(e));
            } catch (RuntimeException e) {
                setIllegalStateException(e);
            }
        }

        @Override
        public MetaData getMetaData() {
            return MetaTenantWebInfo.this;
        }

        @Override
        public void applyMetaDataToTenant(Tenant tenant) {
        }

        public String loginUrlSelector(RequestContext context, String path) {
            if (loginUrlSelectorScript == null) {
                return null;
            } else {
                ScriptContext sc = ExecuteContext.getCurrentContext().getTenantContext().getScriptEngine().newScriptContext();
                sc.setAttribute("request", context);
                sc.setAttribute("path", path);
                Object res = null;
                try {
                    res = loginUrlSelectorScript.eval(sc);
                } catch (RuntimeException e) {
                    logger.error("fail on LoginUrlSelector: " + e.getMessage(), e);
                }
                if (res == null) {
                    return null;
                } else {
                    return res.toString();
                }
            }
        }

        public String reAuthUrlSelector(RequestContext context, String path) {
            if (reAuthUrlSelectorScript == null) {
                return null;
            } else {
                ScriptContext sc = ExecuteContext.getCurrentContext().getTenantContext().getScriptEngine().newScriptContext();
                sc.setAttribute("request", context);
                sc.setAttribute("path", path);
                Object res = null;
                try {
                    res = reAuthUrlSelectorScript.eval(sc);
                } catch (RuntimeException e) {
                    logger.error("fail on ReAuthUrlSelector: " + e.getMessage(), e);
                }
                if (res == null) {
                    return null;
                } else {
                    return res.toString();
                }
            }
        }

        public String errorUrlSelector(Throwable exp, RequestContext context, String path) {
            if (errorUrlSelectorScript == null) {
                return null;
            } else {
                ScriptContext sc = ExecuteContext.getCurrentContext().getTenantContext().getScriptEngine().newScriptContext();
                sc.setAttribute("request", context);
                sc.setAttribute("path", path);
                sc.setAttribute("exception", exp);
                Object res = null;
                try {
                    res = errorUrlSelectorScript.eval(sc);
                } catch (RuntimeException e) {
                    logger.error("fail on ErrorUrlSelectorScript: " + e.getMessage(), e);
                }
                if (res == null) {
                    return null;
                } else {
                    return res.toString();
                }
            }
        }
    }
}


{
        this.usePreview = usePreview;
    }

package org.iplass.mtp.impl.tenant.web;

import org.codehaus.groovy.GroovyBugError;
import org.iplass.mtp.command.RequestContext;
import org.iplass.mtp.impl.core.ExecuteContext;
import org.iplass.mtp.impl.core.TenantContext;
import org.iplass.mtp.impl.metadata.MetaData;
import org.iplass.mtp.impl.script.Script;
import org.iplass.mtp.impl.script.ScriptContext;
import org.iplass.mtp.impl.script.ScriptEngine;
import org.iplass.mtp.impl.tenant.MetaTenant.MetaTenantHandler;
import org.iplass.mtp.impl.tenant.MetaTenantConfig;
import org.iplass.mtp.impl.util.ObjectUtil;
import org.iplass.mtp.tenant.Tenant;
import org.iplass.mtp.tenant.web.TenantWebInfo;
import org.iplass.mtp.util.StringUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class MetaTenantWebInfo extends MetaTenantConfig<TenantWebInfo> {

    private static final long serialVersionUID = -8722898685664541128L;

    private static final Logger logger = LoggerFactory.getLogger(MetaTenantWebInfo.class);

    private boolean usePreview;

    private String loginUrlSelector;

    /**
     * 再認証URLセレクター
     */
    private String reAuthUrlSelector;

    private String errorUrlSelector;

    /**
     * HOMEのURL
     */
    private String homeUrl;

    private String urlForRequest;

    public MetaTenantWebInfo() {
    }

    public boolean isUsePreview() {
        return usePreview;
    }

    public void setUsePreview(boolean usePreview)

    public String getLoginUrlSelector() {
        return loginUrlSelector;
    }

    public void setLoginUrlSelector(String loginUrlSelector) {
        this.loginUrlSelector = loginUrlSelector;
    }

    public String getReAuthUrlSelector() {
        return reAuthUrlSelector;
    }

    public void setReAuthUrlSelector(String reAuthUrlSelector) {
        this.reAuthUrlSelector = reAuthUrlSelector;
    }

    public String getErrorUrlSelector() {
        return errorUrlSelector;
    }

    public void setErrorUrlSelector(String errorUrlSelector) {
        this.errorUrlSelector = errorUrlSelector;
    }

    public void setHomeUrl(String homeUrl) {
        this.homeUrl = homeUrl;
    }

    public String getHomeUrl() {
        return homeUrl;
    }

    public String getUrlForRequest() {
        return urlForRequest;
    }

    public void setUrlForRequest(String urlForRequest) {
        this.urlForRequest = urlForRequest;
    }

    @Override
    public MetaData copy() {
        return ObjectUtil.deepCopy(this);
    }

    @Override
    public void applyConfig(TenantWebInfo definition) {
        setUsePreview(definition.isUsePreview());
        setLoginUrlSelector(definition.getLoginUrlSelector());
        setReAuthUrlSelector(definition.getReAuthUrlSelector());
        setErrorUrlSelector(definition.getErrorUrlSelector());
        setHomeUrl(definition.getHomeUrl());
        setUrlForRequest(definition.getUrlForRequest());
    }

    @Override
    public TenantWebInfo currentConfig() {
        TenantWebInfo definition = new TenantWebInfo();
        definition.setUsePreview(usePreview);
        definition.setLoginUrlSelector(loginUrlSelector);
        definition.setReAuthUrlSelector(reAuthUrlSelector);
        definition.setErrorUrlSelector(errorUrlSelector);
        definition.setHomeUrl(getHomeUrl());
        definition.setUrlForRequest(getUrlForRequest());
        return definition;
    }

    @Override
    public MetaTenantWebInfoRuntime createRuntime(MetaTenantHandler tenantRuntime) {
        return new MetaTenantWebInfoRuntime(tenantRuntime);
    }

    public class MetaTenantWebInfoRuntime extends MetaTenantConfigRuntime {

        private static final String SCRIPT_PREFIX_LOGIN_URL_SELECTOR = "MetaTenantHandler_loginUrlSelector";

        private static final String SCRIPT_PREFIX_REAUTH_URL_SELECTOR = "MetaTenantHandler_reAuthUrlSelector";

        private static final String SCRIPT_PREFIX_ERROR_URL_SELECTOR = "MetaTenantHandler_errorUrlSelector";

        private Script loginUrlSelectorScript;

        private Script reAuthUrlSelectorScript;

        private Script errorUrlSelectorScript;

        public MetaTenantWebInfoRuntime(MetaTenantHandler tenantRuntime) {
            TenantContext tc = ExecuteContext.getCurrentContext().getTenantContext();
            ScriptEngine scriptEngine = tc.getScriptEngine();
            try {
                if (!StringUtil.isEmpty(loginUrlSelector)) {
                    loginUrlSelectorScript = scriptEngine.createScript(loginUrlSelector, SCRIPT_PREFIX_LOGIN_URL_SELECTOR + "_" + tenantRuntime.getMetaData().getId());
                }
                // 再認証URLセレクター
                if (!StringUtil.isEmpty(reAuthUrlSelector)) {
                    reAuthUrlSelectorScript = scriptEngine.createScript(reAuthUrlSelector, SCRIPT_PREFIX_REAUTH_URL_SELECTOR + "_" + tenantRuntime.getMetaData().getId());
                }
                if (!StringUtil.isEmpty(errorUrlSelector)) {
                    errorUrlSelectorScript = scriptEngine.createScript(errorUrlSelector, SCRIPT_PREFIX_ERROR_URL_SELECTOR + "_" + tenantRuntime.getMetaData().getId());
                }
            } catch (GroovyBugError | NoClassDefFoundError e) {
                setIllegalStateException(new RuntimeException(e));
            } catch (RuntimeException e) {
                setIllegalStateException(e);
            }
        }

        @Override
        public MetaData getMetaData() {
            return MetaTenantWebInfo.this;
        }

        @Override
        public void applyMetaDataToTenant(Tenant tenant) {
        }

        public String loginUrlSelector(RequestContext context, String path) {
            if (loginUrlSelectorScript == null) {
                return null;
            } else {
                ScriptContext sc = ExecuteContext.getCurrentContext().getTenantContext().getScriptEngine().newScriptContext();
                sc.setAttribute("request", context);
                sc.setAttribute("path", path);
                Object res = null;
                try {
                    res = loginUrlSelectorScript.eval(sc);
                } catch (RuntimeException e) {
                    logger.error("fail on LoginUrlSelector: " + e.getMessage(), e);
                }
                if (res == null) {
                    return null;
                } else {
                    return res.toString();
                }
            }
        }

        public String reAuthUrlSelector(RequestContext context, String path) {
            if (reAuthUrlSelectorScript == null) {
                return null;
            } else {
                ScriptContext sc = ExecuteContext.getCurrentContext().getTenantContext().getScriptEngine().newScriptContext();
                sc.setAttribute("request", context);
                sc.setAttribute("path", path);
                Object res = null;
                try {
                    res = reAuthUrlSelectorScript.eval(sc);
                } catch (RuntimeException e) {
                    logger.error("fail on ReAuthUrlSelector: " + e.getMessage(), e);
                }
                if (res == null) {
                    return null;
                } else {
                    return res.toString();
                }
            }
        }

        public String errorUrlSelector(Throwable exp, RequestContext context, String path) {
            if (errorUrlSelectorScript == null) {
                return null;
            } else {
                ScriptContext sc = ExecuteContext.getCurrentContext().getTenantContext().getScriptEngine().newScriptContext();
                sc.setAttribute("request", context);
                sc.setAttribute("path", path);
                sc.setAttribute("exception", exp);
                Object res = null;
                try {
                    res = errorUrlSelectorScript.eval(sc);
                } catch (RuntimeException e) {
                    logger.error("fail on ErrorUrlSelectorScript: " + e.getMessage(), e);
                }
                if (res == null) {
                    return null;
                } else {
                    return res.toString();
                }
            }
        }
    }
}


package org.iplass.mtp.impl.tenant.web;

import org.codehaus.groovy.GroovyBugError;
import org.iplass.mtp.command.RequestContext;
import org.iplass.mtp.impl.core.ExecuteContext;
import org.iplass.mtp.impl.core.TenantContext;
import org.iplass.mtp.impl.metadata.MetaData;
import org.iplass.mtp.impl.script.Script;
import org.iplass.mtp.impl.script.ScriptContext;
import org.iplass.mtp.impl.script.ScriptEngine;
import org.iplass.mtp.impl.tenant.MetaTenant.MetaTenantHandler;
import org.iplass.mtp.impl.tenant.MetaTenantConfig;
import org.iplass.mtp.impl.util.ObjectUtil;
import org.iplass.mtp.tenant.Tenant;
import org.iplass.mtp.tenant.web.TenantWebInfo;
import org.iplass.mtp.util.StringUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class MetaTenantWebInfo extends MetaTenantConfig<TenantWebInfo> {

    private static final long serialVersionUID = -8722898685664541128L;

    private static final Logger logger = LoggerFactory.getLogger(MetaTenantWebInfo.class);

    private boolean usePreview;

    private String loginUrlSelector;

    /**
     * 再認証URLセレクター
     */
    private String reAuthUrlSelector;

    private String errorUrlSelector;

    /**
     * HOMEのURL
     */
    private String homeUrl;

    private String urlForRequest;

    public MetaTenantWebInfo() {
    }

    public boolean isUsePreview() {
        return usePreview;
    }

    public void setUsePreview(boolean usePreview) {
        this.usePreview = usePreview;
    }

    public String getLoginUrlSelector() {
        return loginUrlSelector;
    }

    public void setLoginUrlSelector(String loginUrlSelector) {
        this.loginUrlSelector = loginUrlSelector;
    }

    public String getReAuthUrlSelector() {
        return reAuthUrlSelector;
    }

    public void setReAuthUrlSelector(String reAuthUrlSelector) {
        this.reAuthUrlSelector = reAuthUrlSelector;
    }

    public String getErrorUrlSelector() {
        return errorUrlSelector;
    }

    public void setErrorUrlSelector(String errorUrlSelector) {
        this.errorUrlSelector = errorUrlSelector;
    }

    public void setHomeUrl(String homeUrl) {
        this.homeUrl = homeUrl;
    }

    public String getHomeUrl() {
        return homeUrl;
    }

    public String getUrlForRequest() {
        return urlForReq

    }

    public void setUrlForRequest(String urlForRequest) {
        this.urlForRequest = urlForRequest;
    }

    @Override
    public MetaData copy() {
        return ObjectUtil.deepCopy(this);
    }

    @Override
    public void applyConfig(TenantWebInfo definition) {
        setUsePreview(definition.isUsePreview());
        setLoginUrlSelector(definition.getLoginUrlSelector());
        setReAuthUrlSelector(definition.getReAuthUrlSelector());
        setErrorUrlSelector(definition.getErrorUrlSelector());
        setHomeUrl(definition.getHomeUrl());
        setUrlForRequest(definition.getUrlForRequest());
    }

    @Override
    public TenantWebInfo currentConfig() {
        TenantWebInfo definition = new TenantWebInfo();
        definition.setUsePreview(usePreview);
        definition.setLoginUrlSelector(loginUrlSelector);
        definition.setReAuthUrlSelector(reAuthUrlSelector);
        definition.setErrorUrlSelector(errorUrlSelector);
        definition.setHomeUrl(getHomeUrl());
        definition.setUrlForRequest(getUrlForRequest());
        return definition;
    }

    @Override
    public MetaTenantWebInfoRuntime createRuntime(MetaTenantHandler tenantRuntime) {
        return new MetaTenantWebInfoRuntime(tenantRuntime);
    }

    public class MetaTenantWebInfoRuntime extends MetaTenantConfigRuntime {

        private static final String SCRIPT_PREFIX_LOGIN_URL_SELECTOR = "MetaTenantHandler_loginUrlSelector";

        private static final String SCRIPT_PREFIX_REAUTH_URL_SELECTOR = "MetaTenantHandler_reAuthUrlSelector";

        private static final String SCRIPT_PREFIX_ERROR_URL_SELECTOR = "MetaTenantHandler_errorUrlSelector";

        private Script loginUrlSelectorScript;

        private Script reAuthUrlSelectorScript;

        private Script errorUrlSelectorScript;

        public MetaTenantWebInfoRuntime(MetaTenantHandler tenantRuntime) {
            TenantContext tc = ExecuteContext.getCurrentContext().getTenantContext();
            ScriptEngine scriptEngine = tc.getScriptEngine();
            try {
                if (!StringUtil.isEmpty(loginUrlSelector)) {
                    loginUrlSelectorScript = scriptEngine.createScript(loginUrlSelector, SCRIPT_PREFIX_LOGIN_URL_SELECTOR + "_" + tenantRuntime.getMetaData().getId());
                }
                // 再認証URLセレクター
                if (!StringUtil.isEmpty(reAuthUrlSelector)) {
                    reAuthUrlSelectorScript = scriptEngine.createScript(reAuthUrlSelector, SCRIPT_PREFIX_REAUTH_URL_SELECTOR + "_" + tenantRuntime.getMetaData().getId());
                }
                if (!StringUtil.isEmpty(errorUrlSelector)) {
                    errorUrlSelectorScript = scriptEngine.createScript(errorUrlSelector, SCRIPT_PREFIX_ERROR_URL_SELECTOR + "_" + tenantRuntime.getMetaData().getId());
                }
            } catch (GroovyBugError | NoClassDefFoundError e) {
                setIllegalStateException(new RuntimeException(e));
            } catch (RuntimeException e) {
                setIllegalStateException(e);
            }
        }

        @Override
        public MetaData getMetaData() {
            return MetaTenantWebInfo.this;
        }

        @Override
        public void applyMetaDataToTenant(Tenant tenant) {
        }

        public String loginUrlSelector(RequestContext context, String path) {
            if (loginUrlSelectorScript == null) {
                return null;
            } else {
                ScriptContext sc = ExecuteContext.getCurrentContext().getTenantContext().getScriptEngine().newScriptContext();
                sc.setAttribute("request", context);
                sc.setAttribute("path", path);
                Object res = null;
                try {
                    res = loginUrlSelectorScript.eval(sc);
                } catch (RuntimeException e) {
                    logger.error("fail on LoginUrlSelector: " + e.getMessage(), e);
                }
                if (res == null) {
                    return null;
                } else {
                    return res.toString();
                }
            }
        }

        public String reAuthUrlSelector(RequestContext context, String path) {
            if (reAuthUrlSelectorScript == null) {
                return null;
            } else {
                ScriptContext sc = ExecuteContext.getCurrentContext().getTenantContext().getScriptEngine().newScriptContext();
                sc.setAttribute("request", context);
                sc.setAttribute("path", path);
                Object res = null;
                try {
                    res = reAuthUrlSelectorScript.eval(sc);
                } catch (RuntimeException e) {
                    logger.error("fail on ReAuthUrlSelector: " + e.getMessage(), e);
                }
                if (res == null) {
                    return null;
                } else {
                    return res.toString();
                }
            }
        }

        public String errorUrlSelector(Throwable exp, RequestContext context, String path) {
            if (errorUrlSelectorScript == null) {
                return null;
            } else {
                ScriptContext sc = ExecuteContext.getCurrentContext().getTenantContext().getScriptEngine().newScriptContext();
                sc.setAttribute("request", context);
                sc.setAttribute("path", path);
                sc.setAttribute("exception", exp);
                Object res = null;
                try {
                    res = errorUrlSelectorScript.eval(sc);
                } catch (RuntimeException e) {
                    logger.error("fail on ErrorUrlSelectorScript: " + e.getMessage(), e);
                }
                if (res == null) {
                    return null;
                } else {
                    return res.toString();
                }
            }
        }
    }
}


try {
                    res = errorUrlSelectorScript.eval(sc);
                } catch (RuntimeException e) {
                    logger.error("fail on ErrorUrlSelectorScript: " + e.getMessage(), e);
                }

package org.iplass.mtp.impl.tenant.web;

import org.codehaus.groovy.GroovyBugError;
import org.iplass.mtp.command.RequestContext;
import org.iplass.mtp.impl.core.ExecuteContext;
import org.iplass.mtp.impl.core.TenantContext;
import org.iplass.mtp.impl.metadata.MetaData;
import org.iplass.mtp.impl.script.Script;
import org.iplass.mtp.impl.script.ScriptContext;
import org.iplass.mtp.impl.script.ScriptEngine;
import org.iplass.mtp.impl.tenant.MetaTenant.MetaTenantHandler;
import org.iplass.mtp.impl.tenant.MetaTenantConfig;
import org.iplass.mtp.impl.util.ObjectUtil;
import org.iplass.mtp.tenant.Tenant;
import org.iplass.mtp.tenant.web.TenantWebInfo;
import org.iplass.mtp.util.StringUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class MetaTenantWebInfo extends MetaTenantConfig<TenantWebInfo> {

    private static final long serialVersionUID = -8722898685664541128L;

    private static final Logger logger = LoggerFactory.getLogger(MetaTenantWebInfo.class);

    private boolean usePreview;

    private String loginUrlSelector;

    /**
     * 再認証URLセレクター
     */
    private String reAuthUrlSelector;

    private String errorUrlSelector;

    /**
     * HOMEのURL
     */
    private String homeUrl;

    private String urlForRequest;

    public MetaTenantWebInfo() {
    }

    public boolean isUsePreview() {
        return usePreview;
    }

    public void setUsePreview(boolean usePreview) {
        this.usePreview = usePreview;
    }

    public String getLoginUrlSelector() {
        return loginUrlSelector;
    }

    public void setLoginUrlSelector(String loginUrlSelector) {
        this.loginUrlSelector = loginUrlSelector;
    }

    public String getReAuthUrlSelector() {
        return reAuthUrlSelector;
    }

    public void setReAuthUrlSelector(String reAuthUrlSelector) {
        this.reAuthUrlSelector = reAuthUrlSelector;
    }

    public String getErrorUrlSelector() {
        return errorUrlSelector;
    }

    public void setErrorUrlSelector(String errorUrlSelector) {
        this.errorUrlSelector = errorUrlSelector;
    }

    public void setHomeUrl(String homeUrl) {
        this.homeUrl = homeUrl;
    }

    public String getHomeUrl() {
        return homeUrl;
    }

    public String getUrlForRequest() {
        return urlForRequest;
    }

    public void setUrlForRequest(String urlForRequest) {
        this.urlForRequest = urlForRequest;
    }

    @Override
    public MetaData copy() {
        return ObjectUtil.deepCopy(this);
    }

    @Override
    public void applyConfig(TenantWebInfo definition) {
        setUsePreview(definition.isUsePreview());
        setLoginUrlSelector(definition.getLoginUrlSelector());
        setReAuthUrlSelector(definition.getReAuthUrlSelector());
        setErrorUrlSelector(definition.getErrorUrlSelector());
        setHomeUrl(definition.getHomeUrl());
        setUrlForRequest(definition.getUrlForRequest());
    }

    @Override
    public TenantWebInfo currentConfig() {
        TenantWebInfo definition = new TenantWebInfo();
        definition.setUsePreview(usePreview);
        definition.setLoginUrlSelector(loginUrlSelector);
        definition.setReAuthUrlSelector(reAuthUrlSelector);
        definition.setErrorUrlSelector(errorUrlSelector);
        definition.setHomeUrl(getHomeUrl());
        definition.setUrlForRequest(getUrlForRequest());
        return definition;
    }

    @Override
    public MetaTenantWebInfoRuntime createRuntime(MetaTenantHandler tenantRuntime) {
        return new MetaTenantWebInfoRuntime(tenantRuntime);
    }

    public class MetaTenantWebInfoRuntime extends MetaTenantConfigRuntime {

        private static final String SCRIPT_PREFIX_LOGIN_URL_SELECTOR = "MetaTenantHandler_loginUrlSelector";

        private static final String SCRIPT_PREFIX_REAUTH_URL_SELECTOR = "MetaTenantHandler_reAuthUrlSelector";

        private static final String SCRIPT_PREFIX_ERROR_URL_SELECTOR = "MetaTenantHandler_errorUrlSelector";

        private Script loginUrlSelectorScript;

        private Script reAuthUrlSelectorScript;

        private Script errorUrlSelectorScript;

        public MetaTenantWebInfoRuntime(MetaTenantHandler tenantRuntime) {
            TenantContext tc = ExecuteContext.getCurrentContext().getTenantContext();
            ScriptEngine scriptEngine = tc.getScriptEngine();
            try {
                if (!StringUtil.isEmpty(loginUrlSelector)) {
                    loginUrlSelectorScript = scriptEngine.createScript(loginUrlSelector, SCRIPT_PREFIX_LOGIN_URL_SELECTOR + "_" + tenantRuntime.getMetaData().getId());
                }
                // 再認証URLセレクター
                if (!StringUtil.isEmpty(reAuthUrlSelector)) {
                    reAuthUrlSelectorScript = scriptEngine.createScript(reAuthUrlSelector, SCRIPT_PREFIX_REAUTH_URL_SELECTOR + "_" + tenantRuntime.getMetaData().getId());
                }
                if (!StringUtil.isEmpty(errorUrlSelector)) {
                    errorUrlSelectorScript = scriptEngine.createScript(errorUrlSelector, SCRIPT_PREFIX_ERROR_URL_SELECTOR + "_" + tenantRuntime.getMetaData().getId());
                }
            } catch (GroovyBugError | NoClassDefFoundError e) {
                setIllegalStateException(new RuntimeException(e));
            } catch (RuntimeException e) {
                setIllegalStateException(e);
            }
        }

        @Override
        public MetaData getMetaData() {
            return MetaTenantWebInfo.this;
        }

        @Override
        public void applyMetaDataToTenant(Tenant tenant) {
        }

        public String loginUrlSelector(RequestContext context, String path) {
            if (loginUrlSelectorScript == null) {
                return null;
            } else {
                ScriptContext sc = ExecuteContext.getCurrentContext().getTenantContext().getScriptEngine().newScriptContext();
                sc.setAttribute("request", context);
                sc.setAttribute("path", path);
                Object res = null;
                try {
                    res = loginUrlSelectorScript.eval(sc);
                } catch (RuntimeException e) {
                    logger.error("fail on LoginUrlSelector: " + e.getMessage(), e);
                }
                if (res == null) {
                    return null;
                } else {
                    return res.toString();
                }
            }
        }

        public String reAuthUrlSelector(RequestContext context, String path) {
            if (reAuthUrlSelectorScript == null) {
                return null;
            } else {
                ScriptContext sc = ExecuteContext.getCurrentContext().getTenantContext().getScriptEngine().newScriptContext();
                sc.setAttribute("request", context);
                sc.setAttribute("path", path);
                Object res = null;
                try {
                    res = reAuthUrlSelectorScript.eval(sc);
                } catch (RuntimeException e) {
                    logger.error("fail on ReAuthUrlSelector: " + e.getMessage(), e);
                }
                if (res == null) {
                    return null;
                } else {
                    return res.toString();
                }
            }
        }

        public String errorUrlSelector(Throwable exp, RequestContext context, String path) {
            if (errorUrlSelectorScript == null) {
                return null;
            } else {
                ScriptContext sc = ExecuteContext.getCurrentContext().getTenantContext().getScriptEngine().newScriptContext();
                sc.setAttribute("request", context);
                sc.setAttribute("path", path);
                sc.setAttribute("exception", exp);
                Object res = null;

                if (res == null) {
                    return null;
                } else {
                    return res.toString();
                }
            }
        }
    }
}


public static void setCallBackSizeChangeWhenLayerUpdate(TextureView view, boolean doCallBack)

package com.color.inner.view;

import android.util.Log;
import android.view.OppoBaseTextureView;
import android.view.TextureView;
import com.color.util.ColorTypeCastingHelper;

public class TextureViewWrapper {

    private static final String TAG = "TextureViewWrapper";

{
        try {
            typeCasting(view).setCallBackSizeChangeWhenLayerUpdate(doCallBack);
        } catch (Exception e) {
            Log.e(TAG, e.toString());
        }
    }

    private static OppoBaseTextureView typeCasting(TextureView textureView) {
        return (OppoBaseTextureView) ColorTypeCastingHelper.typeCasting(OppoBaseTextureView.class, textureView);
    }
}