Search in sources :

Example 11 with MockInterceptor

use of com.opensymphony.xwork2.mock.MockInterceptor in project emfcloud-modelserver by eclipse-emfcloud.

the class ModelServerClientV1Test method before.

@Before
public void before() {
    interceptor = new MockInterceptor();
    jsonCodec = new DefaultJsonCodec();
    baseHttpUrlBuilder = new HttpUrl.Builder().scheme("http").host("fake-url.com").addPathSegment("api").addPathSegment("v1");
    eClass = EcoreFactory.eINSTANCE.createEClass();
    eClass.setName("AbstractTestClass");
    eClass.setAbstract(true);
}
Also used : Builder(okhttp3.HttpUrl.Builder) MockInterceptor(okhttp3.mock.MockInterceptor) DefaultJsonCodec(org.eclipse.emfcloud.modelserver.common.codecs.DefaultJsonCodec) HttpUrl(okhttp3.HttpUrl) Before(org.junit.Before)

Example 12 with MockInterceptor

use of com.opensymphony.xwork2.mock.MockInterceptor in project emfcloud-modelserver by eclipse-emfcloud.

the class ModelServerClientTest method before.

@Before
public void before() {
    interceptor = new MockInterceptor();
    jsonCodec = new JsonCodecV2();
    baseHttpUrlBuilder = new HttpUrl.Builder().scheme("http").host("fake-url.com").addPathSegment("api").addPathSegment("v2");
    eClass = EcoreFactory.eINSTANCE.createEClass();
    eClass.setName("AbstractTestClass");
    eClass.setAbstract(true);
}
Also used : Builder(okhttp3.HttpUrl.Builder) MockInterceptor(okhttp3.mock.MockInterceptor) JsonCodecV2(org.eclipse.emfcloud.modelserver.emf.common.codecs.JsonCodecV2) HttpUrl(okhttp3.HttpUrl) Before(org.junit.Before)

Example 13 with MockInterceptor

use of com.opensymphony.xwork2.mock.MockInterceptor in project java-sdk by dapr.

the class DaprClientHttpTest method setUp.

@Before
public void setUp() {
    mockInterceptor = new MockInterceptor(Behavior.UNORDERED);
    okHttpClient = new OkHttpClient.Builder().addInterceptor(mockInterceptor).build();
    daprHttp = new DaprHttp(Properties.SIDECAR_IP.get(), 3000, okHttpClient);
    daprClientHttp = new DaprClientProxy(new DaprClientHttp(daprHttp));
    daprClientHttpXML = new DaprClientProxy(new DaprClientHttp(daprHttp, new XmlSerializer(), new XmlSerializer()));
}
Also used : OkHttpClient(okhttp3.OkHttpClient) MockInterceptor(okhttp3.mock.MockInterceptor) Before(org.junit.Before)

Example 14 with MockInterceptor

use of com.opensymphony.xwork2.mock.MockInterceptor in project java-sdk by dapr.

the class DaprHttpTest method setUp.

@Before
public void setUp() {
    mockInterceptor = new MockInterceptor(Behavior.UNORDERED);
    okHttpClient = new OkHttpClient.Builder().addInterceptor(mockInterceptor).build();
}
Also used : OkHttpClient(okhttp3.OkHttpClient) MockInterceptor(okhttp3.mock.MockInterceptor) Before(org.junit.Before)

Example 15 with MockInterceptor

use of com.opensymphony.xwork2.mock.MockInterceptor in project struts by apache.

the class ConfigurationTest method testInterceptorParamInehritanceOverride.

public void testInterceptorParamInehritanceOverride() {
    try {
        ActionProxy proxy = actionProxyFactory.createActionProxy("/foo/bar", "TestInterceptorParamInehritanceOverride", null, null);
        assertEquals(1, proxy.getConfig().getInterceptors().size());
        MockInterceptor testInterceptor = (MockInterceptor) proxy.getConfig().getInterceptors().get(0).getInterceptor();
        assertEquals("foo123", testInterceptor.getExpectedFoo());
        proxy.execute();
        assertTrue(testInterceptor.isExecuted());
    } catch (Exception e) {
        e.printStackTrace();
        fail();
    }
}
Also used : ActionProxy(com.opensymphony.xwork2.ActionProxy) MockInterceptor(com.opensymphony.xwork2.mock.MockInterceptor)

Aggregations

MockInterceptor (okhttp3.mock.MockInterceptor)13 Before (org.junit.Before)9 MockInterceptor (com.opensymphony.xwork2.mock.MockInterceptor)7 InterceptorMapping (com.opensymphony.xwork2.config.entities.InterceptorMapping)5 OkHttpClient (okhttp3.OkHttpClient)5 ActionProxy (com.opensymphony.xwork2.ActionProxy)4 lombok.val (lombok.val)4 Test (org.junit.jupiter.api.Test)4 InterceptorStackConfig (com.opensymphony.xwork2.config.entities.InterceptorStackConfig)3 PackageConfig (com.opensymphony.xwork2.config.entities.PackageConfig)3 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 HttpUrl (okhttp3.HttpUrl)3 Builder (okhttp3.HttpUrl.Builder)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 ConfigurationProvider (com.opensymphony.xwork2.config.ConfigurationProvider)2 Map (java.util.Map)2 StrutsXmlConfigurationProvider (org.apache.struts2.config.StrutsXmlConfigurationProvider)2 JsonCodecV2 (org.eclipse.emfcloud.modelserver.emf.common.codecs.JsonCodecV2)2 Mock (com.mockobjects.dynamic.Mock)1