Test mixed registration operations
POIFSReaderRegistry registry = new POIFSReaderRegistry();
for (int j = 0; j < listeners.length; j++)
{
for (int k = 0; k < paths.length; k++)
{
for (int n = 0; n < names.length; n++)
{
if ((j != k) && (k != n))
{
registry.registerListener(listeners[ j ], paths[ k ],
names[ n ]);
}
}
}
}
for (int k = 0; k < paths.length; k++)
{
for (int n = 0; n < names.length; n++)
{
Iterator listeners = registry.getListeners(paths[ k ],
names[ n ]);
if (k == n)
{
assertTrue(!listeners.hasNext());
}
else
{
Set registeredListeners = new HashSet();
while (listeners.hasNext())
{
registeredListeners.add(listeners.next());
}
assertEquals(this.listeners.length - 1,
registeredListeners.size());
for (int j = 0; j < this.listeners.length; j++)
{
if (j == k)
{
assertTrue(!registeredListeners
.contains(this.listeners[ j ]));
}
else
{
assertTrue(registeredListeners
.contains(this.listeners[ j ]));
}
}
}
}
}
for (int j = 0; j < listeners.length; j++)
{
registry.registerListener(listeners[ j ]);
}
for (int k = 0; k < paths.length; k++)
{
for (int n = 0; n < names.length; n++)
{
Iterator listeners =
registry.getListeners(paths[ k ], names[ n ]);
Set registeredListeners = new HashSet();
while (listeners.hasNext())
{
registeredListeners.add(listeners.next());
}
assertEquals(this.listeners.length,
registeredListeners.size());
for (int j = 0; j < this.listeners.length; j++)
{
assertTrue(registeredListeners
.contains(this.listeners[ j ]));
}
}
}