Skip to content

Commit

Permalink
Upgrade Jira version to 9.12.5 (LTS)
Browse files Browse the repository at this point in the history
  • Loading branch information
pathob committed Mar 19, 2024
1 parent ddf75e7 commit 0cc2801
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 34 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
</developers>

<properties>
<jira.version>8.15.0</jira.version>
<jira.version>9.12.5</jira.version>
<jira.data.version>8.12.1</jira.data.version>
<!-- other properties -->
<atlassian.ajp.port>8209</atlassian.ajp.port>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,27 @@
import com.atlassian.jira.config.properties.ApplicationProperties;
import com.atlassian.jira.config.properties.LnFDefaultColorProvider;
import com.atlassian.jira.config.properties.LogoProvider;
import com.atlassian.jira.config.properties.UiSettingsStateManager;
import com.atlassian.jira.config.util.JiraHome;
import com.atlassian.jira.lookandfeel.LogoChoice;
import com.atlassian.jira.lookandfeel.LookAndFeelProperties;
import com.atlassian.jira.lookandfeel.upload.UploadService;
import com.atlassian.jira.security.JiraAuthenticationContext;
import com.atlassian.sal.api.pluginsettings.PluginSettings;
import com.atlassian.sal.api.pluginsettings.PluginSettingsFactory;
import de.aservo.confapi.commons.exception.InternalServerErrorException;
import de.aservo.confapi.commons.model.SettingsBrandingColorSchemeBean;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.MockedStatic;
import org.mockito.junit.jupiter.MockitoExtension;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Map;

import static de.aservo.confapi.jira.model.util.SettingsColourSchemeBeanUtilTest.getDummyBaseColourScheme;
import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.*;

@ExtendWith(MockitoExtension.class)
Expand Down Expand Up @@ -77,49 +77,47 @@ void testSetColourScheme() {
assertEquals(schemeBean.getTopBar(), colourScheme.getTopBar());
}

//InternalServerErrorException -> FileNotFoundException is expected because no logofile is present in the filesystem at test time
@Test
void testGetLogo() {
assertThrows(InternalServerErrorException.class, () -> {
settingsBrandingService.getLogo();
});
settingsBrandingService.getLogo();
verify(uploadService).getLogoDirectory();
}

@Test
void testSetLogo() {
InputStream is = new ByteArrayInputStream("".getBytes());

try (MockedStatic<ComponentAccessor> componentAccessorMockedStatic = mockStatic(ComponentAccessor.class)) {
componentAccessorMockedStatic.when(() -> ComponentAccessor.getComponent(LnFDefaultColorProvider.class)).thenReturn(mock(LnFDefaultColorProvider.class));
componentAccessorMockedStatic.when(() -> ComponentAccessor.getComponent(LogoProvider.class)).thenReturn(mock(LogoProvider.class));
componentAccessorMockedStatic.when(() -> ComponentAccessor.getComponent(EventPublisher.class)).thenReturn(mock(EventPublisher.class));

settingsBrandingService.setLogo(is);
void testSetLogo() throws IOException {
try (InputStream is = getClass().getClassLoader().getResourceAsStream("images/plugin-icon.png")) {
try (MockedStatic<ComponentAccessor> componentAccessorMockedStatic = mockStatic(ComponentAccessor.class)) {
componentAccessorMockedStatic.when(() -> ComponentAccessor.getComponent(LnFDefaultColorProvider.class)).thenReturn(mock(LnFDefaultColorProvider.class));
componentAccessorMockedStatic.when(() -> ComponentAccessor.getComponent(LogoProvider.class)).thenReturn(mock(LogoProvider.class));
componentAccessorMockedStatic.when(() -> ComponentAccessor.getComponent(EventPublisher.class)).thenReturn(mock(EventPublisher.class));
componentAccessorMockedStatic.when(() -> ComponentAccessor.getComponent(UiSettingsStateManager.class)).thenReturn(mock(UiSettingsStateManager.class));

settingsBrandingService.setLogo(is);
}

verify(lookAndFeelProperties).setLogoChoice(LogoChoice.UPLOAD);
}

verify(lookAndFeelProperties).setLogoChoice(LogoChoice.UPLOAD);
}

//InternalServerErrorException -> FileNotFoundException is expected because no logofile is present in the filesystem at test time
@Test
void testGetFavicon() {
assertThrows(InternalServerErrorException.class, () -> {
settingsBrandingService.getFavicon();
});
settingsBrandingService.getFavicon();
verify(uploadService).getLogoDirectory();
}

@Test
void testSetFavicon() {
final InputStream is = new ByteArrayInputStream("".getBytes());

try (MockedStatic<ComponentAccessor> componentAccessorMockedStatic = mockStatic(ComponentAccessor.class)) {
componentAccessorMockedStatic.when(() -> ComponentAccessor.getComponent(LnFDefaultColorProvider.class)).thenReturn(mock(LnFDefaultColorProvider.class));
componentAccessorMockedStatic.when(() -> ComponentAccessor.getComponent(LogoProvider.class)).thenReturn(mock(LogoProvider.class));
componentAccessorMockedStatic.when(() -> ComponentAccessor.getComponent(EventPublisher.class)).thenReturn(mock(EventPublisher.class));

settingsBrandingService.setFavicon(is);
void testSetFavicon() throws IOException {
try (InputStream is = getClass().getClassLoader().getResourceAsStream("images/plugin-icon.png")) {
try (MockedStatic<ComponentAccessor> componentAccessorMockedStatic = mockStatic(ComponentAccessor.class)) {
componentAccessorMockedStatic.when(() -> ComponentAccessor.getComponent(LnFDefaultColorProvider.class)).thenReturn(mock(LnFDefaultColorProvider.class));
componentAccessorMockedStatic.when(() -> ComponentAccessor.getComponent(LogoProvider.class)).thenReturn(mock(LogoProvider.class));
componentAccessorMockedStatic.when(() -> ComponentAccessor.getComponent(EventPublisher.class)).thenReturn(mock(EventPublisher.class));
componentAccessorMockedStatic.when(() -> ComponentAccessor.getComponent(UiSettingsStateManager.class)).thenReturn(mock(UiSettingsStateManager.class));

settingsBrandingService.setFavicon(is);
}

verify(lookAndFeelProperties).setFaviconChoice(LogoChoice.UPLOAD);
}

verify(lookAndFeelProperties).setFaviconChoice(LogoChoice.UPLOAD);
}
}

0 comments on commit 0cc2801

Please sign in to comment.