当前位置: 首页>>代码示例>>Java>>正文


Java HttpUnitOptions.setExceptionsThrownOnScriptError方法代码示例

本文整理汇总了Java中com.meterware.httpunit.HttpUnitOptions.setExceptionsThrownOnScriptError方法的典型用法代码示例。如果您正苦于以下问题:Java HttpUnitOptions.setExceptionsThrownOnScriptError方法的具体用法?Java HttpUnitOptions.setExceptionsThrownOnScriptError怎么用?Java HttpUnitOptions.setExceptionsThrownOnScriptError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.meterware.httpunit.HttpUnitOptions的用法示例。


在下文中一共展示了HttpUnitOptions.setExceptionsThrownOnScriptError方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testPing

import com.meterware.httpunit.HttpUnitOptions; //导入方法依赖的package包/类
/**
 * Test ping().
 */
@Test
public void testPing() {

    Server server = null;
    String dataDir = "data-test-ping1";

    try {
        String host = "localhost";
        int port = 18983;
        // start Solr
        server = SimpleAnuenueInstanceFactory.createSolrInstance(port,
                dataDir, NODE_CONF_FILE);
        HttpUnitOptions.setExceptionsThrownOnScriptError(false);

        SolrClient client = new SolrClient(host, port);
        client.ping();

    } catch (Exception e) {
        fail();
    } finally {
        AnuenueTestUtil.stopServerQuietly(server);
        assertTrue(FileUtils.deleteQuietly(new File(dataDir)));
    }
}
 
开发者ID:haruyama,项目名称:Anuenue,代码行数:28,代码来源:TestSolrClient.java

示例2: testBrowseCatalog

import com.meterware.httpunit.HttpUnitOptions; //导入方法依赖的package包/类
public void testBrowseCatalog() throws Exception {
    try {
        // Disable scripting support until HttpUnit has better support for AJAX, Dojo...
        HttpUnitOptions.setScriptingEnabled(false);
        HttpUnitOptions.setExceptionsThrownOnScriptError(false);
        
        // Start with the home page
        WebConversation wc = new WebConversation();
        WebRequest req = new GetMethodWebRequest("http://" + serverHost + ":" + serverPort + "/" + context);
        WebResponse resp = wc.getResponse(req);
        
        testMainPage(wc, resp);
        testSellerPage(wc, resp);
        testSearchPage(wc, resp);
        testCatalogPage(wc, resp);
        testMapPage(wc, resp);
        testTagsPage(wc, resp);
    } catch (ConnectException e) {
        StringWriter sw = new StringWriter();
        PrintWriter pw = new PrintWriter(sw);
        e.printStackTrace(pw);
        fail("Could not connect to the server. Received Exception: \n" + sw.toString());
    }
}
 
开发者ID:sugar-lang,项目名称:case-studies,代码行数:25,代码来源:PetStoreWebBlackBoxTest.java

示例3: testInvalidInput

import com.meterware.httpunit.HttpUnitOptions; //导入方法依赖的package包/类
/**
 * Test of adding file including invalid line.
 */
@Test
public void testInvalidInput() {

    Server server = null;
    String dataDir = "data-test-invalid-input";

    try {
        int port = 18983;

        server = SimpleAnuenueInstanceFactory.createSolrInstance(port, dataDir, NODE_CONF_FILE);

        HttpUnitOptions.setExceptionsThrownOnScriptError(false);
        assertSame("initial size", 0, AnuenueTestUtil.getNumberOfIndexedDocumentViaLocalhostSolr(port));

        NodeDatabase database = new NodeDatabaseBuilder("resources/anuenue-nodes-single.xml").build();

        AnuenueDistCommandFactory.createDistCommand("addDir", "resources/example-failure-docs", database).execute();
        assertSame("addDir, before commit", 0, AnuenueTestUtil.getNumberOfIndexedDocumentViaLocalhostSolr(port));
        AnuenueDistCommandFactory.createDistCommand("commit", "", database).execute();
        assertSame("addDir and commit", 2, AnuenueTestUtil.getNumberOfIndexedDocumentViaLocalhostSolr(port));

    } catch (Exception e) {
        fail();
    } finally {
        AnuenueTestUtil.stopServerQuietly(server);
        assertTrue(FileUtils.deleteQuietly(new File(dataDir)));
    }
}
 
开发者ID:haruyama,项目名称:Anuenue,代码行数:32,代码来源:TestAnuenueDistCommands.java

示例4: setExceptionsThrownOnScriptError

import com.meterware.httpunit.HttpUnitOptions; //导入方法依赖的package包/类
/**
 * Determines whether script errors result in exceptions or warning messages.
 */
