Search in sources :

Example 1 with ProxyFactory

use of com.dtflys.forest.proxy.ProxyFactory in project forest by dromara.

the class TestInterfaceProxyHandler method testBaseURL.

@Test
public void testBaseURL() {
    ProxyFactory<LocalhostBaseURLClient> getClientProxyFactory = new ProxyFactory<>(configuration, LocalhostBaseURLClient.class);
    InterfaceProxyHandler<LocalhostBaseURLClient> interfaceProxyHandler = new InterfaceProxyHandler(configuration, getClientProxyFactory, LocalhostBaseURLClient.class);
    MetaRequest metaRequest = interfaceProxyHandler.getBaseMetaRequest();
    assertEquals("http://localhost", metaRequest.getUrl());
}
Also used : InterfaceProxyHandler(com.dtflys.forest.proxy.InterfaceProxyHandler) ProxyFactory(com.dtflys.forest.proxy.ProxyFactory) MetaRequest(com.dtflys.forest.reflection.MetaRequest) Test(org.junit.Test)

Example 2 with ProxyFactory

use of com.dtflys.forest.proxy.ProxyFactory in project forest by dromara.

the class TestInterfaceProxyHandler method testNonProtocolBaseURL.

@Test
public void testNonProtocolBaseURL() {
    ProxyFactory<NonProtocolBaseURLClient> getClientProxyFactory = new ProxyFactory<>(configuration, NonProtocolBaseURLClient.class);
    InterfaceProxyHandler<NonProtocolBaseURLClient> interfaceProxyHandler = new InterfaceProxyHandler(configuration, getClientProxyFactory, NonProtocolBaseURLClient.class);
    MetaRequest metaRequest = interfaceProxyHandler.getBaseMetaRequest();
    assertEquals("localhost", metaRequest.getUrl());
}
Also used : InterfaceProxyHandler(com.dtflys.forest.proxy.InterfaceProxyHandler) ProxyFactory(com.dtflys.forest.proxy.ProxyFactory) MetaRequest(com.dtflys.forest.reflection.MetaRequest) Test(org.junit.Test)

Example 3 with ProxyFactory

use of com.dtflys.forest.proxy.ProxyFactory in project forest by dromara.

the class TestInterfaceProxyHandler method testEmptyBaseURL.

@Test
public void testEmptyBaseURL() {
    ProxyFactory<EmptyBaseURLClient> getClientProxyFactory = new ProxyFactory<>(configuration, EmptyBaseURLClient.class);
    InterfaceProxyHandler<EmptyBaseURLClient> interfaceProxyHandler = new InterfaceProxyHandler(configuration, getClientProxyFactory, EmptyBaseURLClient.class);
    MetaRequest metaRequest = interfaceProxyHandler.getBaseMetaRequest();
    assertNull(metaRequest.getUrl());
}
Also used : InterfaceProxyHandler(com.dtflys.forest.proxy.InterfaceProxyHandler) ProxyFactory(com.dtflys.forest.proxy.ProxyFactory) MetaRequest(com.dtflys.forest.reflection.MetaRequest) Test(org.junit.Test)

Aggregations

InterfaceProxyHandler (com.dtflys.forest.proxy.InterfaceProxyHandler)3 ProxyFactory (com.dtflys.forest.proxy.ProxyFactory)3 MetaRequest (com.dtflys.forest.reflection.MetaRequest)3 Test (org.junit.Test)3