use of org.sagebionetworks.repo.model.NodeRevisionBackup in project Synapse-Repository-Services by Sage-Bionetworks.
the class GenericMigratorTest method before.
@Before
public void before() {
// mockType = Mockito.mock(EntityType.class);
genericMigrator = new GenericMigrator();
toMigrate = new NodeRevisionBackup();
}
use of org.sagebionetworks.repo.model.NodeRevisionBackup in project Synapse-Repository-Services by Sage-Bionetworks.
the class DataTypeMigratorTest method before.
@Before
public void before() {
// mockType = Mockito.mock(EntityType.class);
dataTypeMigrator = new DataTypeMigrator();
toMigrate = new NodeRevisionBackup();
}
use of org.sagebionetworks.repo.model.NodeRevisionBackup in project Synapse-Repository-Services by Sage-Bionetworks.
the class NodeBackupManagerImplAutowireTest method testPLFM_987Part2.
@Test
public void testPLFM_987Part2() throws Exception {
// First get the current node backup
List<NodeRevisionBackup> startingRevs = new ArrayList<NodeRevisionBackup>();
NodeBackup startingBackup = backupManager.getNode(newNodeId);
// Get all of the revisions
for (Long revNumer : startingBackup.getRevisions()) {
NodeRevisionBackup rev = backupManager.getNodeRevision(newNodeId, revNumer);
startingRevs.add(rev);
}
// Now create a new version of the entity
Node updatedNode = nodeManager.get(nonAdminUser, newNodeId);
// Set a new version label
updatedNode.setVersionLabel("newLable");
nodeManager.update(nonAdminUser, updatedNode, null, true);
// Now get the backup again.
List<NodeRevisionBackup> updatedRevs = new ArrayList<NodeRevisionBackup>();
NodeBackup updatedNodeBackup = backupManager.getNode(newNodeId);
// Get all of the revisions
for (Long revNumer : updatedNodeBackup.getRevisions()) {
NodeRevisionBackup rev = backupManager.getNodeRevision(newNodeId, revNumer);
updatedRevs.add(rev);
}
// Now start clean
nodeManager.delete(nonAdminUser, newNodeId);
// Now apply the first restore.
backupManager.createOrUpdateNodeWithRevisions(startingBackup, startingRevs);
// Create multiple versions that should get replaced.
updatedNode = nodeManager.get(nonAdminUser, newNodeId);
// Set a new version label
updatedNode.setVersionLabel("newLabel2");
nodeManager.update(nonAdminUser, updatedNode, null, true);
updatedNode = nodeManager.get(nonAdminUser, newNodeId);
// Set a new version label
updatedNode.setVersionLabel("newLabel3");
nodeManager.update(nonAdminUser, updatedNode, null, true);
updatedNode = nodeManager.get(nonAdminUser, newNodeId);
// Set a new version label
updatedNode.setVersionLabel("newLabel4");
nodeManager.update(nonAdminUser, updatedNode, null, true);
// Now update using the new object
backupManager.createOrUpdateNodeWithRevisions(updatedNodeBackup, updatedRevs);
// The revisions should match the replaced revisions
NodeBackup cloneBackup = backupManager.getNode(newNodeId);
// Get all of the revisions
List<NodeRevisionBackup> cloneRevisions = new ArrayList<NodeRevisionBackup>();
for (Long revNumer : cloneBackup.getRevisions()) {
NodeRevisionBackup rev = backupManager.getNodeRevision(newNodeId, revNumer);
cloneRevisions.add(rev);
}
// they should match
// Make sure they are in the same order before comparing them.
Collections.sort(updatedRevs, comp);
Collections.sort(cloneRevisions, comp);
assertEquals(updatedRevs, cloneRevisions);
}
use of org.sagebionetworks.repo.model.NodeRevisionBackup in project Synapse-Repository-Services by Sage-Bionetworks.
the class NodeBackupStub method getNodeRevisionIds.
public List<Long> getNodeRevisionIds(String id) {
TreeNodeBackup nn = getNodeNode(id);
// Build up the list of children
List<Long> rervisions = new ArrayList<Long>();
for (NodeRevisionBackup rev : nn.getRevisions()) {
rervisions.add(rev.getRevisionNumber());
}
return rervisions;
}
use of org.sagebionetworks.repo.model.NodeRevisionBackup in project Synapse-Repository-Services by Sage-Bionetworks.
the class NodeBackupStub method getNodeRevision.
@Override
public NodeRevisionBackup getNodeRevision(String nodeId, Long revId) {
String revKey = createKeyForLongs(nodeId, revId);
NodeRevisionBackup rev = revisionIdMap.get(revKey);
if (rev != null) {
rev.setXmlVersion(NodeRevisionBackup.CURRENT_XML_VERSION);
}
return rev;
}
Aggregations