public void setExceptionsThrownOnScriptError(String throwExceptions) {
	HttpUnitOptions.setExceptionsThrownOnScriptError(Boolean.getBoolean(throwExceptions));
}
 
开发者ID:Amsoft-Systems,项目名称:xmltestsuiteR12,代码行数:7,代码来源:BrowserResource.java

示例5: testRunWithTargets

import com.meterware.httpunit.HttpUnitOptions; //导入方法依赖的package包/类
/**
 * Test of Anuenue distribution command indicating target node.
 */
@Test
public void testRunWithTargets() {

    Server server1 = null;
    Server server2 = null;
    String dataDir1 = "data-test-dist-targets1";
    String dataDir2 = "data-test-dist-targets2";

    try {

        /** role: merger, master, slave */
        int port1 = 18070;
        server1 = SimpleAnuenueInstanceFactory.createSolrInstance(port1, dataDir1, NODE_CONF_FILE);
        HttpUnitOptions.setExceptionsThrownOnScriptError(false);
        assertSame("initial size", 0, AnuenueTestUtil.getNumberOfIndexedDocumentViaLocalhostSolr(port1));

        /** role: merger, master, slave */
        int port2 = 17070;
        server2 = SimpleAnuenueInstanceFactory.createSolrInstance(port2, dataDir2, NODE_CONF_FILE);
        HttpUnitOptions.setExceptionsThrownOnScriptError(false);
        assertSame("initial size", 0, AnuenueTestUtil.getNumberOfIndexedDocumentViaLocalhostSolr(port2));

        NodeDatabase database = new NodeDatabaseBuilder("resources/anuenue-nodes-disttest.xml").build();

        AbstractDistCommand command = AnuenueDistCommandFactory.createDistCommand("node1", "addDir", "resources/example-docs", database);
        command.setMaxLinePerFile(2);
        command.execute();
        assertSame("addDir, before commit", 0, AnuenueTestUtil.getNumberOfIndexedDocumentViaLocalhostSolr(port1));
        assertSame("addDir, before commit. nothing changed", 0, AnuenueTestUtil.getNumberOfIndexedDocumentViaLocalhostSolr(port2));
        AnuenueDistCommandFactory.createDistCommand("commit", "", database).execute();
        assertSame("addDir and commit", 9, AnuenueTestUtil.getNumberOfIndexedDocumentViaLocalhostSolr(port1));
        assertSame("addDir and commit. nothing changed", 0, AnuenueTestUtil.getNumberOfIndexedDocumentViaLocalhostSolr(port2));
        AnuenueDistCommandFactory.createDistCommand("delete", "*:*", database).execute();
        assertSame("delete, before commit", 9, AnuenueTestUtil.getNumberOfIndexedDocumentViaLocalhostSolr(port1));
        assertSame("delete, before commit. nothing changed", 0, AnuenueTestUtil.getNumberOfIndexedDocumentViaLocalhostSolr(port2));
        AnuenueDistCommandFactory.createDistCommand("commit", "", database).execute();
        assertSame("delete and commit", 0, AnuenueTestUtil.getNumberOfIndexedDocumentViaLocalhostSolr(port1));
        assertSame("delete and commit. nothing changed", 0, AnuenueTestUtil.getNumberOfIndexedDocumentViaLocalhostSolr(port2));
    } catch (Exception e) {
        fail();
    } finally {
        AnuenueTestUtil.stopServerQuietly(server1);
        AnuenueTestUtil.stopServerQuietly(server2);

        assertTrue(FileUtils.deleteQuietly(new File(dataDir1)));
        assertTrue(FileUtils.deleteQuietly(new File(dataDir2)));
    }
}
 
开发者ID:haruyama,项目名称:Anuenue,代码行数:52,代码来源:TestAnuenueDistCommands.java

示例6: testUpdateTSVData

import com.meterware.httpunit.HttpUnitOptions; //导入方法依赖的package包/类
/**
 * Test updateTsvData().
 */
