mirror of
https://github.com/valitydev/woody_java.git
synced 2024-11-06 08:15:21 +00:00
Header key pattern now support dot symbol (#24)
This commit is contained in:
parent
cf4712086a
commit
f4c5ed0125
2
pom.xml
2
pom.xml
@ -12,7 +12,7 @@
|
|||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<groupId>com.rbkmoney.woody</groupId>
|
<groupId>com.rbkmoney.woody</groupId>
|
||||||
<artifactId>woody</artifactId>
|
<artifactId>woody</artifactId>
|
||||||
<version>1.1.4</version>
|
<version>1.1.5</version>
|
||||||
|
|
||||||
<description>Java implementation for Woody spec</description>
|
<description>Java implementation for Woody spec</description>
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>woody</artifactId>
|
<artifactId>woody</artifactId>
|
||||||
<groupId>com.rbkmoney.woody</groupId>
|
<groupId>com.rbkmoney.woody</groupId>
|
||||||
<version>1.1.4</version>
|
<version>1.1.5</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>woody</artifactId>
|
<artifactId>woody</artifactId>
|
||||||
<groupId>com.rbkmoney.woody</groupId>
|
<groupId>com.rbkmoney.woody</groupId>
|
||||||
<version>1.1.4</version>
|
<version>1.1.5</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ import static com.rbkmoney.woody.api.interceptor.ext.ExtensionBundle.ContextBund
|
|||||||
* Created by vpankrashkin on 23.01.17.
|
* Created by vpankrashkin on 23.01.17.
|
||||||
*/
|
*/
|
||||||
public class MetadataExtensionBundle extends ExtensionBundle {
|
public class MetadataExtensionBundle extends ExtensionBundle {
|
||||||
private static final Pattern KEY_PATTERN = Pattern.compile("[\\w-]{1,53}");
|
private static final Pattern KEY_PATTERN = Pattern.compile("[\\w-.]{1,53}");
|
||||||
|
|
||||||
public MetadataExtensionBundle(List<MetadataExtensionKit> extensionList) {
|
public MetadataExtensionBundle(List<MetadataExtensionKit> extensionList) {
|
||||||
super(createClientBundle(extensionList), createServiceBundle(extensionList));
|
super(createClientBundle(extensionList), createServiceBundle(extensionList));
|
||||||
|
@ -58,6 +58,9 @@ public class TestCustomMetadataExtension extends AbstractTest {
|
|||||||
case 10:
|
case 10:
|
||||||
assertEquals((Object) 1, ContextUtils.getCustomMetadataValue(IntExtension.instance.getExtension()));
|
assertEquals((Object) 1, ContextUtils.getCustomMetadataValue(IntExtension.instance.getExtension()));
|
||||||
break;
|
break;
|
||||||
|
case 11:
|
||||||
|
assertEquals("test", ContextUtils.getCustomMetadataValue(String.class, "test.test.test"));
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
super.getOwner(id);
|
super.getOwner(id);
|
||||||
}
|
}
|
||||||
@ -65,12 +68,13 @@ public class TestCustomMetadataExtension extends AbstractTest {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
OwnerServiceSrv.Iface rpcMetaClientToMetaSrv = createThriftRPCClient(OwnerServiceSrv.Iface.class, new TimestampIdGenerator(), new CompositeClientEventListener(), Arrays.asList(IntExtension.instance), getUrlString("/rpc_cmeta"));
|
OwnerServiceSrv.Iface rpcMetaClientToMetaSrv = createThriftRPCClient(OwnerServiceSrv.Iface.class, new TimestampIdGenerator(), new CompositeClientEventListener(), Arrays.asList(IntExtension.instance), getUrlString("/rpc_cmeta"));
|
||||||
OwnerServiceSrv.Iface rpcMetaClientToNoMetaSrv = createThriftRPCClient(OwnerServiceSrv.Iface.class, new TimestampIdGenerator(), new CompositeClientEventListener(), Arrays.asList(IntExtension.instance), getUrlString("/rpc_no_cmeta"));
|
OwnerServiceSrv.Iface rpcMetaClientToNoMetaSrv = createThriftRPCClient(OwnerServiceSrv.Iface.class, new TimestampIdGenerator(), new CompositeClientEventListener(), Arrays.asList(IntExtension.instance), getUrlString("/rpc_no_cmeta"));
|
||||||
OwnerServiceSrv.Iface rpcNoMetaClientToMetaSrv = createThriftRPCClient(OwnerServiceSrv.Iface.class, new TimestampIdGenerator(), new CompositeClientEventListener(), getUrlString("/rpc_cmeta"));
|
OwnerServiceSrv.Iface rpcNoMetaClientToMetaSrv = createThriftRPCClient(OwnerServiceSrv.Iface.class, new TimestampIdGenerator(), new CompositeClientEventListener(), getUrlString("/rpc_cmeta"));
|
||||||
OwnerServiceSrv.Iface client1 = createThriftRPCClient(OwnerServiceSrv.Iface.class, new TimestampIdGenerator(), new CompositeClientEventListener(), getUrlString("/rpc_no_cmeta"));
|
OwnerServiceSrv.Iface rpcNoMetaClientToNoMetaSrv = createThriftRPCClient(OwnerServiceSrv.Iface.class, new TimestampIdGenerator(), new CompositeClientEventListener(), getUrlString("/rpc_no_cmeta"));
|
||||||
OwnerServiceSrv.Iface client2 = createThriftRPCClient(OwnerServiceSrv.Iface.class, new TimestampIdGenerator(), new CompositeClientEventListener(), getUrlString("/rpc_no_cmeta"));
|
OwnerServiceSrv.Iface client1 = createThriftRPCClient(OwnerServiceSrv.Iface.class, new TimestampIdGenerator(), new CompositeClientEventListener(), getUrlString("/rpc_no_cmeta"));
|
||||||
OwnerServiceSrv.Iface client3 = createThriftRPCClient(OwnerServiceSrv.Iface.class, new TimestampIdGenerator(), new CompositeClientEventListener(), getUrlString("/rpc_no_cmeta"));
|
OwnerServiceSrv.Iface client2 = createThriftRPCClient(OwnerServiceSrv.Iface.class, new TimestampIdGenerator(), new CompositeClientEventListener(), getUrlString("/rpc_no_cmeta"));
|
||||||
|
OwnerServiceSrv.Iface client3 = createThriftRPCClient(OwnerServiceSrv.Iface.class, new TimestampIdGenerator(), new CompositeClientEventListener(), getUrlString("/rpc_no_cmeta"));
|
||||||
|
|
||||||
Servlet cMetaServlet = createThriftRPCService(OwnerServiceSrv.Iface.class, handler, new CompositeServiceEventListener(), Arrays.asList(IntExtension.instance));
|
Servlet cMetaServlet = createThriftRPCService(OwnerServiceSrv.Iface.class, handler, new CompositeServiceEventListener(), Arrays.asList(IntExtension.instance));
|
||||||
Servlet ncMetaServlet = createThriftRPCService(OwnerServiceSrv.Iface.class, handler, new CompositeServiceEventListener());
|
Servlet ncMetaServlet = createThriftRPCService(OwnerServiceSrv.Iface.class, handler, new CompositeServiceEventListener());
|
||||||
@ -134,6 +138,21 @@ public class TestCustomMetadataExtension extends AbstractTest {
|
|||||||
}).run();
|
}).run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCustomExtensionWithDotSymbol() {
|
||||||
|
addServlet(ncMetaServlet, "/rpc_no_cmeta");
|
||||||
|
|
||||||
|
new WFlow().createServiceFork(() -> {
|
||||||
|
ContextUtils.setCustomMetadataValue("test.test.test", "test");
|
||||||
|
try {
|
||||||
|
rpcNoMetaClientToNoMetaSrv.getOwner(11);
|
||||||
|
} catch (TException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
fail();
|
||||||
|
}
|
||||||
|
}).run();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCustomExtensionNoData() {
|
public void testCustomExtensionNoData() {
|
||||||
addServlet(cMetaServlet, "/rpc_cmeta");
|
addServlet(cMetaServlet, "/rpc_cmeta");
|
||||||
|
Loading…
Reference in New Issue
Block a user