Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[type:refactor] refactor sdk factory.
  • Loading branch information
yunlongn committed Oct 21, 2022
commit 02c93b2b1a7e9faeaa4420e41b9023feddae9de7
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
package org.apache.shenyu.sdk.httpclient;

import org.apache.shenyu.sdk.core.ShenyuRequest;
import org.apache.shenyu.sdk.core.ShenyuResponse;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import org.mockito.Mockito;

import java.io.IOException;
Expand All @@ -42,8 +40,6 @@ public void testShenyuHttpClient() throws IOException {
ShenyuRequest shenyuRequest = ShenyuRequest.create(ShenyuRequest.HttpMethod.GET, "https://shenyu.apache.org",
headerMap, null, null, null);
when(shenyuHttpClient.doRequest(shenyuRequest)).thenCallRealMethod();
ShenyuResponse response = shenyuHttpClient.doRequest(shenyuRequest);
Assertions.assertNotNull(response);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

import org.apache.shenyu.common.config.ShenyuConfig;
import org.apache.shenyu.sdk.core.ShenyuRequest;
import org.apache.shenyu.sdk.core.ShenyuResponse;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.ObjectProvider;

Expand All @@ -45,12 +43,10 @@ public class OkHttpShenyuSdkClientTest {
@Test
public void testShenyuHttpClient() throws IOException {
OkHttpShenyuSdkClient okHttpShenyuSdkClient = new OkHttpShenyuSdkClient();
okHttpShenyuSdkClient.initClient(new ShenyuConfig.RegisterConfig(), mock(ObjectProvider.class));
okHttpShenyuSdkClient.init(new ShenyuConfig.RegisterConfig(), mock(ObjectProvider.class));
Map<String, Collection<String>> headerMap = new HashMap<>();
headerMap.put("header", Arrays.asList("test1", "test2"));
ShenyuRequest request = ShenyuRequest.create(ShenyuRequest.HttpMethod.GET, "https://shenyu.apache.org",
headerMap, null, null, null);
ShenyuResponse response = okHttpShenyuSdkClient.execute(request);
Assertions.assertNotNull(response);
}
}