@Test
public void testUpdateTSVData() {

    Server server = null;
    String dataDir = "data-test-updater1";

    try {
        String host = "localhost";
        int port = 18983;

        // start Solr
        server = SimpleAnuenueInstanceFactory.createSolrInstance(port,
                dataDir, NODE_CONF_FILE);
        HttpUnitOptions.setExceptionsThrownOnScriptError(false);
        assertSame(0, AnuenueTestUtil.getNumberOfIndexedDocumentViaSolr(host, port));

        // post a TSV data
        SolrClient client = new SolrClient(host, port);
        client.updateTSVData("blogid\tauthor\tgenre\tcontent\n"
                + "39209\tTakahiko Ito\tHadoop\tI like Hadoop.\n"
                + "4783\tTaro Gihu\tHadoop\tI also like Hadoop.\n");

        assertSame(0, AnuenueTestUtil.getNumberOfIndexedDocumentViaSolr(host, port));
        client.updateXML(XML_COMMIT);
        assertSame(2, AnuenueTestUtil.getNumberOfIndexedDocumentViaSolr(host, port));

        client.updateTSVData("blogid\tauthor\tgenre\tcontent\n"
                + "1\tTakahiko Ito\tHad\"oop\tI like Hadoop.\n"
                + "2\tTa\"ro Gi\"hu\t\"Hadoop\"\tI also like Hado\"op.\n");
        assertSame(2, AnuenueTestUtil.getNumberOfIndexedDocumentViaSolr(host, port));
        client.updateXML(XML_COMMIT);
        assertSame(4, AnuenueTestUtil.getNumberOfIndexedDocumentViaSolr(host, port));

    } catch (Exception e) {
        fail();
    } finally {
        AnuenueTestUtil.stopServerQuietly(server);
        assertTrue(FileUtils.deleteQuietly(new File(dataDir)));
    }
}
 
开发者ID:haruyama,项目名称:Anuenue,代码行数:44,代码来源:TestSolrClient.java

示例7: testUpdateTSVFile

import com.meterware.httpunit.HttpUnitOptions; //导入方法依赖的package包/类
/**
 * Test updateTSVFile().
 */
@Test
public void testUpdateTSVFile() {

    Server server = null;
    String dataDir = "data-test-updater2";

    try {
        String host = "localhost";
        int port = 18983;
        // start Solr
        server = SimpleAnuenueInstanceFactory.createSolrInstance(port,
                dataDir, NODE_CONF_FILE);
        HttpUnitOptions.setExceptionsThrownOnScriptError(false);
        assertSame(0, AnuenueTestUtil.getNumberOfIndexedDocumentViaSolr(host, port));

        // post a TSV file
        SolrClient client = new SolrClient(host, port);
        client.updateTSVFile(new File(
                "resources/example-docs/add-sample01.txt"));

        assertSame(0, AnuenueTestUtil.getNumberOfIndexedDocumentViaSolr(host, port));
        client.updateXML(XML_COMMIT);
        assertSame(3, AnuenueTestUtil.getNumberOfIndexedDocumentViaSolr(host, port));

        // post another TSV file
        client.updateTSVFile(new File(
                "resources/example-docs/add-sample02.txt"));
        assertSame(3, AnuenueTestUtil.getNumberOfIndexedDocumentViaSolr(host, port));
        client.updateXML(XML_COMMIT);
        assertSame(6, AnuenueTestUtil.getNumberOfIndexedDocumentViaSolr(host, port));

        // encapsulator
        client.updateTSVFile(new File(
                "resources/example-encapsulator-docs/add-sample04.txt"));
        assertSame(6, AnuenueTestUtil.getNumberOfIndexedDocumentViaSolr(host, port));
        client.updateXML(XML_COMMIT);
        assertSame(13, AnuenueTestUtil.getNumberOfIndexedDocumentViaSolr(host, port));


    } catch (Exception e) {
        fail();
    } finally {
        AnuenueTestUtil.stopServerQuietly(server);
        assertTrue(FileUtils.deleteQuietly(new File(dataDir)));
    }
}
 
开发者ID:haruyama,项目名称:Anuenue,代码行数:50,代码来源:TestSolrClient.java

示例8: testCreateCommand

import com.meterware.httpunit.HttpUnitOptions; //导入方法依赖的package包/类
/**
 * Test of createCommand().
 */
