在远程服务器上进行Arquillian测试

时间:2014-10-16 10:44:02

标签: java testing jboss7.x jboss-arquillian

我想在远程服务器上测试我的war文件,但它无法正常工作并给我错误:

sun.net.www.protocol.http.HttpURLConnection$HttpInputStream cannot be cast to com.itextpdf.text.pdf.codec.Base64$InputStream

我不知道我做错了什么。我是arquillian的新手并检查了几乎所有可用的链接,但仍然没有得到任何解决方案..

Here is my arquillian.xml

<?xml version="1.0" encoding="UTF-8"?>



<arquillian xmlns="http://jboss.org/schema/arquillian"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://jboss.org/schema/arquillian
        http://jboss.org/schema/arquillian/arquillian_1_0.xsd">

    <!-- Uncomment to have test archives exported to the file system for inspection -->
    <!-- <engine> -->
    <!-- <property name="deploymentExportPath">target/</property> -->
    <!-- </engine> -->

    <!-- Force the use of the Servlet 3.0 protocol with all containers, as it 
        is the most mature -->
    <defaultProtocol type="Servlet 3.0" />

    <!-- Example configuration for a remote JBoss EAP 6 instance -->
    <container qualifier="jboss" default="true">
        <!-- By default, arquillian will use the JBOSS_HOME environment variable. 
            Alternatively, the configuration below can be uncommented. -->
        <configuration>
            <!-- <property name="jbossHome">/opt/jboss7</property> -->      <!-- <property name="managementAddress">197.242.148.253</property> <property 
                name="managementPort">22000</property> <property name="username"></property> 
                <property name="password"></property> -->


            <property name="managementAddress">197.242.148.253</property>
            <property name="managementPort">22000</property>
            <property name="username">abc</property>
            <property name="password">aabc123</property>



        </configuration>

    </container>

</arquillian>

这是我的测试类

public class ArqTest extends Arquillian{


       //creates war and deploys it
        @Deployment(testable = true)
        public static WebArchive createNotTestableDeployment() {
            final WebArchive war = ShrinkWrap.create(WebArchive.class, "USSD.war")
                    .addClasses(ShowConversations.class)
            .addAsManifestResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml"));
         System.out.println("deployed");
         System.out.println(war.getName());
            return war;
        }



     @RunAsClient
     @Test(dataProvider = Arquillian.ARQUILLIAN_DATA_PROVIDER)
       public void Test() throws IOException {



                URL url = new URL("http://197.242.148.253");
                InputStream is = (InputStream) url.openStream();
                BufferedReader br = new BufferedReader(new
                InputStreamReader(is));
                String result = br.readLine();


                System.out.println(result+"hello");
            br.close();


        }
}

任何机构都能为我提供一些帮助吗

1 个答案:

答案 0 :(得分:1)

尝试在配置节点添加下一个属性:

<property name="allowConnectingToRunningServer">true</property>

Dunno如果这会解决你的错误,但我认为你需要它,因为如果没有,arquillian会尝试创建一个新的jBoss实例而不是使用远程运行的实例。

相关问题