Search in sources :

Example 1 with JndiDataSourceFactory

use of org.apache.ibatis.datasource.jndi.JndiDataSourceFactory in project eap-additional-testsuite by jboss-set.

the class JaxbProviderDeserializationSecurityCheck6TestCase method testMyBatisJndiDataSourceFactory.

@Test
public void testMyBatisJndiDataSourceFactory() throws Exception {
    String result = performCall("rest/jaxb/datasource");
    try {
        JndiDataSourceFactory jaxbModel = new ObjectMapper().configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false).readValue(result, JndiDataSourceFactory.class);
        Assert.fail("Should prevente json deserialization because of security reasons.");
    } catch (JsonMappingException e) {
        Assert.assertTrue("Should prevente json deserialization because of security reasons.", e.getMessage().contains("Illegal type"));
    }
}
Also used : JndiDataSourceFactory(org.apache.ibatis.datasource.jndi.JndiDataSourceFactory) JsonMappingException(com.fasterxml.jackson.databind.JsonMappingException) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) ATTest(org.jboss.eap.additional.testsuite.annotations.ATTest) Test(org.junit.Test)

Example 2 with JndiDataSourceFactory

use of org.apache.ibatis.datasource.jndi.JndiDataSourceFactory in project eap-additional-testsuite by jboss-set.

the class JaxbProviderDeserializationSecurityCheckTestCase method testMyBatisJndiDataSourceFactory.

@ATTest({ "modules/testcases/jdkAll/Wildfly/jaxrs/src/main/java#13.0.0", "modules/testcases/jdkAll/WildflyRelease-17.0.0.Final/jaxrs/src/main/java", "modules/testcases/jdkAll/Eap71x/jaxrs/src/main/java#7.1.2", "modules/testcases/jdkAll/Eap71x-Proposed/jaxrs/src/main/java#7.1.2", "modules/testcases/jdkAll/Eap7/jaxrs/src/main/java#7.1.2", "modules/testcases/jdkAll/Eap72x/jaxrs/src/main/java", "modules/testcases/jdkAll/Eap72x-Proposed/jaxrs/src/main/java" })
@Test
public void testMyBatisJndiDataSourceFactory() throws Exception {
    String result = performCall("rest/jaxb/datasource");
    try {
        JndiDataSourceFactory jaxbModel = new ObjectMapper().configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false).readValue(result, JndiDataSourceFactory.class);
        Assert.fail("Should prevente json deserialization because of security reasons.");
    } catch (JsonMappingException e) {
        Assert.assertTrue("Should prevente json deserialization because of security reasons.", e.getMessage().contains("Illegal type"));
    }
}
Also used : JndiDataSourceFactory(org.apache.ibatis.datasource.jndi.JndiDataSourceFactory) JsonMappingException(com.fasterxml.jackson.databind.JsonMappingException) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) ATTest(org.jboss.eap.additional.testsuite.annotations.ATTest) Test(org.junit.Test) ATTest(org.jboss.eap.additional.testsuite.annotations.ATTest)

Aggregations

JsonMappingException (com.fasterxml.jackson.databind.JsonMappingException)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 JndiDataSourceFactory (org.apache.ibatis.datasource.jndi.JndiDataSourceFactory)2 ATTest (org.jboss.eap.additional.testsuite.annotations.ATTest)2 Test (org.junit.Test)2