1 package hu.user.mediacube.executors.tests;
\r
3 import static org.junit.Assert.assertNotNull;
\r
4 import static org.junit.Assert.assertNull;
\r
6 import java.nio.file.Paths;
\r
8 import org.junit.BeforeClass;
\r
9 import org.junit.Test;
\r
11 import com.ibm.nosql.json.api.BasicDBObject;
\r
13 import user.jobengine.server.steps.HSMMigrateStep;
\r
14 import user.mediacube.metadata.MetadataProviderFactory;
\r
15 import user.mediacube.metadata.interfaces.IMetadataProvider;
\r
16 import user.mediacube.metadata.interfaces.IMetadataProviderFactory;
\r
17 import user.mediacube.metadata.interfaces.MetadataProviderType;
\r
19 public class HSMMigrateStepTest {
\r
22 static public void setUpConnection() {
\r
23 System.setProperty("jobengine.nosql.db.url", "jdbc:db2://10.11.1.90:50000/mc:retrieveMessagesFromServerOnGetMessage=true;");
\r
24 System.setProperty("jobengine.nosql.db.user", "db2admin");
\r
25 System.setProperty("jobengine.nosql.db.password", "password");
\r
28 private HSMMigrateStep createSUT() {
\r
29 HSMMigrateStep sut = new HSMMigrateStep() {
\r
31 protected IMetadataProvider getMetadataProvider(MetadataProviderType type) {
\r
32 IMetadataProviderFactory factory = new MetadataProviderFactory();
\r
33 return factory.getProvider(type);
\r
40 public void testExecute() throws Exception {
\r
41 HSMMigrateStep sut = createSUT();
\r
42 sut.execute("//10.11.1.89", "/_video/migrate");
\r
43 // System.out.println(Arrays.toString(sut));
\r
47 public void testQueryException_FileNameExclude() throws Exception {
\r
48 HSMMigrateStep sut = new HSMMigrateStep();
\r
49 BasicDBObject actual = sut.queryExclude("12-90670-0012");
\r
50 assertNotNull(actual);
\r
54 public void testQueryException_FullPathExclude() throws Exception {
\r
55 HSMMigrateStep sut = new HSMMigrateStep();
\r
56 BasicDBObject actual = sut.queryExclude("/gpfs/OMARCHIVE/2011-mxf/11-01771-0002-2.mxf");
\r
57 assertNotNull(actual);
\r
61 public void testQueryException_NoException() throws Exception {
\r
62 HSMMigrateStep sut = new HSMMigrateStep();
\r
63 BasicDBObject actual = sut.queryExclude("test.mxf");
\r
68 public void testQueryHistory() throws Exception {
\r
69 HSMMigrateStep sut = new HSMMigrateStep();
\r
70 BasicDBObject actual = sut.queryFileHistory("/OMARCHIVE/6.3.4.200-TIV-TSMALL-Linuxx86_64.bin");
\r
71 assertNotNull(actual);
\r
75 public void testResumableCopy() throws Exception {
\r
76 HSMMigrateStep sut = new HSMMigrateStep();
\r
77 Paths.get("c:/_video/03c.mp4").toFile().delete();
\r
78 sut.copyChunk(Paths.get("c:/_video/1.txt"), Paths.get("c:/_video/2.txt"), 5);
\r
79 sut.resumeableCopy(Paths.get("c:/_video/1.txt"), Paths.get("c:/_video/2.txt"));
\r