mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-12 00:15:44 +01:00
Merge with 2.0.0-m3
This commit is contained in:
@@ -39,7 +39,7 @@ export class DeleteGroup extends React.Component<Props> {
|
||||
};
|
||||
|
||||
groupDeleted = () => {
|
||||
this.props.history.push("/groups");
|
||||
this.props.history.push("/groups/");
|
||||
};
|
||||
|
||||
confirmDelete = () => {
|
||||
|
||||
@@ -35,7 +35,7 @@ class DeleteRepo extends React.Component<Props> {
|
||||
};
|
||||
|
||||
deleted = () => {
|
||||
this.props.history.push("/repos");
|
||||
this.props.history.push("/repos/");
|
||||
};
|
||||
|
||||
deleteRepo = () => {
|
||||
|
||||
@@ -35,7 +35,7 @@ class DeleteUser extends React.Component<Props> {
|
||||
};
|
||||
|
||||
userDeleted = () => {
|
||||
this.props.history.push("/users");
|
||||
this.props.history.push("/users/");
|
||||
};
|
||||
|
||||
deleteUser = () => {
|
||||
|
||||
@@ -63,7 +63,9 @@ public class XmlGroupV1UpdateStep implements UpdateStep {
|
||||
return;
|
||||
}
|
||||
XmlGroupV1UpdateStep.V1GroupDatabase v1Database = readV1Database(v1GroupsFile.get());
|
||||
v1Database.groupList.groups.forEach(this::update);
|
||||
if (v1Database.groupList != null && v1Database.groupList.groups != null) {
|
||||
v1Database.groupList.groups.forEach(this::update);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -47,6 +47,12 @@ private final SCMContextProvider contextProvider;
|
||||
copyTestDatabaseFile(configDir, fileName);
|
||||
}
|
||||
|
||||
public void copyConfigFile(String fileName, String targetFileName) throws IOException {
|
||||
Path configDir = tempDir.resolve("config");
|
||||
Files.createDirectories(configDir);
|
||||
copyTestDatabaseFile(configDir, fileName, targetFileName);
|
||||
}
|
||||
|
||||
public ConfigurationEntryStore<AssignedPermission> getStoreForConfigFile(String name) {
|
||||
return storeFactory
|
||||
.withType(AssignedPermission.class)
|
||||
@@ -59,7 +65,12 @@ private final SCMContextProvider contextProvider;
|
||||
}
|
||||
|
||||
private void copyTestDatabaseFile(Path configDir, String fileName) throws IOException {
|
||||
Path targetFileName = Paths.get(fileName).getFileName();
|
||||
copyTestDatabaseFile(configDir, fileName, targetFileName.toString());
|
||||
}
|
||||
|
||||
private void copyTestDatabaseFile(Path configDir, String fileName, String targetFileName) throws IOException {
|
||||
URL url = Resources.getResource(fileName);
|
||||
Files.copy(url.openStream(), configDir.resolve(Paths.get(fileName).getFileName()));
|
||||
Files.copy(url.openStream(), configDir.resolve(targetFileName));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,6 +99,36 @@ class XmlGroupV1UpdateStepTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
class WithExistingDatabaseWithEmptyList {
|
||||
|
||||
@BeforeEach
|
||||
void createGroupV1XML() throws IOException {
|
||||
testUtil.copyConfigFile("sonia/scm/update/group/groups_empty_groups.xml", "groups.xml");
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldCreateNewGroupFromGroupsV1Xml() throws JAXBException {
|
||||
updateStep.doUpdate();
|
||||
verify(groupDAO, times(0)).add(any());
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
class WithExistingDatabaseWithoutList {
|
||||
|
||||
@BeforeEach
|
||||
void createGroupV1XML() throws IOException {
|
||||
testUtil.copyConfigFile("sonia/scm/update/group/groups_no_groups.xml", "groups.xml");
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldCreateNewGroupFromGroupsV1Xml() throws JAXBException {
|
||||
updateStep.doUpdate();
|
||||
verify(groupDAO, times(0)).add(any());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldNotFailForMissingConfigDir() throws JAXBException {
|
||||
updateStep.doUpdate();
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<group-db>
|
||||
<creationTime>1558006904769</creationTime>
|
||||
<groups/>
|
||||
<lastModified>1558007174172</lastModified>
|
||||
</group-db>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<group-db>
|
||||
<creationTime>1558006904769</creationTime>
|
||||
<lastModified>1558007174172</lastModified>
|
||||
</group-db>
|
||||
Reference in New Issue
Block a user