本文整理汇总了Java中io.advantageous.boon.core.Sets类的典型用法代码示例。如果您正苦于以下问题:Java Sets类的具体用法?Java Sets怎么用?Java Sets使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Sets类属于io.advantageous.boon.core包,在下文中一共展示了Sets类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setup
import io.advantageous.boon.core.Sets; //导入依赖的package包/类
@Before
public void setup() throws Exception {
mdcForHttpRequestInterceptor = new SetupMdcForHttpRequestInterceptor(Sets.set("foo"));
methodCallBuilder = MethodCallBuilder.methodCallBuilder();
httpRequest = HttpRequestBuilder.httpRequestBuilder().setUri("/foo").setRemoteAddress("localhost")
.setMethodGet()
.addHeader("foo", "bar").build();
}
示例2: initialValue
import io.advantageous.boon.core.Sets; //导入依赖的package包/类
@Override
protected JsonParserAndMapper initialValue() {
return new JsonParserFactory().setIgnoreSet(Sets.set("metaClass")).createFastObjectMapperParser();
}
示例3: returnSet
import io.advantageous.boon.core.Sets; //导入依赖的package包/类
@RequestMapping("/returnSet")
public Set<Employee> returnSet() {
return Sets.set(new Employee(1, "Rick"), new Employee(2, "Diana"));
}
示例4: returnSetByCallback
import io.advantageous.boon.core.Sets; //导入依赖的package包/类
@RequestMapping("/returnSetByCallback")
public void returnSetByCallback(Callback<Set<Employee>> callback) {
callback.resolve(Sets.set(new Employee(1, "Rick"), new Employee(2, "Diana")));
}
示例5: testServer
import io.advantageous.boon.core.Sets; //导入依赖的package包/类
@Test
public void testServer() {
super.setupLatch();
ProtocolEncoder encoder = QBit.factory().createEncoder();
ProtocolParser parser = QBit.factory().createProtocolParser();
MockHttpServer httpServer = new MockHttpServer();
final ServiceBundle serviceBundle = new ServiceBundleBuilder().setAddress("/services").build();
JsonMapper mapper = new BoonJsonMapper();
ServiceEndpointServerImpl server = new ServiceEndpointServerImpl(httpServer, encoder,
parser, serviceBundle, mapper, 30, 100, 30, 10, null, null, null, null, null, "localhost", 8080, 0, null, null, 50, 2, 2);
server.initServices(Sets.set(new TodoService()));
final AtomicBoolean resultsWorked = new AtomicBoolean();
server.start();
httpServer.postRequestObject("/services/todo-manager/todo", new Todo("Call Dad", "Call Dad", new Date()), (code, mimeType, body) -> {
puts("CALL CALLED", body, "\n\n");
if (body != null && code == 202 && body.equals("\"success\"")) {
resultsWorked.set(true);
}
});
waitForTrigger(20, o -> resultsWorked.get());
if (!resultsWorked.get()) {
die("Add operation did not work");
}
resultsWorked.set(false);
httpServer.sendHttpGet("/services/todo-manager/todo/list/", null, (code, mimeType, body) -> {
puts("ADD CALL RESPONSE code ", code, " mimeType ", mimeType, " body ", body);
List<Todo> todos = fromJsonArray(body, Todo.class);
if (todos.size() > 0) {
Todo todo = todos.get(0);
if (todo.getDescription().equals("Call Dad")) {
resultsWorked.set(true);
}
}
});
server.serviceBundle().flushSends();
Sys.sleep(100);
server.flush();
Sys.sleep(100);
waitForTrigger(20, o -> resultsWorked.get());
if (!resultsWorked.get()) {
die("List operation did not work");
}
}
示例6: testServerTimeout
import io.advantageous.boon.core.Sets; //导入依赖的package包/类
@Test
public void testServerTimeout() {
ProtocolEncoder encoder = QBit.factory().createEncoder();
MockHttpServer httpServer = new MockHttpServer();
final ServiceBundle serviceBundle = new ServiceBundleBuilder().setAddress("/services").build();
JsonMapper mapper = new BoonJsonMapper();
ServiceEndpointServerImpl server = new ServiceEndpointServerImpl(httpServer, encoder,
QBit.factory().createProtocolParser(), serviceBundle, mapper, 1, 100, 30,
10, null,
null, null, null, null, "localhost", 8080, 0, null, null, 50, 2, 2);
server.initServices(Sets.set(new TodoService()));
server.start();
final AtomicBoolean resultsWorked = new AtomicBoolean();
for (int index = 0; index < 100; index++) {
httpServer.sendHttpGet("/services/todo-manager/timeout", null, (code, mimeType, body) -> {
if (code == 408 && body != null && body.equals("\"timed out\"")) {
resultsWorked.set(true);
}
});
}
server.serviceBundle().flushSends();
Sys.sleep(100);
Sys.sleep(100);
server.flush();
Sys.sleep(100);
waitForTrigger(8, o -> resultsWorked.get());
if (!resultsWorked.get()) {
die(" we did not get timeout");
}
resultsWorked.set(false);
}
示例7: fromMap
import io.advantageous.boon.core.Sets; //导入依赖的package包/类
/**
* fromMap converts a map into a java object.
* @param map map to create the object from.
* @param clazz the new instance type
* @param excludeProperties the properties to exclude
* @param <T> generic type capture
* @return the new object
*/
@SuppressWarnings( "unchecked" )
public static <T> T fromMap( Map<String, Object> map, Class<T> clazz, String... excludeProperties ) {
Set<String> ignoreProps = excludeProperties.length > 0 ? Sets.set(excludeProperties) : null;
return new MapperComplex(FieldAccessMode.FIELD_THEN_PROPERTY.create( false ), ignoreProps, null, true).fromMap(map, clazz);
}
示例8: toMap
import io.advantageous.boon.core.Sets; //导入依赖的package包/类
/**
* Basic toMap to create an object into a map.
* @param object the object we want to convert to a list
* @param ignore do we honor ignore properties
* @return new map
*/
public static Map<String, Object> toMap( final Object object, final String... ignore ) {
return toMap( object, Sets.set( ignore ) );
}
示例9: enableLoggingMappedDiagnosticContext
import io.advantageous.boon.core.Sets; //导入依赖的package包/类
/**
* Enable the logging diagnostic context
*
* @param requestHeaders request headers
* @return this, fluent
*/
public ManagedServiceBuilder enableLoggingMappedDiagnosticContext(final String... requestHeaders) {
return enableLoggingMappedDiagnosticContext(Sets.set(requestHeaders));
}
示例10: testIntegrationWithServiceBundle
import io.advantageous.boon.core.Sets; //导入依赖的package包/类
@Test
public void testIntegrationWithServiceBundle() throws Exception {
mdcForHttpRequestInterceptor = new SetupMdcForHttpRequestInterceptor(Sets.set("foo"));
final CaptureRequestInterceptor captureRequestInterceptor = new CaptureRequestInterceptor();
captureRequestInterceptor.before(methodCallBuilder.setName("restMethod").setOriginatingRequest(httpRequest).build());
final ServiceBundle serviceBundle = ServiceBundleBuilder.serviceBundleBuilder()
.setBeforeMethodCallOnServiceQueue(BeforeMethodCallChain.beforeMethodCallChain(captureRequestInterceptor, mdcForHttpRequestInterceptor))
.setAfterMethodCallOnServiceQueue(AfterMethodCallChain.afterMethodCallChain(captureRequestInterceptor, mdcForHttpRequestInterceptor))
.setBeforeMethodSent(new ForwardCallMethodInterceptor(new RequestContext())).build().startServiceBundle();
serviceBundle.addServiceObject("my", new MyServiceImpl());
final MyService localProxy = serviceBundle.createLocalProxy(MyService.class, "my");
final AsyncFutureCallback<String> callback = AsyncFutureBuilder.asyncFutureBuilder().build(String.class);
localProxy.getRequestURI(callback);
localProxy.clientProxyFlush();
assertEquals("/foo", callback.get());
final AsyncFutureCallback<Map<String, String>> callbackMap = AsyncFutureBuilder.asyncFutureBuilder()
.buildMap(String.class, String.class);
localProxy.getMDC(callbackMap);
localProxy.clientProxyFlush();
validate(callbackMap.get());
captureRequestInterceptor.after(null, null);
serviceBundle.stop();
}