Handler h = new Handler() {
@Override
public void publish(LogRecord record) {
NetBeansModules.NBMData newData = modules.process(record);
ModuleInfo info;
assertNotNull(newData);
data[0] = modules.join(newData, data[0]);
switch (counter++) {
case 0://first record
assertNotNull(newData.allEnabled);
assertNotNull(newData.allEnabled.get(resolver));
assertEquals(1, newData.allEnabled.get(resolver).intValue());
if (withVersions) {
assertNotNull(newData.enabled);
assertNull(newData.disabled);
info = newData.enabled.get(resolver);
assertEquals(1, info.count(resolverVersion).intValue());
assertNull(info.count(rubyVersion));
info = newData.enabled.get(ruby);
assertNull(info);
}
break;
case 1://second record
if (withVersions) {
assertNotNull(data[0]);
assertNotNull(newData.disabled);
assertNull(newData.enabled);
info = newData.disabled.get(ruby);
assertNull(info);
info = newData.disabled.get(bridge);
assertNotNull(info);
//first + second record
assertNotNull(data[0]);
assertNotNull(data[0].disabled);
assertNotNull(data[0].enabled);
info = data[0].disabled.get(bridge);
assertNotNull(info);
}
assertEquals(1, newData.allDisabled.get(bridge).intValue());
assertEquals(1, data[0].allEnabled.get(resolver).intValue());
assertNull(data[0].allEnabled.get(bridge));
assertNull(newData.allDisabled.get(resolver));
if (withVersions) {
info = data[0].enabled.get(resolver);
assertNotNull(info);
assertEquals(1, info.count(resolverVersion).intValue());
assertNull(info.count(rubyVersion));
info = data[0].disabled.get(ruby);
assertNull(info);
}
break;
case 2:// first + second + third
if (withVersions) {
assertNotNull(data[0]);
assertNotNull(data[0].disabled);
assertNotNull(data[0].enabled);
info = data[0].disabled.get(bridge);
assertNotNull(info);
info = data[0].enabled.get(resolver);
assertNotNull(info);
assertEquals(2, info.count(resolverVersion).intValue());
assertNull(info.count(rubyVersion));
}
assertEquals(1, data[0].allDisabled.get(bridge).intValue());
assertEquals(2, data[0].allEnabled.get(resolver).intValue());
assertEquals(1, data[0].allEnabled.get(ruby).intValue());
if (withVersions) {
info = data[0].enabled.get(ruby);
assertNotNull(info);
assertEquals(1, info.count(rubyVersion).intValue());
assertNull(info.count(resolverVersion));
}
break;
case 3://first...fourth
if (withVersions) {
assertNotNull(data[0]);
assertNotNull(data[0].disabled);
assertNotNull(data[0].enabled);
info = data[0].disabled.get(bridge);
assertNotNull(info);
assertEquals(2, info.count(bridgeVersion).intValue());
assertNull(info.count(rubyVersion));
info = data[0].enabled.get(resolver);
assertNotNull(info);
assertEquals(2, info.count(resolverVersion).intValue());
assertNull(info.count(rubyVersion));
}
assertEquals(2, data[0].allDisabled.get(bridge).intValue());
assertEquals(2, data[0].allEnabled.get(resolver).intValue());
assertEquals(1, data[0].allEnabled.get(ruby).intValue());
if (withVersions) {
info = data[0].enabled.get(ruby);
assertNotNull(info);
assertEquals(1, info.count(rubyVersion).intValue());
assertNull(info.count(resolverVersion));
}
break;
case 4:
break;
case 5://whole modules file
if (withVersions) {
assertNotNull(data[0]);
assertNotNull(data[0].disabled);
assertNotNull(data[0].enabled);
info = data[0].disabled.get(bridge);
assertNotNull(info);
assertEquals(2, info.count(bridgeVersion).intValue());
assertEquals(1, info.count(bridgeVersion2).intValue());
assertNull(info.count(rubyVersion));
}
assertEquals(3, data[0].allDisabled.get(bridge).intValue());
assertEquals(3, data[0].allEnabled.get(resolver).intValue());
if (withVersions) {
info = data[0].enabled.get(resolver);
assertNotNull(info);
assertEquals(3, info.count(resolverVersion).intValue());
assertNull(info.count(rubyVersion));
info = data[0].enabled.get(ruby);
assertNotNull(info);
assertEquals(1, info.count(rubyVersion).intValue());
assertNull(info.count(resolverVersion));
info = data[0].enabled.get(j2eeProfiler);
assertNotNull(info);
info = data[0].disabled.get(j2eeProfiler);
assertNotNull(info);
}else{