Search in sources :

Example 1 with BeastshopClient

use of com.dtflys.spring.test.client0.BeastshopClient in project forest by dromara.

the class SSLTest method testSSL.

public void testSSL() {
    applicationContext = new ClassPathXmlApplicationContext(new String[] { "classpath:ssl-test.xml" });
    ForestConfiguration configuration = (ForestConfiguration) applicationContext.getBean("forestConfiguration");
    SSLKeyStore keyStore = configuration.getKeyStore("keystore1");
    assertNotNull(keyStore);
    assertNotNull(keyStore.getInputStream());
    assertEquals("keystore1", keyStore.getId());
    assertEquals("123456", keyStore.getKeystorePass());
    assertEquals("jks", keyStore.getKeystoreType());
    assertThat(keyStore.getSslSocketFactoryBuilder()).isNotNull().isInstanceOf(MySSLSocketFactoryBuilder.class);
    assertThat(keyStore.getHostnameVerifier()).isNotNull().isInstanceOf(MyHostnameVerifier.class);
    BeastshopClient beastshopClient = (BeastshopClient) applicationContext.getBean("beastshopClient");
    assertNotNull(beastshopClient);
    String result = beastshopClient.index();
    assertNotNull(result);
    Throwable th = null;
    try {
        beastshopClient.index2();
    } catch (ForestRuntimeException ex) {
        th = ex.getCause();
    }
    assertThat(th).isNotNull();
}
Also used : ForestConfiguration(com.dtflys.forest.config.ForestConfiguration) BeastshopClient(com.dtflys.spring.test.client0.BeastshopClient) ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext) ForestRuntimeException(com.dtflys.forest.exceptions.ForestRuntimeException) SSLKeyStore(com.dtflys.forest.ssl.SSLKeyStore)

Example 2 with BeastshopClient

use of com.dtflys.spring.test.client0.BeastshopClient in project forest by dromara.

the class ClientTest method testScan.

public void testScan() {
    applicationContext = new ClassPathXmlApplicationContext(new String[] { "classpath:client-test.xml" });
    BeastshopClient beastshopClient = (BeastshopClient) applicationContext.getBean("beastshopClient");
    assertNotNull(beastshopClient);
    String result = beastshopClient.index();
    assertNotNull(result);
    Object baseUrl = Forest.config().getVariableValue("baseUrl");
    assertThat(baseUrl).isNotNull().isEqualTo("http://www.thebeastshop.com");
}
Also used : BeastshopClient(com.dtflys.spring.test.client0.BeastshopClient) ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext)

Example 3 with BeastshopClient

use of com.dtflys.spring.test.client0.BeastshopClient in project forest by dromara.

the class ScanTest method testScan.

public void testScan() {
    applicationContext = new ClassPathXmlApplicationContext(new String[] { "classpath:scan-test.xml" });
    BeastshopClient beastshopClient = (BeastshopClient) applicationContext.getBean("beastshopClient");
    assertNotNull(beastshopClient);
}
Also used : BeastshopClient(com.dtflys.spring.test.client0.BeastshopClient) ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext)

Aggregations

BeastshopClient (com.dtflys.spring.test.client0.BeastshopClient)3 ClassPathXmlApplicationContext (org.springframework.context.support.ClassPathXmlApplicationContext)3 ForestConfiguration (com.dtflys.forest.config.ForestConfiguration)1 ForestRuntimeException (com.dtflys.forest.exceptions.ForestRuntimeException)1 SSLKeyStore (com.dtflys.forest.ssl.SSLKeyStore)1