use of org.eclipse.jetty.websocket.jsr356.annotations.JsrCallable in project jetty.project by eclipse.
the class JsrParamIdDecoderTest method testMatchDateDecoder.
@Test
public void testMatchDateDecoder() {
DecoderMetadata metadata = new DecoderMetadata(DateDecoder.class, Date.class, MessageType.TEXT, false);
JsrParamIdDecoder paramId = new JsrParamIdDecoder(metadata);
JsrCallable callable = getOnMessageCallableFrom(DateTextSocket.class, "onMessage");
Param param = new Param(0, Date.class, null);
Assert.assertThat("Match for Decoder", paramId.process(param, callable), is(true));
}
use of org.eclipse.jetty.websocket.jsr356.annotations.JsrCallable in project jetty.project by eclipse.
the class ServerAnnotatedEndpointScanner_GoodSignaturesTest method testScan_Basic.
@Test
public void testScan_Basic() throws Exception {
WebSocketContainerScope container = new SimpleContainerScope(WebSocketPolicy.newClientPolicy());
AnnotatedServerEndpointMetadata metadata = new AnnotatedServerEndpointMetadata(container, testcase.pojo, null);
AnnotatedEndpointScanner<ServerEndpoint, ServerEndpointConfig> scanner = new AnnotatedEndpointScanner<>(metadata);
scanner.scan();
Assert.assertThat("Metadata", metadata, notNullValue());
JsrCallable method = (JsrCallable) testcase.metadataField.get(metadata);
Assert.assertThat(testcase.metadataField.toString(), method, notNullValue());
int len = testcase.expectedParameters.length;
for (int i = 0; i < len; i++) {
Class<?> expectedParam = testcase.expectedParameters[i];
Class<?> actualParam = method.getParamTypes()[i];
Assert.assertTrue("Parameter[" + i + "] - expected:[" + expectedParam + "], actual:[" + actualParam + "]", actualParam.equals(expectedParam));
}
}
use of org.eclipse.jetty.websocket.jsr356.annotations.JsrCallable in project jetty.project by eclipse.
the class ClientAnnotatedEndpointScanner_GoodSignaturesTest method testScan_Basic.
@Test
public void testScan_Basic() throws Exception {
AnnotatedClientEndpointMetadata metadata = new AnnotatedClientEndpointMetadata(container, testcase.pojo);
AnnotatedEndpointScanner<ClientEndpoint, ClientEndpointConfig> scanner = new AnnotatedEndpointScanner<>(metadata);
scanner.scan();
Assert.assertThat("Metadata", metadata, notNullValue());
JsrCallable cm = (JsrCallable) testcase.metadataField.get(metadata);
Assert.assertThat(testcase.metadataField.toString(), cm, notNullValue());
int len = testcase.expectedParameters.length;
for (int i = 0; i < len; i++) {
Class<?> expectedParam = testcase.expectedParameters[i];
Class<?> actualParam = cm.getParamTypes()[i];
Assert.assertTrue("Parameter[" + i + "] - expected:[" + expectedParam + "], actual:[" + actualParam + "]", actualParam.equals(expectedParam));
}
}
Aggregations