public void addDependencyForRelocation(ModuleVersionSelector selector) {
// Some POMs depend on themselves through their parent POM, don't add this dependency
// since Ivy doesn't allow this!
// Example: http://repo2.maven.org/maven2/com/atomikos/atomikos-util/3.6.4/atomikos-util-3.6.4.pom
if (selector.getGroup().equals(descriptor.getComponentIdentifier().getGroup())
&& selector.getName().equals(descriptor.getComponentIdentifier().getModule())) {
return;
}
// TODO - this is a constant
ListMultimap<String, String> confMappings = ArrayListMultimap.create();
// Map dependency on all public configurations
for (Configuration m2Conf : GradlePomModuleDescriptorBuilder.MAVEN2_CONFIGURATIONS.values()) {
if (m2Conf.isVisible()) {
confMappings.put(m2Conf.getName(), m2Conf.getName());
}
}
dependencies.add(new IvyDependencyMetadata(selector, confMappings));
}
java类com.google.common.collect.ListMultimap的实例源码
GradlePomModuleDescriptorBuilder.java 文件源码
项目:Reer
阅读 28
收藏 0
点赞 0
评论 0
TaskDetailPrinter.java 文件源码
项目:Reer
阅读 27
收藏 0
点赞 0
评论 0
private ListMultimap<Class, Task> groupTasksByType(List<Task> tasks) {
final Set<Class> taskTypes = new TreeSet<Class>(new Comparator<Class>() {
public int compare(Class o1, Class o2) {
return o1.getSimpleName().compareTo(o2.getSimpleName());
}
});
taskTypes.addAll(collect(tasks, new Transformer<Class, Task>() {
public Class transform(Task original) {
return getDeclaredTaskType(original);
}
}));
ListMultimap<Class, Task> tasksGroupedByType = ArrayListMultimap.create();
for (final Class taskType : taskTypes) {
tasksGroupedByType.putAll(taskType, filter(tasks, new Spec<Task>() {
public boolean isSatisfiedBy(Task element) {
return getDeclaredTaskType(element).equals(taskType);
}
}));
}
return tasksGroupedByType;
}
AccessController.java 文件源码
项目:ditb
阅读 43
收藏 0
点赞 0
评论 0
void initialize(RegionCoprocessorEnvironment e) throws IOException {
final Region region = e.getRegion();
Configuration conf = e.getConfiguration();
Map<byte[], ListMultimap<String,TablePermission>> tables =
AccessControlLists.loadAll(region);
// For each table, write out the table's permissions to the respective
// znode for that table.
for (Map.Entry<byte[], ListMultimap<String,TablePermission>> t:
tables.entrySet()) {
byte[] entry = t.getKey();
ListMultimap<String,TablePermission> perms = t.getValue();
byte[] serialized = AccessControlLists.writePermissionsAsBytes(perms, conf);
this.authManager.getZKPermissionWatcher().writeToZookeeper(entry, serialized);
}
initialized = true;
}
TestHardAssignmentCreator.java 文件源码
项目:dremio-oss
阅读 24
收藏 0
点赞 0
评论 0
@Test
public void twoFilesOnSameHost() throws Exception {
final List<CompleteWork> workUnits = asList(
newWork("/10.0.0.1/table/foo1", 1024, ENDPOINT_1_1, 0.33),
newWork("/10.0.0.1/table/foo2", 2048, ENDPOINT_1_2, 0.66)
);
ListMultimap<Integer, CompleteWork> mappings;
List<NodeEndpoint> endpoints;
endpoints = asList(ENDPOINT_1_1, ENDPOINT_1_2);
mappings = INSTANCE.getMappings(endpoints, workUnits);
verifyAssignments(mappings, endpoints, workUnits);
// Assign only one endpoint from 10.0.0.1
endpoints = asList(ENDPOINT_1_2);
mappings = INSTANCE.getMappings(endpoints, workUnits);
verifyAssignments(mappings, endpoints, workUnits);
// Negative case - fails because the assigned list contains ENDPOINTS running on 10.0.0.2, but there are no files on
// 10.0.0.2
verifyAssignmentFails(workUnits, ENDPOINT_1_1, ENDPOINT_2_1);
}
PolyfillValidatorFragment.java 文件源码
项目:n4js
阅读 24
收藏 0
点赞 0
评论 0
/**
* Find clashes by name.
*
* @param myPolyMember
* current validated Polyfill
* @param pivotPolyMember
* other polyfill in same project
* @return pairs of contrandicting or same polyfills.
*/
private ListMultimap<TMember, TMember> findClashingMembersByName(EList<TMember> myPolyMember,
EList<TMember> pivotPolyMember) {
ListMultimap<TMember, TMember> ret = LinkedListMultimap.create();
for (TMember my : myPolyMember) {
String myName = my.getName();
if (myName == null)
continue; // broken AST
for (TMember other : pivotPolyMember) {
String otherName = other.getName();
if (myName.equals(otherName)) {
ret.put(my, other);
}
}
}
return ret;
}
MatchClauseExecutor.java 文件源码
项目:memory-graph
阅读 24
收藏 0
点赞 0
评论 0
private boolean vertexIsMatch(
MemgraphCypherQueryContext ctx,
Vertex vertex,
List<String> labelNames,
ListMultimap<String, CypherAstBase> propertiesMap,
ExpressionScope scope
) {
Set<String> vertexLabelNames = ctx.getVertexLabels(vertex);
for (String labelName : labelNames) {
if (!vertexLabelNames.contains(labelName)) {
return false;
}
}
return propertyMapMatch(ctx, vertex, propertiesMap, scope);
}
ListMultimapTestSuiteBuilder.java 文件源码
项目:guava-mock
阅读 29
收藏 0
点赞 0
评论 0
@Override
TestSuite computeMultimapAsMapGetTestSuite(
FeatureSpecificTestSuiteBuilder<
?, ? extends OneSizeTestContainerGenerator<ListMultimap<K, V>, Entry<K, V>>>
parentBuilder) {
Set<Feature<?>> features = computeMultimapAsMapGetFeatures(parentBuilder.getFeatures());
if (Collections.disjoint(features, EnumSet.allOf(CollectionSize.class))) {
return new TestSuite();
} else {
return ListTestSuiteBuilder.using(
new MultimapAsMapGetGenerator<K, V>(parentBuilder.getSubjectGenerator()))
.withFeatures(features)
.named(parentBuilder.getName() + ".asMap[].get[key]")
.suppressing(parentBuilder.getSuppressedTests())
.createTestSuite();
}
}
ListMultimapEqualsTester.java 文件源码
项目:googles-monorepo-demo
阅读 27
收藏 0
点赞 0
评论 0
@CollectionSize.Require(SEVERAL)
public void testOrderingAffectsEqualsComparisons() {
ListMultimap<K, V> multimap1 =
getSubjectGenerator()
.create(
Helpers.mapEntry(k0(), v0()),
Helpers.mapEntry(k0(), v1()),
Helpers.mapEntry(k0(), v0()));
ListMultimap<K, V> multimap2 =
getSubjectGenerator()
.create(
Helpers.mapEntry(k0(), v1()),
Helpers.mapEntry(k0(), v0()),
Helpers.mapEntry(k0(), v0()));
new EqualsTester().addEqualityGroup(multimap1).addEqualityGroup(multimap2).testEquals();
}
TestHardAssignmentCreator.java 文件源码
项目:dremio-oss
阅读 29
收藏 0
点赞 0
评论 0
private static final void verifyAssignments(ListMultimap<Integer, CompleteWork> assignments,
List<NodeEndpoint> inputEps, List<CompleteWork> inputWorks) {
final String summary = summary(assignments, inputEps, inputWorks);
final Set<CompleteWork> assignedSet = Sets.newHashSet(assignments.values());
for(CompleteWork cw : inputWorks) {
assertTrue("Input work not present in assigned work unit list: " + summary,
assignedSet.contains(cw));
assertTrue(summary, assignedSet.remove(cw));
}
assertTrue("There are some extra works in assigned work unit list: " + summary, assignedSet.size() == 0);
int i = 0;
HashSet<CompleteWork> inputWorkSet = new HashSet<>(inputWorks);
for(NodeEndpoint ep : inputEps) {
Collection<CompleteWork> assignedWorks = assignments.get(i);
for(CompleteWork assignedWork : assignedWorks) {
assertEquals("Wrong endpoint assigned: " + summary,
ep.getAddress(), assignedWork.getAffinity().get(0).getEndpoint().getAddress());
assertTrue(summary, inputWorkSet.remove(assignedWork));
}
i++;
}
}
ListMultimapEqualsTester.java 文件源码
项目:guava-mock
阅读 24
收藏 0
点赞 0
评论 0
@CollectionSize.Require(SEVERAL)
public void testOrderingAffectsEqualsComparisons() {
ListMultimap<K, V> multimap1 =
getSubjectGenerator()
.create(
Helpers.mapEntry(k0(), v0()),
Helpers.mapEntry(k0(), v1()),
Helpers.mapEntry(k0(), v0()));
ListMultimap<K, V> multimap2 =
getSubjectGenerator()
.create(
Helpers.mapEntry(k0(), v1()),
Helpers.mapEntry(k0(), v0()),
Helpers.mapEntry(k0(), v0()));
new EqualsTester().addEqualityGroup(multimap1).addEqualityGroup(multimap2).testEquals();
}
ChunkLoadingHandler.java 文件源码
项目:Simple-Chunks
阅读 32
收藏 0
点赞 0
评论 0
@Override
public ListMultimap<String, ForgeChunkManager.Ticket> playerTicketsLoaded(ListMultimap<String, ForgeChunkManager.Ticket> tickets, World world)
{
// We don't care what order the tickets are in, but filter out the invalid ones
ListMultimap<String, ForgeChunkManager.Ticket> validTickets = ArrayListMultimap.create();
for (String playerName : tickets.keySet())
{
List<ForgeChunkManager.Ticket> playerTickets = new ArrayList<>();
for (ForgeChunkManager.Ticket tkt : tickets.get(playerName))
{
BlockPos ticketPosition = NBTUtil.getPosFromTag(tkt.getModData().getCompoundTag("position"));
TileEntity te = world.getTileEntity(ticketPosition);
if (te instanceof TileEntityChunkLoader)
{
playerTickets.add(tkt);
}
}
validTickets.putAll(playerName, playerTickets);
}
return validTickets;
}
TableAuthManager.java 文件源码
项目:ditb
阅读 26
收藏 0
点赞 0
评论 0
/**
* Updates the internal permissions cache for a single table, splitting
* the permissions listed into separate caches for users and groups to optimize
* group lookups.
*
* @param table
* @param tablePerms
*/
private void updateTableCache(TableName table,
ListMultimap<String,TablePermission> tablePerms) {
PermissionCache<TablePermission> newTablePerms = new PermissionCache<TablePermission>();
for (Map.Entry<String,TablePermission> entry : tablePerms.entries()) {
if (AuthUtil.isGroupPrincipal(entry.getKey())) {
newTablePerms.putGroup(AuthUtil.getGroupName(entry.getKey()), entry.getValue());
} else {
newTablePerms.putUser(entry.getKey(), entry.getValue());
}
}
tableCache.put(table, newTablePerms);
mtime.incrementAndGet();
}
AssignmentCreator.java 文件源码
项目:dremio-oss
阅读 26
收藏 0
点赞 0
评论 0
/**
* Does the work of creating the mappings for this AssignmentCreator
* @return the minor fragment id to work units mapping
*/
private ListMultimap<Integer, T> getMappings() {
Stopwatch watch = Stopwatch.createStarted();
maxWork = (int) Math.ceil(units.size() / ((float) incomingEndpoints.size()));
LinkedList<WorkEndpointListPair<T>> workList = getWorkList();
LinkedList<WorkEndpointListPair<T>> unassignedWorkList;
Map<NodeEndpoint,FragIteratorWrapper> endpointIterators = getEndpointIterators();
unassignedWorkList = assign(workList, endpointIterators, true);
assignLeftovers(unassignedWorkList, endpointIterators, true);
assignLeftovers(unassignedWorkList, endpointIterators, false);
if (!unassignedWorkList.isEmpty()) {
throw new IllegalStateException("There are still unassigned work units");
}
logger.debug("Took {} ms to assign {} work units to {} fragments", watch.elapsed(TimeUnit.MILLISECONDS), units.size(), incomingEndpoints.size());
return mappings;
}
TsvResourceInitializer.java 文件源码
项目:clearwsd
阅读 31
收藏 0
点赞 0
评论 0
@Override
public MultimapResource<K> get() {
ListMultimap<String, String> multimap = ArrayListMultimap.create();
MultimapResource<K> resource = new MultimapResource<>(key);
try (BufferedReader reader = new BufferedReader(new InputStreamReader(path.openStream()))) {
String line;
while ((line = reader.readLine()) != null) {
line = line.trim();
if (line.trim().isEmpty()) {
continue;
}
List<String> fields = Arrays.asList(line.split("\t"));
apply(fields, multimap);
}
} catch (Exception e) {
throw new RuntimeException("Error initializing TSV resource.", e);
}
resource.multimap(ImmutableListMultimap.copyOf(multimap));
resource.mappingFunction(mappingFunction);
return resource;
}
TestAssignment.java 文件源码
项目:dremio-oss
阅读 27
收藏 0
点赞 0
评论 0
@Test
public void manyFiles() throws Exception {
List<CompleteWork> chunks = generateChunks(1000);
Iterator<NodeEndpoint> incomingEndpointsIterator = Iterators.cycle(endpoints);
List<NodeEndpoint> incomingEndpoints = Lists.newArrayList();
final int width = 28 * 30;
for (int i = 0; i < width; i++) {
incomingEndpoints.add(incomingEndpointsIterator.next());
}
ListMultimap<Integer, CompleteWork> mappings = AssignmentCreator.getMappings(incomingEndpoints, chunks);
System.out.println(mappings.keySet().size());
for (int i = 0; i < width; i++) {
Assert.assertTrue("no mapping for entry " + i, mappings.get(i) != null && mappings.get(i).size() > 0);
}
}
TableAuthManager.java 文件源码
项目:ditb
阅读 31
收藏 0
点赞 0
评论 0
/**
* Updates the internal global permissions cache
*
* @param userPerms
*/
private void updateGlobalCache(ListMultimap<String,TablePermission> userPerms) {
PermissionCache<Permission> newCache = null;
try {
newCache = initGlobal(conf);
for (Map.Entry<String,TablePermission> entry : userPerms.entries()) {
if (AuthUtil.isGroupPrincipal(entry.getKey())) {
newCache.putGroup(AuthUtil.getGroupName(entry.getKey()),
new Permission(entry.getValue().getActions()));
} else {
newCache.putUser(entry.getKey(), new Permission(entry.getValue().getActions()));
}
}
globalCache = newCache;
mtime.incrementAndGet();
} catch (IOException e) {
// Never happens
LOG.error("Error occured while updating the global cache", e);
}
}
ItemDaoImpl.java 文件源码
项目:Equella
阅读 28
收藏 0
点赞 0
评论 0
@Override
@Transactional(propagation = Propagation.MANDATORY)
public ListMultimap<Long, Attachment> getAttachmentsForItemIds(Collection<Long> ids)
{
if( ids.isEmpty() )
{
return ImmutableListMultimap.of();
}
List<Object[]> attachments = getHibernateTemplate().findByNamedParam(
"select a, i.id from Item i join i.attachments a where i.id in (:items) order by index(a) ASC", "items",
ids);
ListMultimap<Long, Attachment> multiMap = ArrayListMultimap.create();
for( Object[] attachmentRow : attachments )
{
multiMap.put((Long) attachmentRow[1], (Attachment) attachmentRow[0]);
}
return multiMap;
}
ItemDaoImpl.java 文件源码
项目:Equella
阅读 24
收藏 0
点赞 0
评论 0
@Override
@Transactional(propagation = Propagation.MANDATORY)
public ListMultimap<Long, ItemNavigationNode> getNavigationNodesForItemIds(Collection<Long> ids)
{
if( ids.isEmpty() )
{
return ImmutableListMultimap.of();
}
List<Object[]> node = getHibernateTemplate().findByNamedParam(
"select n, i.id from ItemNavigationNode n join n.item i where i.id in (:items) order by n.index ASC",
"items", ids);
ListMultimap<Long, ItemNavigationNode> multiMap = ArrayListMultimap.create();
for( Object[] nodeRow : node )
{
multiMap.put((Long) nodeRow[1], (ItemNavigationNode) nodeRow[0]);
}
return multiMap;
}
ItemDaoImpl.java 文件源码
项目:Equella
阅读 37
收藏 0
点赞 0
评论 0
@Override
@Transactional(propagation = Propagation.MANDATORY)
public Multimap<Long, String> getCollaboratorsForItemIds(Collection<Long> itemIds)
{
if( itemIds.isEmpty() )
{
return ImmutableMultimap.of();
}
List<Object[]> attachments = getHibernateTemplate().findByNamedParam(
"select c, i.id from Item i join i.collaborators c where i.id in (:items)", "items", itemIds);
ListMultimap<Long, String> multiMap = ArrayListMultimap.create();
for( Object[] attachmentRow : attachments )
{
multiMap.put((Long) attachmentRow[1], (String) attachmentRow[0]);
}
return multiMap;
}
ItemCommentDaoImpl.java 文件源码
项目:Equella
阅读 32
收藏 0
点赞 0
评论 0
@SuppressWarnings("unchecked")
@Override
@Transactional(propagation = Propagation.MANDATORY)
public Multimap<Long, Comment> getCommentsForItems(Collection<Long> itemIds)
{
if( itemIds.isEmpty() )
{
return ImmutableListMultimap.of();
}
List<Object[]> attachments = getHibernateTemplate()
.findByNamedParam("select c, i.id from Item i join i.comments c where i.id in (:items)", "items", itemIds);
ListMultimap<Long, Comment> multiMap = ArrayListMultimap.create();
for( Object[] attachmentRow : attachments )
{
multiMap.put((Long) attachmentRow[1], (Comment) attachmentRow[0]);
}
return multiMap;
}
DataMerger.java 文件源码
项目:javaide
阅读 27
收藏 0
点赞 0
评论 0
/**
* Returns a map of the data items.
* @return a map of items.
*
* @see DataMap
*/
@NonNull
@Override
public ListMultimap<String, I> getDataMap() {
// put all the sets in a multimap. The result is that for each key,
// there is a sorted list of items from all the layers, including removed ones.
ListMultimap<String, I> fullItemMultimap = ArrayListMultimap.create();
for (S resourceSet : mDataSets) {
ListMultimap<String, I> map = resourceSet.getDataMap();
for (Map.Entry<String, Collection<I>> entry : map.asMap().entrySet()) {
fullItemMultimap.putAll(entry.getKey(), entry.getValue());
}
}
return fullItemMultimap;
}
AccessControlLists.java 文件源码
项目:ditb
阅读 26
收藏 0
点赞 0
评论 0
/**
* Reads user permission assignments stored in the <code>l:</code> column
* family of the first table row in <code>_acl_</code>.
*
* <p>
* See {@link AccessControlLists class documentation} for the key structure
* used for storage.
* </p>
*/
static ListMultimap<String, TablePermission> getPermissions(Configuration conf,
byte[] entryName) throws IOException {
if (entryName == null) entryName = ACL_GLOBAL_NAME;
// for normal user tables, we just read the table row from _acl_
ListMultimap<String, TablePermission> perms = ArrayListMultimap.create();
// TODO: Pass in a Connection rather than create one each time.
try (Connection connection = ConnectionFactory.createConnection(conf)) {
try (Table table = connection.getTable(ACL_TABLE_NAME)) {
Get get = new Get(entryName);
get.addFamily(ACL_LIST_FAMILY);
Result row = table.get(get);
if (!row.isEmpty()) {
perms = parsePermissions(entryName, row);
} else {
LOG.info("No permissions found in " + ACL_TABLE_NAME + " for acl entry "
+ Bytes.toString(entryName));
}
}
}
return perms;
}
ProtobufUtil.java 文件源码
项目:ditb
阅读 30
收藏 0
点赞 0
评论 0
/**
* Convert a ListMultimap<String, TablePermission> where key is username
* to a protobuf UserPermission
*
* @param perm the list of user and table permissions
* @return the protobuf UserTablePermissions
*/
public static AccessControlProtos.UsersAndPermissions toUserTablePermissions(
ListMultimap<String, TablePermission> perm) {
AccessControlProtos.UsersAndPermissions.Builder builder =
AccessControlProtos.UsersAndPermissions.newBuilder();
for (Map.Entry<String, Collection<TablePermission>> entry : perm.asMap().entrySet()) {
AccessControlProtos.UsersAndPermissions.UserPermissions.Builder userPermBuilder =
AccessControlProtos.UsersAndPermissions.UserPermissions.newBuilder();
userPermBuilder.setUser(ByteString.copyFromUtf8(entry.getKey()));
for (TablePermission tablePerm: entry.getValue()) {
userPermBuilder.addPermissions(toPermission(tablePerm));
}
builder.addUserPermissions(userPermBuilder.build());
}
return builder.build();
}
DOMRpcRoutingTable.java 文件源码
项目:hashsdn-controller
阅读 29
收藏 0
点赞 0
评论 0
DOMRpcRoutingTable remove(final DOMRpcImplementation implementation, final Set<DOMRpcIdentifier> rpcs) {
if (rpcs.isEmpty()) {
return this;
}
// First decompose the identifiers to a multimap
final ListMultimap<SchemaPath, YangInstanceIdentifier> toRemove = decomposeIdentifiers(rpcs);
// Now iterate over existing entries, modifying them as appropriate...
final Builder<SchemaPath, AbstractDOMRpcRoutingTableEntry> b = ImmutableMap.builder();
for (Entry<SchemaPath, AbstractDOMRpcRoutingTableEntry> e : this.rpcs.entrySet()) {
final List<YangInstanceIdentifier> removed = new ArrayList<>(toRemove.removeAll(e.getKey()));
if (!removed.isEmpty()) {
final AbstractDOMRpcRoutingTableEntry ne = e.getValue().remove(implementation, removed);
if (ne != null) {
b.put(e.getKey(), ne);
}
} else {
b.put(e);
}
}
// All done, whatever is in toRemove, was not there in the first place
return new DOMRpcRoutingTable(b.build(), schemaContext);
}
AbstractResourceRepository.java 文件源码
项目:javaide
阅读 32
收藏 0
点赞 0
评论 0
/**
* Returns the resources values matching a given {@link FolderConfiguration}.
*
* @param referenceConfig the configuration that each value must match.
* @return a map with guaranteed to contain an entry for each {@link ResourceType}
*/
@NonNull
public Map<ResourceType, Map<String, ResourceValue>> getConfiguredResources(
@NonNull FolderConfiguration referenceConfig) {
Map<ResourceType, Map<String, ResourceValue>> map = Maps.newEnumMap(ResourceType.class);
synchronized (ITEM_MAP_LOCK) {
Map<ResourceType, ListMultimap<String, ResourceItem>> itemMap = getMap();
for (ResourceType key : ResourceType.values()) {
// get the local results and put them in the map
map.put(key, getConfiguredResources(itemMap, key, referenceConfig));
}
}
return map;
}
AssignmentCreator.java 文件源码
项目:QDrill
阅读 27
收藏 0
点赞 0
评论 0
/**
* Does the work of creating the mappings for this AssignmentCreator
* @return the minor fragment id to work units mapping
*/
private ListMultimap<Integer, T> getMappings() {
Stopwatch watch = new Stopwatch();
watch.start();
maxWork = (int) Math.ceil(units.size() / ((float) incomingEndpoints.size()));
LinkedList<WorkEndpointListPair<T>> workList = getWorkList();
LinkedList<WorkEndpointListPair<T>> unassignedWorkList;
Map<DrillbitEndpoint,FragIteratorWrapper> endpointIterators = getEndpointIterators();
unassignedWorkList = assign(workList, endpointIterators, true);
assignLeftovers(unassignedWorkList, endpointIterators, true);
assignLeftovers(unassignedWorkList, endpointIterators, false);
if (unassignedWorkList.size() != 0) {
throw new DrillRuntimeException("There are still unassigned work units");
}
logger.debug("Took {} ms to assign {} work units to {} fragments", watch.elapsed(TimeUnit.MILLISECONDS), units.size(), incomingEndpoints.size());
return mappings;
}
TestAssignment.java 文件源码
项目:QDrill
阅读 26
收藏 0
点赞 0
评论 0
@Test
public void manyFiles() throws Exception {
List<CompleteFileWork> chunks = generateChunks(1000);
Iterator<DrillbitEndpoint> incomingEndpointsIterator = Iterators.cycle(endpoints);
List<DrillbitEndpoint> incomingEndpoints = Lists.newArrayList();
final int width = 28 * 30;
for (int i = 0; i < width; i++) {
incomingEndpoints.add(incomingEndpointsIterator.next());
}
ListMultimap<Integer, CompleteFileWork> mappings = AssignmentCreator.getMappings(incomingEndpoints, chunks, null);
System.out.println(mappings.keySet().size());
for (int i = 0; i < width; i++) {
Assert.assertTrue("no mapping for entry " + i, mappings.get(i) != null && mappings.get(i).size() > 0);
}
}
TestCompiler.java 文件源码
项目:guava-beta-checker
阅读 34
收藏 0
点赞 0
评论 0
/**
* Asserts that the given diagnostics contain errors with a message containing "[CheckerName]"
* on the given lines of the given file. If there should be multiple errors on a line, the line
* number must appear multiple times. There may not be any errors in any other file.
*/
public void assertErrorsOnLines(String file,
List<Diagnostic<? extends JavaFileObject>> diagnostics, long... lines) {
ListMultimap<String, Long> actualErrors = ArrayListMultimap.create();
for (Diagnostic<? extends JavaFileObject> diagnostic : diagnostics) {
String message = diagnostic.getMessage(Locale.US);
// The source may be null, e.g. for diagnostics about command-line flags
assertNotNull(message, diagnostic.getSource());
String sourceName = diagnostic.getSource().getName();
assertEquals(
"unexpected error in source file " + sourceName + ": " + message,
file, sourceName);
actualErrors.put(diagnostic.getSource().getName(), diagnostic.getLineNumber());
// any errors from the compiler that are not related to this checker should fail
assertThat(message).contains("[" + checker.getAnnotation(BugPattern.class).name() + "]");
}
assertEquals(
ImmutableMultiset.copyOf(Longs.asList(lines)),
ImmutableMultiset.copyOf(actualErrors.get(file)));
}
JvmComponentPlugin.java 文件源码
项目:Reer
阅读 27
收藏 0
点赞 0
评论 0
private static void validateNoDuplicate(ModelMap<LocalJava> jdks) {
ListMultimap<String, LocalJava> jdksByPath = indexByPath(jdks);
List<String> errors = Lists.newArrayList();
for (String path : jdksByPath.keySet()) {
checkDuplicateForPath(jdksByPath, path, errors);
}
if (!errors.isEmpty()) {
throw new InvalidModelException(String.format("Duplicate Java installation found:\n%s", Joiner.on("\n").join(errors)));
}
}
JvmComponentPlugin.java 文件源码
项目:Reer
阅读 29
收藏 0
点赞 0
评论 0
private static void checkDuplicateForPath(ListMultimap<String, LocalJava> index, String path, List<String> errors) {
List<LocalJava> localJavas = index.get(path);
if (localJavas.size() > 1) {
errors.add(String.format(" - %s are both pointing to the same JDK installation path: %s",
Joiner.on(", ").join(Iterables.transform(localJavas, new Function<LocalJava, String>() {
@Override
public String apply(LocalJava input) {
return "'" + input.getName() + "'";
}
})), path));
}
}