Fix some code smells

Signed-off-by: SirWayne <dennis.melzer@bosch-si.com>
This commit is contained in:
SirWayne
2016-08-16 13:20:07 +02:00
parent aa5e4d0601
commit e65849b922
3 changed files with 23 additions and 6 deletions

View File

@@ -820,8 +820,8 @@ public class DistributionSetManagementTest extends AbstractJpaIntegrationTest {
}
@Test
@Description("Test different assignment results, after assign a ds")
public void testAlreadyAssignedTargetsToDs() {
@Description("Verfiy that the DistributionSetAssignmentResult not contains already assigned targets.")
public void verifyDistributionSetAssignmentResultNotContainsAlreadyAssignedTargets() {
DistributionSet dsToTargetAssigned = testdataFactory.createDistributionSet("ds-3");
// create assigned DS
@@ -829,8 +829,7 @@ public class DistributionSetManagementTest extends AbstractJpaIntegrationTest {
dsToTargetAssigned.getVersion());
final Target target = new JpaTarget("4712");
final Target savedTarget = targetManagement.createTarget(target);
final List<Target> toAssign = new ArrayList<>();
toAssign.add(savedTarget);
final List<Target> toAssign = Lists.newArrayList(savedTarget);
DistributionSetAssignmentResult assignmentResult = deploymentManagement
.assignDistributionSet(dsToTargetAssigned, toAssign);
assertThat(assignmentResult.getAssignedEntity()).hasSize(1);

View File

@@ -518,7 +518,6 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> {
* Set style of target table.
*
*/
@SuppressWarnings("serial")
private void styleTargetTable() {
setCellStyleGenerator((source, itemId, propertyId) -> null);
}
@@ -559,7 +558,7 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> {
final String targTagName = HawkbitCommonUtil.removePrefix(event.getTransferable().getSourceComponent().getId(),
SPUIDefinitions.TARGET_TAG_ID_PREFIXS);
if (targetList.isEmpty()) {
final String actionDidNotWork = i18n.get("message.action.did.not.work", new Object[] {});
final String actionDidNotWork = i18n.get("message.action.did.not.work");
notification.displayValidationError(actionDidNotWork);
return;
}

View File

@@ -66,6 +66,25 @@ public class I18N implements Serializable {
* @see #getLocale()
*/
public String get(final String code, final Object... args) {
return getMessage(code, args);
}
/**
* Tries to resolve the message.
*
* @param code
* the code to lookup up.
*
* @return the resolved message, or the message code if the lookup fails.
*
* @see MessageSource#getMessage(String, Object[], Locale)
* @see #getLocale()
*/
public String get(final String code) {
return getMessage(code, null);
}
private String getMessage(final String code, final Object[] args) {
try {
return source.getMessage(code, args, getLocale());
} catch (final NoSuchMessageException ex) {