Skip to content

Commit

Permalink
Code fixes, documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
cuioss committed Jul 28, 2023
1 parent 318c771 commit 0d9f238
Show file tree
Hide file tree
Showing 12 changed files with 3 additions and 115 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,6 @@ public class PortalNavigationMenuItemImplBase extends PortalNavigationMenuConfig
@Setter
private String iconStyleClass;

/** @deprecated use {@link #isRendered()} instead */
@Getter
@Setter
@Deprecated
private boolean disabled = false;

@Getter
@Setter
private String titleKey;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,4 @@ default boolean isAnyMessageAvailable() {
return !getMessages().isEmpty();
}

/**
* Remove all stored StickyMessages
*
* @Deprecated because it will delete all messages without filtering. Please
* rethink usage of the {@link StickyMessageProducer} and consider
* using {@link StickyMessageProvider}
*/
@Deprecated
void clearStoredMessages();
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
* <li>Or, <em>preferred</em>, configure the default implementation provided by
* the portal accordingly by Registering concrete instances of
* {@link de.cuioss.portal.ui.api.templating.StaticTemplateDescriptor}</li>
* <ul>
* </ul>
*
* @author Oliver Wolff
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,6 @@ public void dismissListener(final ModelPayloadEvent dismissEvent) {
removeMessage((StickyMessage) dismissEvent.getModel());
}

@Override
public void clearStoredMessages() {
messageSet.clear();
}

/**
* @return {@code true} if at least one message is available, {@code false}
* otherwise
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
@Dependent
public class LazyLoadingViewModelImpl<T> implements LazyLoadingThreadModel<T>, ErrorController {

@SuppressWarnings("java:S2245") // owolff: Random no security flaw, because we use it for internal
// identification of threads
private static final Random RANDOM = new Random();

private static final long serialVersionUID = -3343380539839996245L;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,6 @@ public String getIconStyleClass() {
return null;
}

@Override
public boolean isDisabled() {
return false;
}

@Override
public int compareTo(final NavigationMenuItem other) {
return getOrder().compareTo(other.getOrder());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,24 +55,6 @@ void shouldProvidePosibilityToRemoveMessageByUi() {
assertThatNoMessagesStored();
}

@Test
void shouldSupportToRemoveMessages() {
final var messageKey = letterStrings(10, 20).next();
final var parameter = letterStrings(10, 20).next();
final var expectedInfoMessage = new StickyMessage(true, ContextState.INFO, new DisplayName(messageKey));
final var expectedWarningMessage = new StickyMessage(true, ContextState.WARNING, new DisplayName(messageKey));
assertThatNoMessagesStored();

underTest.setInfoMessage(messageKey, parameter);
underTest.setWarningMessage(messageKey, parameter);

assertTrue(underTest.getMessages().contains(expectedInfoMessage));
assertTrue(underTest.getMessages().contains(expectedWarningMessage));

underTest.clearStoredMessages();
assertThatNoMessagesStored();
}

private StickyMessage addAnyMessageToStorage() {
final var stickyMessage = new StickyMessage(true, CONTEXT_STATE_GENERATOR.next(),
new DisplayName(letterStrings(10, 20).next()));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package de.cuioss.portal.ui.runtime.application.listener.view;

import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

import javax.inject.Inject;

Expand Down Expand Up @@ -33,10 +32,6 @@ class StickyMessageCollectorViewListenerTest
@Test
void shouldCollectMessages() {

stickyMessageProducer.clearStoredMessages();

assertTrue(stickyMessageProducer.getMessages().isEmpty(), "Expected no message available");

underTest.handleView(null);

assertFalse(stickyMessageProducer.getMessages().isEmpty(), "Expected one message available");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,6 @@ public void removeMessage(final StickyMessage message) {
messages.remove(message);
}

@Override
public void clearStoredMessages() {
messages.clear();
}

/**
* @param messageKey key that should be present in the added
* {@linkplain StickyMessage#getMessage()}s
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import javax.inject.Inject;

import org.jboss.weld.junit5.auto.EnableAutoWeld;
import org.junit.jupiter.api.Test;

import de.cuioss.portal.ui.api.message.PortalStickyMessageProducer;
import de.cuioss.test.valueobjects.junit5.contracts.ShouldBeNotNull;
Expand All @@ -17,9 +16,4 @@ class PortalStickyMessageProducerMockTest implements ShouldBeNotNull<PortalStick
@Inject
private PortalStickyMessageProducerMock underTest;

@Test
void shouldDefaultSensibly() {
underTest.clearStoredMessages();
}

}

0 comments on commit 0d9f238

Please sign in to comment.