Fix some code smells
Signed-off-by: SirWayne <dennis.melzer@bosch-si.com>
This commit is contained in:
@@ -820,8 +820,8 @@ public class DistributionSetManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Test different assignment results, after assign a ds")
|
@Description("Verfiy that the DistributionSetAssignmentResult not contains already assigned targets.")
|
||||||
public void testAlreadyAssignedTargetsToDs() {
|
public void verifyDistributionSetAssignmentResultNotContainsAlreadyAssignedTargets() {
|
||||||
DistributionSet dsToTargetAssigned = testdataFactory.createDistributionSet("ds-3");
|
DistributionSet dsToTargetAssigned = testdataFactory.createDistributionSet("ds-3");
|
||||||
|
|
||||||
// create assigned DS
|
// create assigned DS
|
||||||
@@ -829,8 +829,7 @@ public class DistributionSetManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
dsToTargetAssigned.getVersion());
|
dsToTargetAssigned.getVersion());
|
||||||
final Target target = new JpaTarget("4712");
|
final Target target = new JpaTarget("4712");
|
||||||
final Target savedTarget = targetManagement.createTarget(target);
|
final Target savedTarget = targetManagement.createTarget(target);
|
||||||
final List<Target> toAssign = new ArrayList<>();
|
final List<Target> toAssign = Lists.newArrayList(savedTarget);
|
||||||
toAssign.add(savedTarget);
|
|
||||||
DistributionSetAssignmentResult assignmentResult = deploymentManagement
|
DistributionSetAssignmentResult assignmentResult = deploymentManagement
|
||||||
.assignDistributionSet(dsToTargetAssigned, toAssign);
|
.assignDistributionSet(dsToTargetAssigned, toAssign);
|
||||||
assertThat(assignmentResult.getAssignedEntity()).hasSize(1);
|
assertThat(assignmentResult.getAssignedEntity()).hasSize(1);
|
||||||
|
|||||||
@@ -518,7 +518,6 @@ public class TargetTable extends AbstractTable<Target, TargetIdName> {
|
|||||||
* Set style of target table.
|
* Set style of target table.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("serial")
|
|
||||||
private void styleTargetTable() {
|
private void styleTargetTable() {
|
||||||
setCellStyleGenerator((source, itemId, propertyId) -> null);
|
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(),
|
final String targTagName = HawkbitCommonUtil.removePrefix(event.getTransferable().getSourceComponent().getId(),
|
||||||
SPUIDefinitions.TARGET_TAG_ID_PREFIXS);
|
SPUIDefinitions.TARGET_TAG_ID_PREFIXS);
|
||||||
if (targetList.isEmpty()) {
|
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);
|
notification.displayValidationError(actionDidNotWork);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,6 +66,25 @@ public class I18N implements Serializable {
|
|||||||
* @see #getLocale()
|
* @see #getLocale()
|
||||||
*/
|
*/
|
||||||
public String get(final String code, final Object... args) {
|
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 {
|
try {
|
||||||
return source.getMessage(code, args, getLocale());
|
return source.getMessage(code, args, getLocale());
|
||||||
} catch (final NoSuchMessageException ex) {
|
} catch (final NoSuchMessageException ex) {
|
||||||
|
|||||||
Reference in New Issue
Block a user