Skip to content

Commit

Permalink
fix release 1.10.0.17-jdk17-release for token issue
Browse files Browse the repository at this point in the history
  • Loading branch information
xuhongjia committed Mar 14, 2024
1 parent c67adc7 commit ee06887
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,9 @@ public void buildSysHeaderForCE() {
sysHeaderMap.put(ProtocolKey.CloudEventsKey.ID, headerMap.getOrDefault(ProtocolKey.CloudEventsKey.ID, UUID.randomUUID().toString()));
sysHeaderMap.put(ProtocolKey.CloudEventsKey.SOURCE, headerMap.getOrDefault("source", URI.create("/")));
sysHeaderMap.put(ProtocolKey.CloudEventsKey.TYPE, headerMap.getOrDefault("type", "http_request"));
sysHeaderMap.put(ProtocolKey.ClientInstanceKey.TOKEN.getKey(), headerMap.getOrDefault(AUTHORIZATION, ""));
sysHeaderMap.put(ProtocolKey.ClientInstanceKey.TOKEN.getKey(), headerMap.getOrDefault(ProtocolKey.ClientInstanceKey.TOKEN.getKey(),
headerMap.getOrDefault(AUTHORIZATION, headerMap.getOrDefault(AUTHORIZATION.toLowerCase(), ""))));
sysHeaderMap.put(AUTHORIZATION, headerMap.getOrDefault(AUTHORIZATION, ""));
headerMap.remove(AUTHORIZATION);

String topic = headerMap.getOrDefault("subject", "").toString();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
import org.apache.eventmesh.openconnect.offsetmgmt.api.data.ConnectRecord;
import org.apache.eventmesh.openconnect.util.ConfigUtil;

import org.apache.http.HttpHeaders;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.hc.client5.http.classic.methods.HttpPost;
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
import org.apache.hc.client5.http.impl.classic.HttpClients;
import org.apache.hc.core5.http.HttpHeaders;
import org.apache.hc.core5.http.HttpResponse;
import org.apache.hc.core5.http.HttpStatus;
import org.apache.hc.core5.http.io.entity.StringEntity;
import org.apache.hc.core5.net.URIBuilder;

import java.util.List;
import java.util.UUID;
Expand Down Expand Up @@ -67,7 +67,7 @@ void testPoll() throws Exception {
// test binary content mode
for (int i = 0; i < batchSize; i++) {
HttpResponse resp = mockBinaryRequest();
Assertions.assertEquals(resp.getStatusLine().getStatusCode(), HttpStatus.SC_OK);
Assertions.assertEquals(resp.getCode(), HttpStatus.SC_OK);

}
List<ConnectRecord> res = connector.poll();
Expand All @@ -79,7 +79,7 @@ void testPoll() throws Exception {
// test structured content mode
for (int i = 0; i < batchSize; i++) {
HttpResponse resp = mockStructuredRequest();
Assertions.assertEquals(resp.getStatusLine().getStatusCode(), HttpStatus.SC_OK);
Assertions.assertEquals(resp.getCode(), HttpStatus.SC_OK);
}
res = connector.poll();
Assertions.assertEquals(batchSize, res.size());
Expand All @@ -92,7 +92,7 @@ void testPoll() throws Exception {
invalidPost.setHeader(HttpHeaders.CONTENT_TYPE, "text/plain");
invalidPost.setHeader("ce-id", String.valueOf(UUID.randomUUID()));
HttpResponse resp = httpClient.execute(invalidPost);
Assertions.assertEquals(HttpStatus.SC_BAD_REQUEST, resp.getStatusLine().getStatusCode());
Assertions.assertEquals(HttpStatus.SC_BAD_REQUEST, resp.getCode());
}

HttpResponse mockBinaryRequest() throws Exception {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
jdk=17
snapshot=false
group=org.apache.eventmesh
version=1.10.0.13-jdk17-release
version=1.10.0.17-jdk17-release
#last eight bits of public key
signing.keyId=
#passphrase for key pairs
Expand Down

0 comments on commit ee06887

Please sign in to comment.