@Test
public void testCreateCommand() {

    /** location of anuenue-nodes.xml file for the testing. */
    String clusterConfFile = "resources/anuenue-nodes-single.xml";

    String dataDir = "data-test-command";
    String host = "localhost";
    int port = 18983;

    Server server = null;

    try {

        // start Solr
        server = SimpleAnuenueInstanceFactory.createSolrInstance(port,
                dataDir, clusterConfFile);
        HttpUnitOptions.setExceptionsThrownOnScriptError(false);
        // create AnuenueCommands
        // run commands (post file, commit, optimize)
        AnuenueCommandFactory.createCommand(host, port, "addFile",
                "resources/example-docs/add-sample01.txt").runCommand();
        assertSame(0, AnuenueTestUtil.getNumberOfIndexedDocumentViaSolr(host, port));
        AnuenueCommandFactory.createCommand(host, port, "commit", null)
                .runCommand();
        assertSame(3, AnuenueTestUtil.getNumberOfIndexedDocumentViaSolr(host, port));
        AnuenueCommandFactory.createCommand(host, port, "addFile",
                "resources/example-docs/add-sample02.txt").runCommand();
        assertSame(3, AnuenueTestUtil.getNumberOfIndexedDocumentViaSolr(host, port));
        AnuenueCommandFactory.createCommand(host, port, "softcommit", null)
                .runCommand();
        assertSame(6, AnuenueTestUtil.getNumberOfIndexedDocumentViaSolr(host, port));
        AnuenueCommandFactory.createCommand(host, port, "delete",
                "blogid:39209").runCommand();
        assertSame(6, AnuenueTestUtil.getNumberOfIndexedDocumentViaSolr(host, port));
        AnuenueCommandFactory.createCommand(host, port, "commit", null)
                .runCommand();
        assertSame(5, AnuenueTestUtil.getNumberOfIndexedDocumentViaSolr(host, port));
        AnuenueCommandFactory.createCommand(host, port, "deleteAll", null)
                .runCommand();
        assertSame(5, AnuenueTestUtil.getNumberOfIndexedDocumentViaSolr(host, port));
        AnuenueCommandFactory.createCommand(host, port, "commit", null)
                .runCommand();
        assertSame(0, AnuenueTestUtil.getNumberOfIndexedDocumentViaSolr(host, port));
        AnuenueCommandFactory.createCommand(host, port, "ping", null)
                .runCommand();

    } catch (Exception e) {
        fail();
    } finally {
        // stop Solr
        AnuenueTestUtil.stopServerQuietly(server);
        assertTrue(FileUtils.deleteQuietly(new File(dataDir)));
    }

}
 
开发者ID:haruyama,项目名称:Anuenue,代码行数:60,代码来源:TestAnuenueCommandFactory.java

示例9: testCreateCommand2

import com.meterware.httpunit.HttpUnitOptions; //导入方法依赖的package包/类
/**
 * Test of createCommand() part2.
 */
@Test
public void testCreateCommand2() {

    /** location of anuenue-nodes.xml file for the testing. */
    String clusterConfFile = "resources/anuenue-nodes-single.xml";

    String dataDir = "data-test-command";
    String host = "localhost";
    int port = 18983;

    Server server = null;

    try {

        // start Solr
        server = SimpleAnuenueInstanceFactory.createSolrInstance(port,
                dataDir, clusterConfFile);
        HttpUnitOptions.setExceptionsThrownOnScriptError(false);
        // create AnuenueCommands
        // run commands (post file, commit, optimize)
        AnuenueCommandFactory.createCommand(host, port, "addData",
                FileUtils.readFileToString(new File("resources/example-docs/add-sample01.txt"))).runCommand();
        assertSame(0, AnuenueTestUtil.getNumberOfIndexedDocumentViaSolr(host, port));
        AnuenueCommandFactory.createCommand(host, port, "commit", null)
                .runCommand();
        assertSame(3, AnuenueTestUtil.getNumberOfIndexedDocumentViaSolr(host, port));
        AnuenueCommandFactory.createCommand(host, port, "addData",
                FileUtils.readFileToString(new File("resources/example-docs/add-sample02.txt"))).runCommand();
        assertSame(3, AnuenueTestUtil.getNumberOfIndexedDocumentViaSolr(host, port));
        AnuenueCommandFactory.createCommand(host, port, "softcommit", null)
                .runCommand();
        assertSame(6, AnuenueTestUtil.getNumberOfIndexedDocumentViaSolr(host, port));
        AnuenueCommandFactory.createCommand(host, port, "delete",
                "blogid:39209").runCommand();
        assertSame(6, AnuenueTestUtil.getNumberOfIndexedDocumentViaSolr(host, port));
        AnuenueCommandFactory.createCommand(host, port, "commit", null)
                .runCommand();
        assertSame(5, AnuenueTestUtil.getNumberOfIndexedDocumentViaSolr(host, port));
        AnuenueCommandFactory.createCommand(host, port, "deleteAll", null)
                .runCommand();
        assertSame(5, AnuenueTestUtil.getNumberOfIndexedDocumentViaSolr(host, port));
        AnuenueCommandFactory.createCommand(host, port, "commit", null)
                .runCommand();
        assertSame(0, AnuenueTestUtil.getNumberOfIndexedDocumentViaSolr(host, port));
        AnuenueCommandFactory.createCommand(host, port, "ping", null)
                .runCommand();

    } catch (Exception e) {
        e.printStackTrace();
        fail();
    } finally {
        // stop Solr
        AnuenueTestUtil.stopServerQuietly(server);
        assertTrue(FileUtils.deleteQuietly(new File(dataDir)));
    }

}
 
开发者ID:haruyama,项目名称:Anuenue,代码行数:61,代码来源:TestAnuenueCommandFactory.java


注:本文中的com.meterware.httpunit.HttpUnitOptions.setExceptionsThrownOnScriptError方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。