mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-13 00:45:44 +01:00
Remove temp dir extension and use native junit annotation
This commit is contained in:
committed by
René Pfeuffer
parent
6cde2a90cc
commit
7636f1e845
@@ -26,7 +26,7 @@ package sonia.scm;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.junitpioneer.jupiter.TempDirectory;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
|
||||
@@ -36,14 +36,14 @@ import java.util.Properties;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
@ExtendWith({MockitoExtension.class, TempDirectory.class})
|
||||
@ExtendWith({MockitoExtension.class})
|
||||
class ScmLogFilePropertyDefinerTest {
|
||||
|
||||
@Mock
|
||||
private SCMContextProvider context;
|
||||
|
||||
@Test
|
||||
void shouldReturnPath(@TempDirectory.TempDir Path tempDir) {
|
||||
void shouldReturnPath(@TempDir Path tempDir) {
|
||||
when(context.getBaseDirectory()).thenReturn(tempDir.toFile());
|
||||
ScmLogFilePropertyDefiner definer = builder().create();
|
||||
|
||||
@@ -52,7 +52,7 @@ class ScmLogFilePropertyDefinerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldReturnOsxPath(@TempDirectory.TempDir Path tempDir) {
|
||||
void shouldReturnOsxPath(@TempDir Path tempDir) {
|
||||
ScmLogFilePropertyDefiner definer = builder()
|
||||
.withOs("Mac OS X")
|
||||
.withUserHome(tempDir.toAbsolutePath().toString())
|
||||
|
||||
@@ -21,12 +21,12 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
package sonia.scm.lifecycle;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.junitpioneer.jupiter.TempDirectory;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
@@ -41,7 +41,7 @@ import java.nio.file.Paths;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
|
||||
@ExtendWith({MockitoExtension.class, TempDirectory.class})
|
||||
@ExtendWith({MockitoExtension.class})
|
||||
class VersionsTest {
|
||||
|
||||
@Mock
|
||||
@@ -51,7 +51,7 @@ class VersionsTest {
|
||||
private Versions versions;
|
||||
|
||||
@Test
|
||||
void shouldReturnTrueForVersionsPreviousTo160(@TempDirectory.TempDir Path directory) throws IOException {
|
||||
void shouldReturnTrueForVersionsPreviousTo160(@TempDir Path directory) throws IOException {
|
||||
setVersion(directory, "1.59");
|
||||
assertThat(versions.isPreviousVersionTooOld()).isTrue();
|
||||
|
||||
@@ -60,19 +60,19 @@ class VersionsTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldReturnFalseForVersion160(@TempDirectory.TempDir Path directory) throws IOException {
|
||||
void shouldReturnFalseForVersion160(@TempDir Path directory) throws IOException {
|
||||
setVersion(directory, "1.60");
|
||||
assertThat(versions.isPreviousVersionTooOld()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldNotFailIfVersionContainsLineBreak(@TempDirectory.TempDir Path directory) throws IOException {
|
||||
void shouldNotFailIfVersionContainsLineBreak(@TempDir Path directory) throws IOException {
|
||||
setVersion(directory, "1.59\n");
|
||||
assertThat(versions.isPreviousVersionTooOld()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldReturnFalseForVersionsNewerAs160(@TempDirectory.TempDir Path directory) throws IOException {
|
||||
void shouldReturnFalseForVersionsNewerAs160(@TempDir Path directory) throws IOException {
|
||||
setVersion(directory, "1.61");
|
||||
assertThat(versions.isPreviousVersionTooOld()).isFalse();
|
||||
|
||||
@@ -81,13 +81,13 @@ class VersionsTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldReturnFalseForNonExistingVersionFile(@TempDirectory.TempDir Path directory) {
|
||||
void shouldReturnFalseForNonExistingVersionFile(@TempDir Path directory) {
|
||||
setVersionFile(directory.resolve("version.txt"));
|
||||
assertThat(versions.isPreviousVersionTooOld()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldWriteNewVersion(@TempDirectory.TempDir Path directory) {
|
||||
void shouldWriteNewVersion(@TempDir Path directory) {
|
||||
Path config = directory.resolve("config");
|
||||
doReturn(config).when(contextProvider).resolve(Paths.get("config"));
|
||||
doReturn("2.0.0").when(contextProvider).getVersion();
|
||||
|
||||
@@ -34,7 +34,7 @@ import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Nested;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.junitpioneer.jupiter.TempDirectory;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Captor;
|
||||
import org.mockito.InjectMocks;
|
||||
@@ -48,7 +48,6 @@ import sonia.scm.lifecycle.Restarter;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@@ -56,7 +55,6 @@ import static java.util.Arrays.asList;
|
||||
import static java.util.Collections.singleton;
|
||||
import static java.util.Collections.singletonList;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.in;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.mockito.Mockito.any;
|
||||
import static org.mockito.Mockito.doNothing;
|
||||
@@ -72,7 +70,6 @@ import static sonia.scm.plugin.PluginTestHelper.createAvailable;
|
||||
import static sonia.scm.plugin.PluginTestHelper.createInstalled;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
@ExtendWith(TempDirectory.class)
|
||||
class DefaultPluginManagerTest {
|
||||
|
||||
@Mock
|
||||
@@ -372,7 +369,7 @@ class DefaultPluginManagerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldCreateUninstallFile(@TempDirectory.TempDir Path temp) {
|
||||
void shouldCreateUninstallFile(@TempDir Path temp) {
|
||||
InstalledPlugin mailPlugin = createInstalled("scm-mail-plugin");
|
||||
when(mailPlugin.getDirectory()).thenReturn(temp);
|
||||
|
||||
@@ -384,7 +381,7 @@ class DefaultPluginManagerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldMarkPluginForUninstall(@TempDirectory.TempDir Path temp) {
|
||||
void shouldMarkPluginForUninstall(@TempDir Path temp) {
|
||||
InstalledPlugin mailPlugin = createInstalled("scm-mail-plugin");
|
||||
when(mailPlugin.getDirectory()).thenReturn(temp);
|
||||
|
||||
@@ -414,7 +411,7 @@ class DefaultPluginManagerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldThrowExceptionWhenUninstallingCorePlugin(@TempDirectory.TempDir Path temp) {
|
||||
void shouldThrowExceptionWhenUninstallingCorePlugin(@TempDir Path temp) {
|
||||
InstalledPlugin mailPlugin = createInstalled("scm-mail-plugin");
|
||||
when(mailPlugin.getDirectory()).thenReturn(temp);
|
||||
when(mailPlugin.isCore()).thenReturn(true);
|
||||
@@ -484,7 +481,7 @@ class DefaultPluginManagerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldUndoPendingInstallations(@TempDirectory.TempDir Path temp) throws IOException {
|
||||
void shouldUndoPendingInstallations(@TempDir Path temp) throws IOException {
|
||||
InstalledPlugin mailPlugin = createInstalled("scm-ssh-plugin");
|
||||
Path mailPluginPath = temp.resolve("scm-mail-plugin");
|
||||
Files.createDirectories(mailPluginPath);
|
||||
|
||||
@@ -21,12 +21,12 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
package sonia.scm.plugin;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.junitpioneer.jupiter.TempDirectory;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
import org.mockito.Answers;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
@@ -39,14 +39,14 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
@ExtendWith({MockitoExtension.class, TempDirectory.class})
|
||||
@ExtendWith({MockitoExtension.class})
|
||||
class PendingPluginInstallationTest {
|
||||
|
||||
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
|
||||
private AvailablePlugin plugin;
|
||||
|
||||
@Test
|
||||
void shouldDeleteFileOnCancel(@TempDirectory.TempDir Path directory) throws IOException {
|
||||
void shouldDeleteFileOnCancel(@TempDir Path directory) throws IOException {
|
||||
Path file = directory.resolve("file");
|
||||
Files.write(file, "42".getBytes());
|
||||
|
||||
@@ -59,7 +59,7 @@ class PendingPluginInstallationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldThrowExceptionIfCancelFailed(@TempDirectory.TempDir Path directory) {
|
||||
void shouldThrowExceptionIfCancelFailed(@TempDir Path directory) {
|
||||
Path file = directory.resolve("file");
|
||||
when(plugin.getDescriptor().getInformation().getName()).thenReturn("scm-awesome-plugin");
|
||||
|
||||
|
||||
@@ -21,13 +21,13 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
package sonia.scm.plugin;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.junitpioneer.jupiter.TempDirectory;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
import org.mockito.Answers;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
@@ -45,9 +45,13 @@ import java.util.Collections;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.*;
|
||||
import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
|
||||
import static org.mockito.Mockito.anyInt;
|
||||
import static org.mockito.Mockito.lenient;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
@ExtendWith({MockitoExtension.class, TempDirectory.class})
|
||||
@ExtendWith({MockitoExtension.class})
|
||||
class PluginInstallerTest {
|
||||
|
||||
@Mock
|
||||
@@ -65,7 +69,7 @@ class PluginInstallerTest {
|
||||
private Path directory;
|
||||
|
||||
@BeforeEach
|
||||
void setUpContext(@TempDirectory.TempDir Path directory) throws IOException {
|
||||
void setUpContext(@TempDir Path directory) throws IOException {
|
||||
this.directory = directory;
|
||||
lenient().when(context.resolve(any())).then(ic -> {
|
||||
Path arg = ic.getArgument(0);
|
||||
|
||||
@@ -21,13 +21,12 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
package sonia.scm.plugin;
|
||||
|
||||
import org.assertj.core.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.junitpioneer.jupiter.TempDirectory;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
@@ -38,7 +37,6 @@ import java.util.zip.ZipOutputStream;
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
@ExtendWith(TempDirectory.class)
|
||||
class SmpDescriptorExtractorTest {
|
||||
|
||||
private static final String PLUGIN_XML = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n" +
|
||||
@@ -66,7 +64,7 @@ class SmpDescriptorExtractorTest {
|
||||
"</plugin>\n";
|
||||
|
||||
@Test
|
||||
void shouldExtractPluginXml(@TempDirectory.TempDir Path tempDir) throws IOException {
|
||||
void shouldExtractPluginXml(@TempDir Path tempDir) throws IOException {
|
||||
Path pluginFile = createZipFile(tempDir, "META-INF/scm/plugin.xml", PLUGIN_XML);
|
||||
|
||||
InstalledPluginDescriptor installedPluginDescriptor = new SmpDescriptorExtractor().extractPluginDescriptor(pluginFile);
|
||||
@@ -75,14 +73,14 @@ class SmpDescriptorExtractorTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldFailWithoutPluginXml(@TempDirectory.TempDir Path tempDir) throws IOException {
|
||||
void shouldFailWithoutPluginXml(@TempDir Path tempDir) throws IOException {
|
||||
Path pluginFile = createZipFile(tempDir, "META-INF/wrong/plugin.xml", PLUGIN_XML);
|
||||
|
||||
assertThrows(IOException.class, () -> new SmpDescriptorExtractor().extractPluginDescriptor(pluginFile));
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldFailWithIllegalPluginXml(@TempDirectory.TempDir Path tempDir) throws IOException {
|
||||
void shouldFailWithIllegalPluginXml(@TempDir Path tempDir) throws IOException {
|
||||
Path pluginFile = createZipFile(tempDir, "META-INF/scm/plugin.xml", "<not><parsable>content</parsable></not>");
|
||||
|
||||
assertThrows(IOException.class, () -> new SmpDescriptorExtractor().extractPluginDescriptor(pluginFile));
|
||||
|
||||
@@ -21,14 +21,13 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
package sonia.scm.plugin;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.io.Resources;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.junitpioneer.jupiter.TempDirectory;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
@@ -43,13 +42,12 @@ import java.util.UUID;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@ExtendWith(TempDirectory.class)
|
||||
class UberClassLoaderTest {
|
||||
|
||||
private final URLClassLoader parentClassLoader = new URLClassLoader(new URL[0]);
|
||||
|
||||
@Test
|
||||
void shouldOnlyUseClassloaderOnce(@TempDirectory.TempDir Path tempDir) throws IOException {
|
||||
void shouldOnlyUseClassloaderOnce(@TempDir Path tempDir) throws IOException {
|
||||
ClassLoader mailClassLoader = createClassLoader(tempDir, "plugin.txt", "mail");
|
||||
ClassLoader reviewClassLoader = createClassLoader(mailClassLoader, tempDir, "plugin.txt", "review");
|
||||
|
||||
@@ -61,7 +59,7 @@ class UberClassLoaderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldReturnResourceFromEachPluginClassLoader(@TempDirectory.TempDir Path tempDir) throws IOException {
|
||||
void shouldReturnResourceFromEachPluginClassLoader(@TempDir Path tempDir) throws IOException {
|
||||
ClassLoader mailClassLoader = createClassLoader(tempDir, "scm.txt", "mail");
|
||||
ClassLoader reviewClassLoader = createClassLoader(tempDir, "scm.txt", "review");
|
||||
|
||||
|
||||
@@ -21,14 +21,14 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
package sonia.scm.update.group;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Nested;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.junitpioneer.jupiter.TempDirectory;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Captor;
|
||||
import org.mockito.Mock;
|
||||
@@ -39,7 +39,6 @@ import sonia.scm.store.ConfigurationEntryStore;
|
||||
import sonia.scm.store.InMemoryConfigurationEntryStoreFactory;
|
||||
import sonia.scm.update.UpdateStepTestUtil;
|
||||
import sonia.scm.update.V1Properties;
|
||||
import sonia.scm.update.V1Property;
|
||||
|
||||
import javax.xml.bind.JAXBException;
|
||||
import java.io.IOException;
|
||||
@@ -55,7 +54,6 @@ import static org.mockito.Mockito.verify;
|
||||
import static sonia.scm.store.InMemoryConfigurationEntryStoreFactory.create;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
@ExtendWith(TempDirectory.class)
|
||||
class XmlGroupV1UpdateStepTest {
|
||||
|
||||
@Mock
|
||||
@@ -72,7 +70,7 @@ class XmlGroupV1UpdateStepTest {
|
||||
|
||||
|
||||
@BeforeEach
|
||||
void mockScmHome(@TempDirectory.TempDir Path tempDir) {
|
||||
void mockScmHome(@TempDir Path tempDir) {
|
||||
testUtil = new UpdateStepTestUtil(tempDir);
|
||||
updateStep = new XmlGroupV1UpdateStep(testUtil.getContextProvider(), groupDAO, storeFactory);
|
||||
}
|
||||
|
||||
@@ -21,13 +21,13 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
package sonia.scm.update.repository;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.junitpioneer.jupiter.TempDirectory;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import sonia.scm.SCMContextProvider;
|
||||
@@ -44,7 +44,6 @@ import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
@ExtendWith(TempDirectory.class)
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
class CopyMigrationStrategyTest {
|
||||
|
||||
@@ -54,30 +53,30 @@ class CopyMigrationStrategyTest {
|
||||
RepositoryLocationResolver locationResolver;
|
||||
|
||||
@BeforeEach
|
||||
void mockContextProvider(@TempDirectory.TempDir Path tempDir) {
|
||||
void mockContextProvider(@TempDir Path tempDir) {
|
||||
when(contextProvider.getBaseDirectory()).thenReturn(tempDir.toFile());
|
||||
}
|
||||
|
||||
@BeforeEach
|
||||
void createV1Home(@TempDirectory.TempDir Path tempDir) throws IOException {
|
||||
void createV1Home(@TempDir Path tempDir) throws IOException {
|
||||
V1RepositoryFileSystem.createV1Home(tempDir);
|
||||
}
|
||||
|
||||
@BeforeEach
|
||||
void mockLocationResolver(@TempDirectory.TempDir Path tempDir) {
|
||||
void mockLocationResolver(@TempDir Path tempDir) {
|
||||
RepositoryLocationResolver.RepositoryLocationResolverInstance instanceMock = mock(RepositoryLocationResolver.RepositoryLocationResolverInstance.class);
|
||||
when(locationResolver.forClass(Path.class)).thenReturn(instanceMock);
|
||||
when(instanceMock.createLocation(anyString())).thenAnswer(invocation -> tempDir.resolve((String) invocation.getArgument(0)));
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldUseStandardDirectory(@TempDirectory.TempDir Path tempDir) {
|
||||
void shouldUseStandardDirectory(@TempDir Path tempDir) {
|
||||
Path target = new CopyMigrationStrategy(contextProvider, locationResolver).migrate("b4f-a9f0-49f7-ad1f-37d3aae1c55f", "some/more/directories/than/one", "git").get();
|
||||
assertThat(target).isEqualTo(tempDir.resolve("b4f-a9f0-49f7-ad1f-37d3aae1c55f"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldCopyDataDirectory(@TempDirectory.TempDir Path tempDir) {
|
||||
void shouldCopyDataDirectory(@TempDir Path tempDir) {
|
||||
Path target = new CopyMigrationStrategy(contextProvider, locationResolver).migrate("b4f-a9f0-49f7-ad1f-37d3aae1c55f", "some/more/directories/than/one", "git").get();
|
||||
assertThat(target.resolve("data")).exists();
|
||||
Path originalDataDir = tempDir
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
package sonia.scm.update.repository;
|
||||
|
||||
import org.assertj.core.api.Assertions;
|
||||
@@ -29,7 +29,7 @@ import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Nested;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.junitpioneer.jupiter.TempDirectory;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import sonia.scm.SCMContextProvider;
|
||||
@@ -43,7 +43,6 @@ import static org.mockito.Mockito.when;
|
||||
import static sonia.scm.update.repository.MigrationStrategy.INLINE;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
@ExtendWith(TempDirectory.class)
|
||||
class DefaultMigrationStrategyDAOTest {
|
||||
|
||||
@Mock
|
||||
@@ -52,7 +51,7 @@ class DefaultMigrationStrategyDAOTest {
|
||||
private ConfigurationStoreFactory storeFactory;
|
||||
|
||||
@BeforeEach
|
||||
void initStore(@TempDirectory.TempDir Path tempDir) {
|
||||
void initStore(@TempDir Path tempDir) {
|
||||
when(contextProvider.getBaseDirectory()).thenReturn(tempDir.toFile());
|
||||
storeFactory = new JAXBConfigurationStoreFactory(contextProvider, null);
|
||||
}
|
||||
|
||||
@@ -21,13 +21,13 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
package sonia.scm.update.repository;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.junitpioneer.jupiter.TempDirectory;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import sonia.scm.SCMContextProvider;
|
||||
@@ -41,7 +41,6 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
@ExtendWith(TempDirectory.class)
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
class InlineMigrationStrategyTest {
|
||||
|
||||
@@ -53,25 +52,25 @@ class InlineMigrationStrategyTest {
|
||||
RepositoryLocationResolver.RepositoryLocationResolverInstance locationResolverInstance;
|
||||
|
||||
@BeforeEach
|
||||
void mockContextProvider(@TempDirectory.TempDir Path tempDir) {
|
||||
void mockContextProvider(@TempDir Path tempDir) {
|
||||
when(locationResolver.forClass(Path.class)).thenReturn(locationResolverInstance);
|
||||
when(contextProvider.getBaseDirectory()).thenReturn(tempDir.toFile());
|
||||
}
|
||||
|
||||
@BeforeEach
|
||||
void createV1Home(@TempDirectory.TempDir Path tempDir) throws IOException {
|
||||
void createV1Home(@TempDir Path tempDir) throws IOException {
|
||||
V1RepositoryFileSystem.createV1Home(tempDir);
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldUseExistingDirectory(@TempDirectory.TempDir Path tempDir) {
|
||||
void shouldUseExistingDirectory(@TempDir Path tempDir) {
|
||||
Path target = new InlineMigrationStrategy(contextProvider, locationResolver).migrate("b4f-a9f0-49f7-ad1f-37d3aae1c55f", "some/more/directories/than/one", "git").get();
|
||||
assertThat(target).isEqualTo(resolveOldDirectory(tempDir));
|
||||
verify(locationResolverInstance).setLocation("b4f-a9f0-49f7-ad1f-37d3aae1c55f", target);
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldMoveDataDirectory(@TempDirectory.TempDir Path tempDir) {
|
||||
void shouldMoveDataDirectory(@TempDir Path tempDir) {
|
||||
new InlineMigrationStrategy(contextProvider, locationResolver).migrate("b4f-a9f0-49f7-ad1f-37d3aae1c55f", "some/more/directories/than/one", "git");
|
||||
assertThat(resolveOldDirectory(tempDir).resolve("data")).exists();
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
package sonia.scm.update.repository;
|
||||
|
||||
import com.google.common.io.Resources;
|
||||
@@ -29,7 +29,7 @@ import org.assertj.core.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.junitpioneer.jupiter.TempDirectory;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
@@ -51,7 +51,6 @@ import static org.mockito.Mockito.doAnswer;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
@ExtendWith(TempDirectory.class)
|
||||
class MigrateVerbsToPermissionRolesTest {
|
||||
|
||||
private static final String EXISTING_REPOSITORY_ID = "id";
|
||||
@@ -65,7 +64,7 @@ class MigrateVerbsToPermissionRolesTest {
|
||||
private MigrateVerbsToPermissionRoles migration;
|
||||
|
||||
@BeforeEach
|
||||
void init(@TempDirectory.TempDir Path tempDir) throws IOException {
|
||||
void init(@TempDir Path tempDir) throws IOException {
|
||||
URL metadataUrl = Resources.getResource("sonia/scm/update/repository/metadataWithoutRoles.xml");
|
||||
Files.copy(metadataUrl.openStream(), tempDir.resolve("metadata.xml"));
|
||||
doAnswer(invocation -> {
|
||||
@@ -76,7 +75,7 @@ class MigrateVerbsToPermissionRolesTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldUpdateToRolesIfPossible(@TempDirectory.TempDir Path tempDir) throws IOException {
|
||||
void shouldUpdateToRolesIfPossible(@TempDir Path tempDir) throws IOException {
|
||||
migration.doUpdate();
|
||||
|
||||
List<String> newMetadata = Files.readAllLines(tempDir.resolve("metadata.xml"));
|
||||
|
||||
@@ -21,13 +21,13 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
package sonia.scm.update.repository;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.junitpioneer.jupiter.TempDirectory;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import sonia.scm.SCMContextProvider;
|
||||
@@ -41,7 +41,6 @@ import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
@ExtendWith(TempDirectory.class)
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
class MoveMigrationStrategyTest {
|
||||
|
||||
@@ -51,30 +50,30 @@ class MoveMigrationStrategyTest {
|
||||
RepositoryLocationResolver locationResolver;
|
||||
|
||||
@BeforeEach
|
||||
void mockContextProvider(@TempDirectory.TempDir Path tempDir) {
|
||||
void mockContextProvider(@TempDir Path tempDir) {
|
||||
when(contextProvider.getBaseDirectory()).thenReturn(tempDir.toFile());
|
||||
}
|
||||
|
||||
@BeforeEach
|
||||
void createV1Home(@TempDirectory.TempDir Path tempDir) throws IOException {
|
||||
void createV1Home(@TempDir Path tempDir) throws IOException {
|
||||
V1RepositoryFileSystem.createV1Home(tempDir);
|
||||
}
|
||||
|
||||
@BeforeEach
|
||||
void mockLocationResolver(@TempDirectory.TempDir Path tempDir) {
|
||||
void mockLocationResolver(@TempDir Path tempDir) {
|
||||
RepositoryLocationResolver.RepositoryLocationResolverInstance instanceMock = mock(RepositoryLocationResolver.RepositoryLocationResolverInstance.class);
|
||||
when(locationResolver.forClass(Path.class)).thenReturn(instanceMock);
|
||||
when(instanceMock.createLocation(anyString())).thenAnswer(invocation -> tempDir.resolve((String) invocation.getArgument(0)));
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldUseStandardDirectory(@TempDirectory.TempDir Path tempDir) {
|
||||
void shouldUseStandardDirectory(@TempDir Path tempDir) {
|
||||
Path target = new MoveMigrationStrategy(contextProvider, locationResolver).migrate("b4f-a9f0-49f7-ad1f-37d3aae1c55f", "some/more/directories/than/one", "git").get();
|
||||
assertThat(target).isEqualTo(tempDir.resolve("b4f-a9f0-49f7-ad1f-37d3aae1c55f"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldMoveDataDirectory(@TempDirectory.TempDir Path tempDir) {
|
||||
void shouldMoveDataDirectory(@TempDir Path tempDir) {
|
||||
Path target = new MoveMigrationStrategy(contextProvider, locationResolver).migrate("b4f-a9f0-49f7-ad1f-37d3aae1c55f", "some/more/directories/than/one", "git").get();
|
||||
assertThat(target.resolve("data")).exists();
|
||||
Path originalDataDir = tempDir
|
||||
|
||||
@@ -21,13 +21,13 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
package sonia.scm.update.repository;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.junitpioneer.jupiter.TempDirectory;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Captor;
|
||||
import org.mockito.Mock;
|
||||
@@ -35,7 +35,6 @@ import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import sonia.scm.SCMContext;
|
||||
import sonia.scm.repository.Repository;
|
||||
import sonia.scm.repository.RepositoryPermission;
|
||||
import sonia.scm.repository.RepositoryRolePermissions;
|
||||
import sonia.scm.repository.RepositoryTestData;
|
||||
import sonia.scm.repository.xml.XmlRepositoryDAO;
|
||||
import sonia.scm.update.UpdateStepTestUtil;
|
||||
@@ -49,7 +48,6 @@ import java.nio.file.Path;
|
||||
import java.util.Collections;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junitpioneer.jupiter.TempDirectory.TempDir;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.never;
|
||||
@@ -58,7 +56,6 @@ import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
@ExtendWith(TempDirectory.class)
|
||||
class PublicFlagUpdateStepTest {
|
||||
|
||||
@Mock
|
||||
|
||||
@@ -21,14 +21,13 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
package sonia.scm.update.repository;
|
||||
|
||||
import com.google.common.io.Resources;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.junitpioneer.jupiter.TempDirectory;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
import sonia.scm.SCMContextProvider;
|
||||
import sonia.scm.repository.xml.PathBasedRepositoryLocationResolver;
|
||||
import sonia.scm.repository.xml.XmlRepositoryDAO;
|
||||
@@ -43,19 +42,18 @@ import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
@ExtendWith(TempDirectory.class)
|
||||
class XmlRepositoryFileNameUpdateStepTest {
|
||||
|
||||
SCMContextProvider contextProvider = mock(SCMContextProvider.class);
|
||||
XmlRepositoryDAO repositoryDAO = mock(XmlRepositoryDAO.class);
|
||||
|
||||
@BeforeEach
|
||||
void mockScmHome(@TempDirectory.TempDir Path tempDir) {
|
||||
void mockScmHome(@TempDir Path tempDir) {
|
||||
when(contextProvider.getBaseDirectory()).thenReturn(tempDir.toFile());
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldCopyRepositoriesFileToRepositoryPathsFile(@TempDirectory.TempDir Path tempDir) throws IOException {
|
||||
void shouldCopyRepositoriesFileToRepositoryPathsFile(@TempDir Path tempDir) throws IOException {
|
||||
XmlRepositoryFileNameUpdateStep updateStep = new XmlRepositoryFileNameUpdateStep(contextProvider, repositoryDAO);
|
||||
URL url = Resources.getResource("sonia/scm/update/repository/formerV2RepositoryFile.xml");
|
||||
Path configDir = tempDir.resolve("config");
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
package sonia.scm.update.repository;
|
||||
|
||||
import com.google.common.io.Resources;
|
||||
@@ -30,7 +30,7 @@ import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Nested;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.junitpioneer.jupiter.TempDirectory;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Captor;
|
||||
import org.mockito.Mock;
|
||||
@@ -63,7 +63,6 @@ import static org.mockito.Mockito.when;
|
||||
import static sonia.scm.update.repository.MigrationStrategy.MOVE;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
@ExtendWith(TempDirectory.class)
|
||||
class XmlRepositoryV1UpdateStepTest {
|
||||
|
||||
Injector injectorMock = MigrationStrategyMock.init();
|
||||
@@ -85,7 +84,7 @@ class XmlRepositoryV1UpdateStepTest {
|
||||
XmlRepositoryV1UpdateStep updateStep;
|
||||
|
||||
@BeforeEach
|
||||
void createUpdateStepFromMocks(@TempDirectory.TempDir Path tempDir) {
|
||||
void createUpdateStepFromMocks(@TempDir Path tempDir) {
|
||||
testUtil = new UpdateStepTestUtil(tempDir);
|
||||
updateStep = new XmlRepositoryV1UpdateStep(
|
||||
testUtil.getContextProvider(),
|
||||
@@ -100,7 +99,7 @@ class XmlRepositoryV1UpdateStepTest {
|
||||
class WithExistingDatabase {
|
||||
|
||||
@BeforeEach
|
||||
void createV1Home(@TempDirectory.TempDir Path tempDir) throws IOException {
|
||||
void createV1Home(@TempDir Path tempDir) throws IOException {
|
||||
V1RepositoryFileSystem.createV1Home(tempDir);
|
||||
}
|
||||
|
||||
@@ -165,7 +164,7 @@ class XmlRepositoryV1UpdateStepTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldUseDirectoryFromStrategy(@TempDirectory.TempDir Path tempDir) throws JAXBException {
|
||||
void shouldUseDirectoryFromStrategy(@TempDir Path tempDir) throws JAXBException {
|
||||
Path targetDir = tempDir.resolve("someDir");
|
||||
MigrationStrategy.Instance strategyMock = injectorMock.getInstance(MoveMigrationStrategy.class);
|
||||
when(strategyMock.migrate("454972da-faf9-4437-b682-dc4a4e0aa8eb", "simple", "git")).thenReturn(of(targetDir));
|
||||
@@ -195,7 +194,7 @@ class XmlRepositoryV1UpdateStepTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldBackupOldRepositoryDatabaseFile(@TempDirectory.TempDir Path tempDir) throws JAXBException {
|
||||
void shouldBackupOldRepositoryDatabaseFile(@TempDir Path tempDir) throws JAXBException {
|
||||
updateStep.doUpdate();
|
||||
|
||||
assertThat(tempDir.resolve("config").resolve("repositories.xml")).doesNotExist();
|
||||
@@ -209,14 +208,14 @@ class XmlRepositoryV1UpdateStepTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldNotFailIfFormerV2DatabaseExists(@TempDirectory.TempDir Path tempDir) throws JAXBException, IOException {
|
||||
void shouldNotFailIfFormerV2DatabaseExists(@TempDir Path tempDir) throws JAXBException, IOException {
|
||||
createFormerV2RepositoriesFile(tempDir);
|
||||
|
||||
updateStep.doUpdate();
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldNotBackupFormerV2DatabaseFile(@TempDirectory.TempDir Path tempDir) throws JAXBException, IOException {
|
||||
void shouldNotBackupFormerV2DatabaseFile(@TempDir Path tempDir) throws JAXBException, IOException {
|
||||
createFormerV2RepositoriesFile(tempDir);
|
||||
|
||||
updateStep.doUpdate();
|
||||
@@ -226,14 +225,14 @@ class XmlRepositoryV1UpdateStepTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldGetNoMissingStrategiesWithFormerV2DatabaseFile(@TempDirectory.TempDir Path tempDir) throws IOException {
|
||||
void shouldGetNoMissingStrategiesWithFormerV2DatabaseFile(@TempDir Path tempDir) throws IOException {
|
||||
createFormerV2RepositoriesFile(tempDir);
|
||||
|
||||
assertThat(updateStep.getRepositoriesWithoutMigrationStrategies()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldFindMissingStrategies(@TempDirectory.TempDir Path tempDir) throws IOException {
|
||||
void shouldFindMissingStrategies(@TempDir Path tempDir) throws IOException {
|
||||
V1RepositoryFileSystem.createV1Home(tempDir);
|
||||
|
||||
assertThat(updateStep.getRepositoriesWithoutMigrationStrategies())
|
||||
@@ -244,7 +243,7 @@ class XmlRepositoryV1UpdateStepTest {
|
||||
"454972da-faf9-4437-b682-dc4a4e0aa8eb");
|
||||
}
|
||||
|
||||
private void createFormerV2RepositoriesFile(@TempDirectory.TempDir Path tempDir) throws IOException {
|
||||
private void createFormerV2RepositoriesFile(@TempDir Path tempDir) throws IOException {
|
||||
URL url = Resources.getResource("sonia/scm/update/repository/formerV2RepositoryFile.xml");
|
||||
Path configDir = tempDir.resolve("config");
|
||||
Files.createDirectories(configDir);
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
package sonia.scm.update.security;
|
||||
|
||||
import com.google.common.io.Resources;
|
||||
@@ -29,7 +29,7 @@ import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Nested;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.junitpioneer.jupiter.TempDirectory;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import sonia.scm.SCMContextProvider;
|
||||
@@ -50,7 +50,6 @@ import static org.mockito.Mockito.when;
|
||||
import static sonia.scm.store.InMemoryConfigurationEntryStoreFactory.create;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
@ExtendWith(TempDirectory.class)
|
||||
class XmlSecurityV1UpdateStepTest {
|
||||
|
||||
@Mock
|
||||
@@ -60,7 +59,7 @@ class XmlSecurityV1UpdateStepTest {
|
||||
ConfigurationEntryStore<AssignedPermission> assignedPermissionStore;
|
||||
|
||||
@BeforeEach
|
||||
void mockScmHome(@TempDirectory.TempDir Path tempDir) {
|
||||
void mockScmHome(@TempDir Path tempDir) {
|
||||
when(contextProvider.getBaseDirectory()).thenReturn(tempDir.toFile());
|
||||
InMemoryConfigurationEntryStoreFactory inMemoryConfigurationEntryStoreFactory = create();
|
||||
assignedPermissionStore = inMemoryConfigurationEntryStoreFactory.get("security");
|
||||
@@ -71,7 +70,7 @@ class XmlSecurityV1UpdateStepTest {
|
||||
class WithExistingDatabase {
|
||||
|
||||
@BeforeEach
|
||||
void createConfigV1XML(@TempDirectory.TempDir Path tempDir) throws IOException {
|
||||
void createConfigV1XML(@TempDir Path tempDir) throws IOException {
|
||||
Path configDir = tempDir.resolve("config");
|
||||
Files.createDirectories(configDir);
|
||||
copyTestDatabaseFile(configDir, "config.xml");
|
||||
@@ -109,7 +108,7 @@ class XmlSecurityV1UpdateStepTest {
|
||||
class WithExistingSecurityXml {
|
||||
|
||||
@BeforeEach
|
||||
void createSecurityV1XML(@TempDirectory.TempDir Path tempDir) throws IOException {
|
||||
void createSecurityV1XML(@TempDir Path tempDir) throws IOException {
|
||||
Path configDir = tempDir.resolve("config");
|
||||
Files.createDirectories(configDir);
|
||||
copyTestDatabaseFile(configDir, "securityV1.xml");
|
||||
|
||||
@@ -21,14 +21,14 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
package sonia.scm.update.user;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Nested;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.junitpioneer.jupiter.TempDirectory;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Captor;
|
||||
import org.mockito.Mock;
|
||||
@@ -38,7 +38,6 @@ import sonia.scm.store.ConfigurationEntryStore;
|
||||
import sonia.scm.store.InMemoryConfigurationEntryStoreFactory;
|
||||
import sonia.scm.update.UpdateStepTestUtil;
|
||||
import sonia.scm.update.V1Properties;
|
||||
import sonia.scm.update.V1Property;
|
||||
import sonia.scm.user.User;
|
||||
import sonia.scm.user.xml.XmlUserDAO;
|
||||
|
||||
@@ -55,7 +54,6 @@ import static org.mockito.Mockito.verify;
|
||||
import static sonia.scm.store.InMemoryConfigurationEntryStoreFactory.create;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
@ExtendWith(TempDirectory.class)
|
||||
class XmlUserV1UpdateStepTest {
|
||||
|
||||
@Mock
|
||||
@@ -71,7 +69,7 @@ class XmlUserV1UpdateStepTest {
|
||||
private UpdateStepTestUtil testUtil;
|
||||
|
||||
@BeforeEach
|
||||
void mockScmHome(@TempDirectory.TempDir Path tempDir) {
|
||||
void mockScmHome(@TempDir Path tempDir) {
|
||||
testUtil = new UpdateStepTestUtil(tempDir);
|
||||
updateStep = new XmlUserV1UpdateStep(testUtil.getContextProvider(), userDAO, storeFactory);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user