}
public List<ActiveRuleDto> findByProfileKey(QualityProfileKey profileKey, DbSession session) {
- int id = this.getQualityProfileId(profileKey, session);
- return mapper(session).selectByProfileId(id);
+ //TODO try/catch due to legacy selectByProfileId SQL.
+ try {
+ int id = this.getQualityProfileId(profileKey, session);
+ return mapper(session).selectByProfileId(id);
+ } catch (Exception e) {
+ throw new IllegalArgumentException("Quality profile not found: "+profileKey.toString());
+ }
}
public void removeParamByProfileKey(QualityProfileKey profileKey, DbSession session) {
getClient()
.prepareDelete()
.setIndex(this.getIndexName())
- .setType(this.indexDefinition.getIndexType())
- .setIndex(this.getKeyValue(key))
+ .setType(this.getIndexType())
+ .setId(this.getKeyValue(key))
.get();
}
//TODO don't really know what to do here for the moment...
} else {
throw new IllegalStateException("Index " + this.getIndexName() +
- " cannot execute INSERT for class: " + obj.getClass());
+ " cannot execute DELETE for class: " + obj.getClass());
}
}
try {
this.deleteDocument(key);
} catch (Exception e) {
- LOG.error("Could not DELETE _id:{} for index {}: {}",
+ LOG.error("Could not DELETE _id = '{}' for index '{}': {}",
this.getKeyValue(key), this.getIndexName(), e.getMessage());
}
}
}
@Test
- @Ignore
public void deactivate() throws Exception {
// activation
grantPermission();
}
@Test
- @Ignore
public void deactivation_fails_if_profile_not_found() throws Exception {
grantPermission();
ActiveRuleKey key = ActiveRuleKey.of(QualityProfileKey.of("other", "js"), RuleKey.of("xoo", "x1"));
fail();
} catch (IllegalArgumentException e) {
assertThat(e).hasMessage("Quality profile not found: other:js");
- verifyZeroActiveRules(key);
}
}