Arquillian tests stop working after enabling Websp

2019-08-15 22:50发布

问题:

Arquillian IT tests run fine till the moment I enabled the security in Websphere admin console (In order to build the login functionality). So the question is how to run Tests with Websphere security anabled. Its LDAP (Microsoft AD). Thanks

Arquillian.xml

......

<container qualifier="websphere" default="true">
    <configuration>
        <property name="remoteServerAddress">localhost</property>
        <property name="remoteServerSoapPort">8880</property>
        <property name="securityEnabled">true</property>
    </configuration>
</container>

......

example of the test

@RunWith(Arquillian.class)
public class GreeterIT {

@Inject
private Greeter greeter;

@Deployment
public static JavaArchive createDeployment() {
    return ShrinkWrap.create(JavaArchive.class, "Arquillian-GreeterIT.jar")
            .addClass(Greeter.class)
            .addClass(SubGreeter.class)
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
}

@Test
public void createGreetingTest() {
    Assert.assertEquals("Hello, Earthling!",
            greeter.createGreeting("Earthling"));
    greeter.greet(System.out, "Earthling");
}

回答1:

For secured server you need to add username/password and ssl config like this:

<container qualifier="websphere_IntegrationTest" default="true">
    <configuration>
        <property name="remoteServerAddress">localhost</property>
        <property name="remoteServerSoapPort">8880</property>
        <property name="securityEnabled">true</property>
        <property name="username">admin</property>
        <property name="password">admin</property>
        <property name="sslTrustStore">PATH_TO\DummyClientTrustFile.jks</property>
        <property name="sslTrustStorePassword">WebAS</property>
    </configuration>
</container>