Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openbis
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sispub
openbis
Commits
4ce52aae
Commit
4ce52aae
authored
11 years ago
by
pkupczyk
Browse files
Options
Downloads
Patches
Plain Diff
SP-831 - Fix flaky DSS tests
SVN: 29668
parent
0fbada94
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/plugins/standard/ZipArchiverTest.java
+23
-11
23 additions, 11 deletions
.../dss/generic/server/plugins/standard/ZipArchiverTest.java
with
23 additions
and
11 deletions
datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/plugins/standard/ZipArchiverTest.java
+
23
−
11
View file @
4ce52aae
...
@@ -22,7 +22,9 @@ import java.io.File;
...
@@ -22,7 +22,9 @@ import java.io.File;
import
java.io.FileInputStream
;
import
java.io.FileInputStream
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.lang.reflect.Method
;
import
java.lang.reflect.Method
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.Collection
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.zip.ZipEntry
;
import
java.util.zip.ZipEntry
;
...
@@ -138,7 +140,7 @@ public class ZipArchiverTest extends AbstractArchiverTestCase
...
@@ -138,7 +140,7 @@ public class ZipArchiverTest extends AbstractArchiverTestCase
ProcessingStatus
processingStatus
=
archiver
.
archive
(
Arrays
.
asList
(
dsd1
),
archiverTaskContext
,
false
);
ProcessingStatus
processingStatus
=
archiver
.
archive
(
Arrays
.
asList
(
dsd1
),
archiverTaskContext
,
false
);
File
archivedDataSetFile
=
new
File
(
defaultArchive
,
ds1
.
getDataSetCode
()
+
".zip"
);
File
archivedDataSetFile
=
new
File
(
defaultArchive
,
ds1
.
getDataSetCode
()
+
".zip"
);
assert
Equal
s
(
"INFO OPERATION.AbstractDatastorePlugin - "
assert
LogContain
s
(
"INFO OPERATION.AbstractDatastorePlugin - "
+
"Archiving of the following datasets has been requested: [Dataset 'ds1']\n"
+
"Archiving of the following datasets has been requested: [Dataset 'ds1']\n"
+
"INFO OPERATION.DistributedPackagingDataSetFileOperationsManager - "
+
"INFO OPERATION.DistributedPackagingDataSetFileOperationsManager - "
+
"Data set 'ds1' archived: "
+
archivedDataSetFile
,
logRecorder
.
getLogContent
());
+
"Data set 'ds1' archived: "
+
archivedDataSetFile
,
logRecorder
.
getLogContent
());
...
@@ -191,7 +193,7 @@ public class ZipArchiverTest extends AbstractArchiverTestCase
...
@@ -191,7 +193,7 @@ public class ZipArchiverTest extends AbstractArchiverTestCase
ProcessingStatus
processingStatus
=
archiver
.
archive
(
Arrays
.
asList
(
dsd1
),
archiverTaskContext
,
false
);
ProcessingStatus
processingStatus
=
archiver
.
archive
(
Arrays
.
asList
(
dsd1
),
archiverTaskContext
,
false
);
File
archivedDataSetFile
=
new
File
(
defaultArchive
,
LOCATION
+
"/"
+
ds1
.
getDataSetCode
()
+
".zip"
);
File
archivedDataSetFile
=
new
File
(
defaultArchive
,
LOCATION
+
"/"
+
ds1
.
getDataSetCode
()
+
".zip"
);
assert
Equal
s
(
"INFO OPERATION.AbstractDatastorePlugin - "
assert
LogContain
s
(
"INFO OPERATION.AbstractDatastorePlugin - "
+
"Archiving of the following datasets has been requested: [Dataset 'ds1']\n"
+
"Archiving of the following datasets has been requested: [Dataset 'ds1']\n"
+
"INFO OPERATION.DistributedPackagingDataSetFileOperationsManager - Data set 'ds1' archived: "
+
"INFO OPERATION.DistributedPackagingDataSetFileOperationsManager - Data set 'ds1' archived: "
+
archivedDataSetFile
,
logRecorder
.
getLogContent
());
+
archivedDataSetFile
,
logRecorder
.
getLogContent
());
...
@@ -249,7 +251,7 @@ public class ZipArchiverTest extends AbstractArchiverTestCase
...
@@ -249,7 +251,7 @@ public class ZipArchiverTest extends AbstractArchiverTestCase
ProcessingStatus
processingStatus
=
archiver
.
archive
(
Arrays
.
asList
(
dsd1
),
archiverTaskContext
,
false
);
ProcessingStatus
processingStatus
=
archiver
.
archive
(
Arrays
.
asList
(
dsd1
),
archiverTaskContext
,
false
);
File
archivedDataSetFile
=
new
File
(
archive
,
ds1
.
getDataSetCode
()
+
".zip"
);
File
archivedDataSetFile
=
new
File
(
archive
,
ds1
.
getDataSetCode
()
+
".zip"
);
assert
Equal
s
(
"INFO OPERATION.IdentifierAttributeMappingManager - Mapping file '"
+
mappingFile
+
"' successfully loaded.\n"
assert
LogContain
s
(
"INFO OPERATION.IdentifierAttributeMappingManager - Mapping file '"
+
mappingFile
+
"' successfully loaded.\n"
+
"INFO OPERATION.AbstractDatastorePlugin - "
+
"INFO OPERATION.AbstractDatastorePlugin - "
+
"Archiving of the following datasets has been requested: [Dataset 'ds1']\n"
+
"Archiving of the following datasets has been requested: [Dataset 'ds1']\n"
+
"INFO OPERATION.DistributedPackagingDataSetFileOperationsManager - Data set 'ds1' archived: "
+
"INFO OPERATION.DistributedPackagingDataSetFileOperationsManager - Data set 'ds1' archived: "
...
@@ -327,7 +329,7 @@ public class ZipArchiverTest extends AbstractArchiverTestCase
...
@@ -327,7 +329,7 @@ public class ZipArchiverTest extends AbstractArchiverTestCase
File
archivedDataSetFile
=
new
File
(
defaultArchive
,
ds1
.
getDataSetCode
()
+
".zip"
);
File
archivedDataSetFile
=
new
File
(
defaultArchive
,
ds1
.
getDataSetCode
()
+
".zip"
);
String
logContent
=
logRecorder
.
getLogContent
().
replaceFirst
(
"in all shares in .*s"
,
"in all shares in ? s"
);
String
logContent
=
logRecorder
.
getLogContent
().
replaceFirst
(
"in all shares in .*s"
,
"in all shares in ? s"
);
assert
Equal
s
(
"INFO OPERATION.AbstractDatastorePlugin - "
assert
LogContain
s
(
"INFO OPERATION.AbstractDatastorePlugin - "
+
"Archiving of the following datasets has been requested: [Dataset 'ds1']\n"
+
"Archiving of the following datasets has been requested: [Dataset 'ds1']\n"
+
"INFO OPERATION.DistributedPackagingDataSetFileOperationsManager - Data set 'ds1' archived: "
+
"INFO OPERATION.DistributedPackagingDataSetFileOperationsManager - Data set 'ds1' archived: "
+
archivedDataSetFile
+
"\n"
+
archivedDataSetFile
+
"\n"
...
@@ -413,7 +415,7 @@ public class ZipArchiverTest extends AbstractArchiverTestCase
...
@@ -413,7 +415,7 @@ public class ZipArchiverTest extends AbstractArchiverTestCase
File
archivedDataSetFile
=
new
File
(
archive
,
LOCATION
+
"/"
+
ds1
.
getDataSetCode
()
+
".zip"
);
File
archivedDataSetFile
=
new
File
(
archive
,
LOCATION
+
"/"
+
ds1
.
getDataSetCode
()
+
".zip"
);
String
logContent
=
logRecorder
.
getLogContent
().
replaceFirst
(
"in all shares in .*s"
,
"in all shares in ? s"
);
String
logContent
=
logRecorder
.
getLogContent
().
replaceFirst
(
"in all shares in .*s"
,
"in all shares in ? s"
);
assert
Equal
s
(
"INFO OPERATION.IdentifierAttributeMappingManager - Mapping file '"
+
mappingFile
+
"' successfully loaded.\n"
assert
LogContain
s
(
"INFO OPERATION.IdentifierAttributeMappingManager - Mapping file '"
+
mappingFile
+
"' successfully loaded.\n"
+
"INFO OPERATION.AbstractDatastorePlugin - "
+
"INFO OPERATION.AbstractDatastorePlugin - "
+
"Archiving of the following datasets has been requested: [Dataset 'ds1']\n"
+
"Archiving of the following datasets has been requested: [Dataset 'ds1']\n"
+
"INFO OPERATION.DistributedPackagingDataSetFileOperationsManager - Data set 'ds1' archived: "
+
"INFO OPERATION.DistributedPackagingDataSetFileOperationsManager - Data set 'ds1' archived: "
...
@@ -472,7 +474,7 @@ public class ZipArchiverTest extends AbstractArchiverTestCase
...
@@ -472,7 +474,7 @@ public class ZipArchiverTest extends AbstractArchiverTestCase
ProcessingStatus
processingStatus2
=
archiver
.
archive
(
Arrays
.
asList
(
dsd1
),
archiverTaskContext
,
false
);
ProcessingStatus
processingStatus2
=
archiver
.
archive
(
Arrays
.
asList
(
dsd1
),
archiverTaskContext
,
false
);
File
archivedDataSetFile
=
new
File
(
defaultArchive
,
ds1
.
getDataSetCode
()
+
".zip"
);
File
archivedDataSetFile
=
new
File
(
defaultArchive
,
ds1
.
getDataSetCode
()
+
".zip"
);
assert
Equal
s
(
"INFO OPERATION.AbstractDatastorePlugin - "
assert
LogContain
s
(
"INFO OPERATION.AbstractDatastorePlugin - "
+
"Archiving of the following datasets has been requested: [Dataset 'ds1']\n"
+
"Archiving of the following datasets has been requested: [Dataset 'ds1']\n"
+
"INFO OPERATION.DistributedPackagingDataSetFileOperationsManager - Data set 'ds1' archived: "
+
"INFO OPERATION.DistributedPackagingDataSetFileOperationsManager - Data set 'ds1' archived: "
+
archivedDataSetFile
+
"\n"
+
archivedDataSetFile
+
"\n"
...
@@ -533,7 +535,7 @@ public class ZipArchiverTest extends AbstractArchiverTestCase
...
@@ -533,7 +535,7 @@ public class ZipArchiverTest extends AbstractArchiverTestCase
ProcessingStatus
processingStatus2
=
archiver
.
archive
(
Arrays
.
asList
(
dsd1
),
archiverTaskContext
,
false
);
ProcessingStatus
processingStatus2
=
archiver
.
archive
(
Arrays
.
asList
(
dsd1
),
archiverTaskContext
,
false
);
File
archivedDataSetFile
=
new
File
(
defaultArchive
,
ds1
.
getDataSetCode
()
+
".zip"
);
File
archivedDataSetFile
=
new
File
(
defaultArchive
,
ds1
.
getDataSetCode
()
+
".zip"
);
assert
Equal
s
(
assert
LogContain
s
(
"INFO OPERATION.AbstractDatastorePlugin - "
"INFO OPERATION.AbstractDatastorePlugin - "
+
"Archiving of the following datasets has been requested: [Dataset 'ds1']\n"
+
"Archiving of the following datasets has been requested: [Dataset 'ds1']\n"
+
"INFO OPERATION.DistributedPackagingDataSetFileOperationsManager - Data set 'ds1' archived: "
+
"INFO OPERATION.DistributedPackagingDataSetFileOperationsManager - Data set 'ds1' archived: "
...
@@ -595,7 +597,7 @@ public class ZipArchiverTest extends AbstractArchiverTestCase
...
@@ -595,7 +597,7 @@ public class ZipArchiverTest extends AbstractArchiverTestCase
ProcessingStatus
processingStatus2
=
archiver
.
deleteFromArchive
(
Arrays
.
asList
(
ProcessingStatus
processingStatus2
=
archiver
.
deleteFromArchive
(
Arrays
.
asList
(
new
DatasetLocation
(
ds1
.
getCode
(),
ds1
.
getLocation
(),
DATA_STORE_CODE
,
""
)));
new
DatasetLocation
(
ds1
.
getCode
(),
ds1
.
getLocation
(),
DATA_STORE_CODE
,
""
)));
assert
Equal
s
(
"INFO OPERATION.AbstractDatastorePlugin - "
assert
LogContain
s
(
"INFO OPERATION.AbstractDatastorePlugin - "
+
"Archiving of the following datasets has been requested: [Dataset 'ds1']\n"
+
"Archiving of the following datasets has been requested: [Dataset 'ds1']\n"
+
"INFO OPERATION.DistributedPackagingDataSetFileOperationsManager - Data set 'ds1' archived: "
+
"INFO OPERATION.DistributedPackagingDataSetFileOperationsManager - Data set 'ds1' archived: "
+
archivedDataSetFile
,
logRecorder
.
getLogContent
());
+
archivedDataSetFile
,
logRecorder
.
getLogContent
());
...
@@ -632,7 +634,7 @@ public class ZipArchiverTest extends AbstractArchiverTestCase
...
@@ -632,7 +634,7 @@ public class ZipArchiverTest extends AbstractArchiverTestCase
ProcessingStatus
processingStatus2
=
archiver
.
deleteFromArchive
(
Arrays
.
asList
(
ProcessingStatus
processingStatus2
=
archiver
.
deleteFromArchive
(
Arrays
.
asList
(
new
DatasetLocation
(
ds1
.
getCode
(),
ds1
.
getLocation
(),
DATA_STORE_CODE
,
""
)));
new
DatasetLocation
(
ds1
.
getCode
(),
ds1
.
getLocation
(),
DATA_STORE_CODE
,
""
)));
assert
Equal
s
(
"INFO OPERATION.AbstractDatastorePlugin - "
assert
LogContain
s
(
"INFO OPERATION.AbstractDatastorePlugin - "
+
"Archiving of the following datasets has been requested: [Dataset 'ds1']\n"
+
"Archiving of the following datasets has been requested: [Dataset 'ds1']\n"
+
"INFO OPERATION.DistributedPackagingDataSetFileOperationsManager - Data set 'ds1' archived: "
+
"INFO OPERATION.DistributedPackagingDataSetFileOperationsManager - Data set 'ds1' archived: "
+
archivedDataSetFile
,
logRecorder
.
getLogContent
());
+
archivedDataSetFile
,
logRecorder
.
getLogContent
());
...
@@ -673,7 +675,7 @@ public class ZipArchiverTest extends AbstractArchiverTestCase
...
@@ -673,7 +675,7 @@ public class ZipArchiverTest extends AbstractArchiverTestCase
ProcessingStatus
processingStatus2
=
archiver
.
deleteFromArchive
(
Arrays
.
asList
(
ProcessingStatus
processingStatus2
=
archiver
.
deleteFromArchive
(
Arrays
.
asList
(
new
DatasetLocation
(
ds1
.
getCode
(),
ds1
.
getLocation
(),
DATA_STORE_CODE
,
""
)));
new
DatasetLocation
(
ds1
.
getCode
(),
ds1
.
getLocation
(),
DATA_STORE_CODE
,
""
)));
assert
Equal
s
(
"INFO OPERATION.AbstractDatastorePlugin - "
assert
LogContain
s
(
"INFO OPERATION.AbstractDatastorePlugin - "
+
"Archiving of the following datasets has been requested: [Dataset 'ds1']\n"
+
"Archiving of the following datasets has been requested: [Dataset 'ds1']\n"
+
"INFO OPERATION.DistributedPackagingDataSetFileOperationsManager - Data set 'ds1' archived: "
+
"INFO OPERATION.DistributedPackagingDataSetFileOperationsManager - Data set 'ds1' archived: "
+
archivedDataSetFile
,
logRecorder
.
getLogContent
());
+
archivedDataSetFile
,
logRecorder
.
getLogContent
());
...
@@ -719,7 +721,7 @@ public class ZipArchiverTest extends AbstractArchiverTestCase
...
@@ -719,7 +721,7 @@ public class ZipArchiverTest extends AbstractArchiverTestCase
ProcessingStatus
processingStatus2
=
archiver
.
deleteFromArchive
(
Arrays
.
asList
(
ProcessingStatus
processingStatus2
=
archiver
.
deleteFromArchive
(
Arrays
.
asList
(
new
DatasetLocation
(
ds1
.
getCode
(),
ds1
.
getLocation
(),
DATA_STORE_CODE
,
""
)));
new
DatasetLocation
(
ds1
.
getCode
(),
ds1
.
getLocation
(),
DATA_STORE_CODE
,
""
)));
assert
Equal
s
(
"INFO OPERATION.IdentifierAttributeMappingManager - Mapping file '"
+
mappingFile
+
"' successfully loaded.\n"
assert
LogContain
s
(
"INFO OPERATION.IdentifierAttributeMappingManager - Mapping file '"
+
mappingFile
+
"' successfully loaded.\n"
+
"INFO OPERATION.AbstractDatastorePlugin - "
+
"INFO OPERATION.AbstractDatastorePlugin - "
+
"Archiving of the following datasets has been requested: [Dataset 'ds1']\n"
+
"Archiving of the following datasets has been requested: [Dataset 'ds1']\n"
+
"INFO OPERATION.DistributedPackagingDataSetFileOperationsManager - Data set 'ds1' archived: "
+
"INFO OPERATION.DistributedPackagingDataSetFileOperationsManager - Data set 'ds1' archived: "
...
@@ -784,6 +786,16 @@ public class ZipArchiverTest extends AbstractArchiverTestCase
...
@@ -784,6 +786,16 @@ public class ZipArchiverTest extends AbstractArchiverTestCase
}
}
}
}
private
void
assertLogContains
(
String
expected
,
String
actual
)
{
Collection
<
String
>
expectedLines
=
new
ArrayList
<
String
>(
Arrays
.
asList
(
expected
.
split
(
"\n"
)));
Collection
<
String
>
actualLines
=
new
ArrayList
<
String
>(
Arrays
.
asList
(
actual
.
split
(
"\n"
)));
expectedLines
.
removeAll
(
actualLines
);
assertTrue
(
"Expected the log to contain lines: \n"
+
expected
+
"\nbut found: \n"
+
actual
,
expectedLines
.
isEmpty
());
}
private
void
prepareAsContent
(
final
String
dataSetCode
,
final
File
file
)
private
void
prepareAsContent
(
final
String
dataSetCode
,
final
File
file
)
{
{
context
.
checking
(
new
Expectations
()
context
.
checking
(
new
Expectations
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment