本文整理汇总了Java中jersey.repackaged.com.google.common.collect.Sets类的典型用法代码示例。如果您正苦于以下问题:Java Sets类的具体用法?Java Sets怎么用?Java Sets使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Sets类属于jersey.repackaged.com.google.common.collect包,在下文中一共展示了Sets类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: validateFederatedMetastoreDatabases
import jersey.repackaged.com.google.common.collect.Sets; //导入依赖的package包/类
private void validateFederatedMetastoreDatabases(List<String> mappableDatabases, MetaStoreMapping metaStoreMapping) {
try {
Set<String> allPrimaryDatabases = Sets.newHashSet(primaryDatabasesCache.get(PRIMARY_KEY));
for (String database : mappableDatabases) {
if (allPrimaryDatabases.contains(database.toLowerCase())) {
throw new WaggleDanceException("Database clash, found '"
+ database
+ "' to be mapped for the federated metastore '"
+ metaStoreMapping.getMetastoreMappingName()
+ "' already present in the primary database, please remove the database from the list it can't be accessed via Waggle Dance");
}
if (mappingsByDatabaseName.containsKey(database.toLowerCase())) {
throw new WaggleDanceException("Database clash, found '"
+ database
+ "' to be mapped for the federated metastore '"
+ metaStoreMapping.getMetastoreMappingName()
+ "' already present in another federated database, please remove the database from the list it can't be accessed via Waggle Dance");
}
}
} catch (ExecutionException e) {
throw new WaggleDanceException("Can't validate database clashes", e.getCause());
}
}
开发者ID:HotelsDotCom,项目名称:waggle-dance,代码行数:24,代码来源:StaticDatabaseMappingService.java
示例2: testCallWithRelAndGetParams
import jersey.repackaged.com.google.common.collect.Sets; //导入依赖的package包/类
@Test
public void testCallWithRelAndGetParams() throws Exception {
SchemaLink link = new SchemaLink();
link.setMap(Maps.asMap(Sets.newHashSet(OngoingResponseImpl.METHOD_PARAM_KEY), k -> "get"));
String uri = "http://www.mercateo.com/";
link.setHref(uri);
when(jsonHyperSchema.getByRel(any())).thenReturn(Optional.of(link));
when(response.readEntity(String.class)).thenReturn("");
StringIdCollectionBean sb = new StringIdCollectionBean();
sb.setId("1");
sb.setList(Arrays.asList("1", "2"));
uut.withRequestObject(sb).callWithRel("test");
verify(responseBuilder).buildResponse(any(), any(), any());
verify(webTarget).queryParam("id", "1");
verify(webTarget).queryParam("list", "1", "2");
}
开发者ID:Mercateo,项目名称:rest-hateoas-client,代码行数:17,代码来源:OngoingResponseImpl0Test.java
示例3: testCallWithRelAndTemplate_to_many_parameter_for_template
import jersey.repackaged.com.google.common.collect.Sets; //导入依赖的package包/类
@Test
public void testCallWithRelAndTemplate_to_many_parameter_for_template() throws Exception {
SchemaLink mockLink = mock(SchemaLink.class);
when(mockLink.getMap())
.thenReturn(Maps.asMap(Sets.newHashSet(OngoingResponseImpl.METHOD_PARAM_KEY), k -> "get"));
UriTemplate uri = new UriTemplate("http://www.mercateo.com/{id}");
when(mockLink.getHref()).thenReturn(uri);
when(jsonHyperSchema.getByRel(any())).thenReturn(Optional.of(mockLink));
when(response.readEntity(String.class)).thenReturn("");
uut = uut.withRequestObject(new StringIdBean2());
try {
uut.callWithRel("test");
Assert.fail("No IllegalStateException thrown");
} catch (IllegalStateException e) {
assertEquals(
"There is more than one field for the template variable id: [java.lang.String com.mercateo.rest.hateoas.client.impl.OngoingResponseImpl0Test$StringIdBean.id, java.lang.String com.mercateo.rest.hateoas.client.impl.OngoingResponseImpl0Test$StringIdBean2.id]",
e.getMessage());
}
}
开发者ID:Mercateo,项目名称:rest-hateoas-client,代码行数:20,代码来源:OngoingResponseImpl0Test.java
示例4: testCallWithRelAndTemplate_missing_parameter_for_template_depr
import jersey.repackaged.com.google.common.collect.Sets; //导入依赖的package包/类
@Test
public void testCallWithRelAndTemplate_missing_parameter_for_template_depr() throws Exception {
SchemaLink mockLink = mock(SchemaLink.class);
when(mockLink.getMap())
.thenReturn(Maps.asMap(Sets.newHashSet(OngoingResponseImpl.METHOD_PARAM_KEY), k -> "get"));
UriTemplate uri = new UriTemplate("http://www.mercateo.com/{id}");
when(mockLink.getHref()).thenReturn(uri);
when(jsonHyperSchema.getByRel(any())).thenReturn(Optional.of(mockLink));
when(response.readEntity(String.class)).thenReturn("");
uut = uut.withRequestObject(new Object());
try {
uut.callWithRel("test");
Assert.fail("No IllegalStateException thrown");
} catch (IllegalStateException e) {
assertEquals("No field found for the template variable id", e.getMessage());
}
}
开发者ID:Mercateo,项目名称:rest-hateoas-client,代码行数:18,代码来源:OngoingResponseImpl0Test.java
示例5: testCallWithRelAndTemplate_missing_parameter_for_template
import jersey.repackaged.com.google.common.collect.Sets; //导入依赖的package包/类
@Test
public void testCallWithRelAndTemplate_missing_parameter_for_template() throws Exception {
SchemaLink mockLink = mock(SchemaLink.class);
when(mockLink.getMap())
.thenReturn(Maps.asMap(Sets.newHashSet(OngoingResponseImpl.METHOD_PARAM_KEY), k -> "get"));
UriTemplate uri = new UriTemplate("http://www.mercateo.com/{id}");
when(mockLink.getHref()).thenReturn(uri);
when(jsonHyperSchema.getByRel(any())).thenReturn(Optional.of(mockLink));
when(response.readEntity(String.class)).thenReturn("");
uut = uut.withRequestObject(new Object());
try {
uut.callWithRel("test");
Assert.fail("No IllegalStateException thrown");
} catch (IllegalStateException e) {
assertEquals("No field found for the template variable id", e.getMessage());
}
}
开发者ID:Mercateo,项目名称:rest-hateoas-client,代码行数:18,代码来源:OngoingResponseImpl0Test.java
示例6: testCallListWithRel_and_withRequestObject_with_validData
import jersey.repackaged.com.google.common.collect.Sets; //导入依赖的package包/类
@Test
@UseDataProvider("validData")
public void testCallListWithRel_and_withRequestObject_with_validData(String method, String url,
Object requestObject, String expected) throws Exception {
// given
SchemaLink mockLink = mock(SchemaLink.class);
when(mockLink.getMap()).thenReturn(Maps.asMap(Sets.newHashSet(
OngoingResponseImpl.METHOD_PARAM_KEY), k -> method));
UriTemplate uri = new UriTemplate(url);
when(mockLink.getHref()).thenReturn(uri);
when(jsonHyperSchema.getByRel(any())).thenReturn(Optional.of(mockLink));
when(response.readEntity(String.class)).thenReturn("");
// when
uut = uut.withRequestObject(requestObject);
uut.callWithRel("test");
// then
verify(responseBuilder).buildResponse(any(), any(), any());
verify(client).target(eq(new URI(expected)));
}
开发者ID:Mercateo,项目名称:rest-hateoas-client,代码行数:24,代码来源:OngoingResponseImpl0Test.java
示例7: testCallListWithRel_and_withRequestObject_with_erroneousData
import jersey.repackaged.com.google.common.collect.Sets; //导入依赖的package包/类
@Test
@UseDataProvider("erroneousData")
public void testCallListWithRel_and_withRequestObject_with_erroneousData(String method,
String url, Object requestObject, Class<? extends Exception> expected)
throws Exception {
// given
SchemaLink mockLink = mock(SchemaLink.class);
when(mockLink.getMap()).thenReturn(Maps.asMap(Sets.newHashSet(
OngoingResponseImpl.METHOD_PARAM_KEY), k -> method));
UriTemplate uri = new UriTemplate(url);
when(mockLink.getHref()).thenReturn(uri);
when(jsonHyperSchema.getByRel(any())).thenReturn(Optional.of(mockLink));
when(response.readEntity(String.class)).thenReturn("");
try {
// when
uut = uut.withRequestObject(requestObject);
uut.callWithRel("test");
fail("expected exception " + expected);
} catch (Exception e) {
// then
assertEquals(expected, e.getClass());
}
}
开发者ID:Mercateo,项目名称:rest-hateoas-client,代码行数:27,代码来源:OngoingResponseImpl0Test.java
示例8: testMethodGauges
import jersey.repackaged.com.google.common.collect.Sets; //导入依赖的package包/类
@Test
public void testMethodGauges() throws Exception {
Configuration conf = new Configuration();
conf.set(LensConfConstants.QUERY_METRIC_UNIQUE_ID_CONF_KEY, TestQueryMetrics.class.getSimpleName());
conf.set(LensConfConstants.QUERY_METRIC_DRIVER_STACK_NAME, "testCubeRewriteStackName");
rewriteCtx("select" + " SUM(msr2) from testCube where " + TWO_DAYS_RANGE, conf);
MetricRegistry reg = LensMetricsRegistry.getStaticRegistry();
CubeQueryRewriter cubeQueryRewriter = new CubeQueryRewriter(new Configuration(), new HiveConf());
Set<String> expected = Sets.newHashSet();
int index = 0;
for (ContextRewriter contextRewriter : cubeQueryRewriter.getRewriters()) {
expected.add("lens.MethodMetricGauge.testCubeRewriteStackName-"
+ contextRewriter.getClass().getName() + "-ITER-" + index);
index++;
}
Assert.assertEquals(reg.getGauges().keySet(), expected);
}
开发者ID:apache,项目名称:lens,代码行数:19,代码来源:TestQueryMetrics.java
示例9: assertNotLanguageBaseIndividual
import jersey.repackaged.com.google.common.collect.Sets; //导入依赖的package包/类
private void assertNotLanguageBaseIndividual(Entity result) {
Assert.assertEquals("wd:Q42", result.getIRI());
Assert.assertEquals(Collections.singletonList("Person"), result.getTypes());
Assert.assertEquals("http://foobar.com/", result.getPropertyValue("url"));
Assert.assertEquals(Sets.newHashSet(
"http://fr.wikipedia.org/wiki/Douglas_Adams",
"http://twitter.com/BarackObama",
"http://www.instagram.com/barackobama",
"http://www.facebook.com/barackobama",
"http://www.youtube.com/channel/UCdn86UYrf54lXfVli9CB6Aw",
"http://plus.google.com/+BarackObama"
), Sets.newHashSet((List<String>) result.getPropertyValue("sameAs")));
Assert.assertEquals("1952-03-11Z", ((Map) result.getPropertyValue("birthDate")).get("@value"));
Assert.assertEquals("xsd:date", ((Map) result.getPropertyValue("birthDate")).get("@type"));
}
开发者ID:askplatypus,项目名称:platypus-kb-lucene,代码行数:16,代码来源:EntityActionsTest.java
示例10: assertNotLanguageBaseIndividual
import jersey.repackaged.com.google.common.collect.Sets; //导入依赖的package包/类
private void assertNotLanguageBaseIndividual(Entity result) {
Assert.assertEquals("wd:Q42", result.getIRI());
Assert.assertEquals(Collections.singletonList("Person"), result.getTypes());
Assert.assertEquals("http://foobar.com/", result.getPropertyValue("url"));
Assert.assertEquals(Sets.newHashSet(
"http://fr.wikipedia.org/wiki/Douglas_Adams",
"http://twitter.com/BarackObama",
"http://www.instagram.com/barackobama",
"http://www.facebook.com/barackobama",
"http://www.youtube.com/channel/UCdn86UYrf54lXfVli9CB6Aw",
"http://plus.google.com/+BarackObama"
), Sets.newHashSet((List) result.getPropertyValue("sameAs")));
}
开发者ID:askplatypus,项目名称:platypus-kb-lucene,代码行数:14,代码来源:SearchActionsTest.java
示例11: testCallWithRel
import jersey.repackaged.com.google.common.collect.Sets; //导入依赖的package包/类
@Test
public void testCallWithRel() throws Exception {
SchemaLink link = new SchemaLink();
link.setMap(Maps.asMap(Sets.newHashSet(OngoingResponseImpl.METHOD_PARAM_KEY), k -> "put"));
String uri = "http://www.mercateo.com/";
link.setHref(uri);
when(jsonHyperSchema.getByRel(any())).thenReturn(Optional.of(link));
when(response.readEntity(String.class)).thenReturn("");
uut.callWithRel("test");
verify(responseBuilder).buildResponse(any(), any(), any());
}
开发者ID:Mercateo,项目名称:rest-hateoas-client,代码行数:12,代码来源:OngoingResponseImpl0Test.java
示例12: testCallWithRelAndTemplate
import jersey.repackaged.com.google.common.collect.Sets; //导入依赖的package包/类
@Test
public void testCallWithRelAndTemplate() throws Exception {
SchemaLink mockLink = mock(SchemaLink.class);
when(mockLink.getMap())
.thenReturn(Maps.asMap(Sets.newHashSet(OngoingResponseImpl.METHOD_PARAM_KEY), k -> "get"));
UriTemplate uri = new UriTemplate("http://www.mercateo.com/{id}");
when(mockLink.getHref()).thenReturn(uri);
when(jsonHyperSchema.getByRel(any())).thenReturn(Optional.of(mockLink));
when(response.readEntity(String.class)).thenReturn("");
uut = uut.withRequestObject(new StringIdBean("id1"));
uut.callWithRel("test");
verify(responseBuilder).buildResponse(any(), any(), any());
verify(client).target(eq(new URI("http://www.mercateo.com/id1")));
}
开发者ID:Mercateo,项目名称:rest-hateoas-client,代码行数:15,代码来源:OngoingResponseImpl0Test.java
示例13: testCallWithRel_badRequest
import jersey.repackaged.com.google.common.collect.Sets; //导入依赖的package包/类
@Test(expected = WebApplicationException.class)
public void testCallWithRel_badRequest() throws Exception {
SchemaLink mockLink = mock(SchemaLink.class);
when(mockLink.getMap())
.thenReturn(Maps.asMap(Sets.newHashSet(OngoingResponseImpl.METHOD_PARAM_KEY), k -> "put"));
UriTemplate uri = new UriTemplate("http://www.mercateo.com/");
when(mockLink.getHref()).thenReturn(uri);
when(jsonHyperSchema.getByRel(any())).thenReturn(Optional.of(mockLink));
when(response.readEntity(String.class)).thenReturn("");
when(response.getStatus()).thenReturn(400);
when(response.getStatusInfo()).thenReturn(Statuses.from(400));
uut.callWithRel("test");
}
开发者ID:Mercateo,项目名称:rest-hateoas-client,代码行数:14,代码来源:OngoingResponseImpl0Test.java
示例14: testCallWithRel_Object
import jersey.repackaged.com.google.common.collect.Sets; //导入依赖的package包/类
@Test
public void testCallWithRel_Object() throws Exception {
SchemaLink mockLink = mock(SchemaLink.class);
when(mockLink.getMap())
.thenReturn(Maps.asMap(Sets.newHashSet(OngoingResponseImpl.METHOD_PARAM_KEY), k -> "put"));
UriTemplate uri = new UriTemplate("http://www.mercateo.com/");
when(mockLink.getHref()).thenReturn(uri);
when(jsonHyperSchema.getByRel(any())).thenReturn(Optional.of(mockLink));
when(response.readEntity(String.class)).thenReturn("");
uut = uut.withRequestObject(new Object());
uut.callWithRel("test");
verify(builder).method(any(), any(Entity.class));
verify(responseBuilder).buildResponse(any(), any(), any());
}
开发者ID:Mercateo,项目名称:rest-hateoas-client,代码行数:15,代码来源:OngoingResponseImpl0Test.java
示例15: testDoNotPassEntityForGet
import jersey.repackaged.com.google.common.collect.Sets; //导入依赖的package包/类
@Test
public void testDoNotPassEntityForGet() throws Exception {
SchemaLink mockLink = mock(SchemaLink.class);
when(mockLink.getMap())
.thenReturn(Maps.asMap(Sets.newHashSet(OngoingResponseImpl.METHOD_PARAM_KEY), k -> "get"));
UriTemplate uri = new UriTemplate("http://www.mercateo.com/%7Bid%7D");
when(mockLink.getHref()).thenReturn(uri);
when(jsonHyperSchema.getByRel(any())).thenReturn(Optional.of(mockLink));
when(response.readEntity(String.class)).thenReturn("");
uut = uut.withRequestObject(new StringIdBean("bla"));
uut.callWithRel("test");
verify(builder, never()).method(any(), any(Entity.class));
}
开发者ID:Mercateo,项目名称:rest-hateoas-client,代码行数:14,代码来源:OngoingResponseImpl0Test.java
示例16: testCallListWithRel
import jersey.repackaged.com.google.common.collect.Sets; //导入依赖的package包/类
@Test
public void testCallListWithRel() throws Exception {
SchemaLink mockLink = mock(SchemaLink.class);
when(mockLink.getMap())
.thenReturn(Maps.asMap(Sets.newHashSet(OngoingResponseImpl.METHOD_PARAM_KEY), k -> "put"));
UriTemplate uri = new UriTemplate("http://www.mercateo.com/");
when(mockLink.getHref()).thenReturn(uri);
when(jsonHyperSchema.getByRel(any())).thenReturn(Optional.of(mockLink));
when(response.readEntity(String.class)).thenReturn("");
uut.callListWithRel("test");
verify(responseBuilder).buildListResponse(any(), any(), any());
}
开发者ID:Mercateo,项目名称:rest-hateoas-client,代码行数:13,代码来源:OngoingResponseImpl0Test.java
示例17: testCallWithRel_SchemaParseException
import jersey.repackaged.com.google.common.collect.Sets; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test(expected = ProcessingException.class)
public void testCallWithRel_SchemaParseException() throws Exception {
SchemaLink mockLink = mock(SchemaLink.class);
when(mockLink.getMap())
.thenReturn(Maps.asMap(Sets.newHashSet(OngoingResponseImpl.METHOD_PARAM_KEY), k -> "put"));
UriTemplate uri = new UriTemplate("http://www.mercateo.com/");
when(mockLink.getHref()).thenReturn(uri);
when(jsonHyperSchema.getByRel(any())).thenReturn(Optional.of(mockLink));
when(response.readEntity(String.class)).thenThrow(ProcessingException.class);
uut.callWithRel("test");
}
开发者ID:Mercateo,项目名称:rest-hateoas-client,代码行数:14,代码来源:OngoingResponseImpl0Test.java
示例18: testCallListWithRel_SchemaParseException
import jersey.repackaged.com.google.common.collect.Sets; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test(expected = ProcessingException.class)
public void testCallListWithRel_SchemaParseException() throws Exception {
SchemaLink mockLink = mock(SchemaLink.class);
when(mockLink.getMap())
.thenReturn(Maps.asMap(Sets.newHashSet(OngoingResponseImpl.METHOD_PARAM_KEY), k -> "put"));
UriTemplate uri = new UriTemplate("http://www.mercateo.com/");
when(mockLink.getHref()).thenReturn(uri);
when(jsonHyperSchema.getByRel(any())).thenReturn(Optional.of(mockLink));
when(response.readEntity(String.class)).thenThrow(ProcessingException.class);
uut.callListWithRel("test");
}
开发者ID:Mercateo,项目名称:rest-hateoas-client,代码行数:13,代码来源:OngoingResponseImpl0Test.java
示例19: getReachableNodes_areReturned
import jersey.repackaged.com.google.common.collect.Sets; //导入依赖的package包/类
@Test
public void getReachableNodes_areReturned() {
Graph graph = graphApi.getReachableNodes(b,
Lists.newArrayList(OwlRelationships.RDFS_SUBCLASS_OF.name()), Sets.newHashSet());
assertThat(size(graph.getVertices()), is(1));
assertThat(size(graph.getEdges()), is(0));
graph = graphApi.getReachableNodes(c,
Lists.newArrayList(OwlRelationships.OWL_EQUIVALENT_CLASS.name(),
OwlRelationships.RDFS_SUBCLASS_OF.name()),
Sets.newHashSet());
assertThat(size(graph.getVertices()), is(1));
assertThat(size(graph.getEdges()), is(0));
}
开发者ID:SciGraph,项目名称:SciGraph,代码行数:14,代码来源:GraphApiTest.java
示例20: getReachableNodes_nothingReturnedForFakeLabel
import jersey.repackaged.com.google.common.collect.Sets; //导入依赖的package包/类
@Test
public void getReachableNodes_nothingReturnedForFakeLabel() {
Graph graph = graphApi.getReachableNodes(c,
Lists.newArrayList(OwlRelationships.OWL_EQUIVALENT_CLASS.name(),
OwlRelationships.RDFS_SUBCLASS_OF.name()),
Sets.newHashSet("fakeLabel"));
assertThat(size(graph.getVertices()), is(0));
assertThat(size(graph.getEdges()), is(0));
}
开发者ID:SciGraph,项目名称:SciGraph,代码行数:10,代码来源:GraphApiTest.java
注:本文中的jersey.repackaged.com.google.common.collect.Sets类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论