Skip to content
GitLab
Explore
Sign in
VOSpace INAF
vospace-datamodel
Compare revisions
f1e26dc6a0af587fe15ba9ada9ce32c9e7415d46 to 241471ca52edf681b576f32b9b20595742564d24
Commits on Source (2)
Added custom view for async recall operations
· c2bb5a0a
Sonia Zorba
authored
Jul 28, 2021
c2bb5a0a
Set transfer target element as string instead of list of strings again
· 241471ca
Sonia Zorba
authored
Jul 28, 2021
241471ca
Hide whitespace changes
Inline
Side-by-side
src/main/java/it/inaf/oats/vospace/datamodel/Views.java
View file @
241471ca
...
...
@@ -18,4 +18,5 @@ public abstract class Views {
// Custom views
public
static
final
String
TAR_VIEW_URI
=
"ivo://ia2.inaf.it/vospace/views#tar"
;
public
static
final
String
ZIP_VIEW_URI
=
"ivo://ia2.inaf.it/vospace/views#zip"
;
public
static
final
String
ASYNC_RECALL_VIEW_URI
=
"ivo://ia2.inaf.it/vospace/views#async-recall"
;
}
src/main/java/net/ivoa/xml/vospace/v2/Transfer.java
View file @
241471ca
...
...
@@ -87,7 +87,7 @@ public class Transfer {
@XmlElement
(
required
=
true
)
})
@XmlSchemaType
(
name
=
"anyURI"
)
private
List
<
String
>
target
;
private
String
target
;
protected
String
direction
;
protected
View
view
;
...
...
@@ -110,7 +110,7 @@ public class Transfer {
* {@link String }
*
*/
public
List
<
String
>
getTarget
()
{
public
String
getTarget
()
{
return
target
;
}
...
...
@@ -122,7 +122,7 @@ public class Transfer {
* {@link String }
*
*/
public
void
setTarget
(
List
<
String
>
value
)
{
public
void
setTarget
(
String
value
)
{
this
.
target
=
value
;
}
...
...
src/test/java/net/ivoa/xml/uws/v1/JobSummaryTest.java
View file @
241471ca
...
...
@@ -63,7 +63,7 @@ public class JobSummaryTest {
*/
@Test
public
void
testDeserializeTransferServiceResponse
()
throws
Exception
{
String
response
=
"{\"jobId\": \"917c784f814c4a1a91a9d5d1af07dbe9\", \"ownerId\": \"2386\", \"jobType\": \"pullToVoSpace\", \"phase\": \"PENDING\", \"startTime\": null, \"endTime\": null, \"creationTime\": \"2021-02-03T15:05:57.233602\", \"jobInfo\": {\"transfer\": {\"view\": null, \"target\":
[
\"vos://example.com!vospace/
szorba
/aaa\"
]
, \"version\": null, \"direction\": \"pullToVoSpace\", \"keepBytes\": null, \"protocols\": [
{\"uri\": \"ia2:async-recall\", \"endpoint\": null}]
}}, \"results\": null}"
;
String
response
=
"{\"jobId\": \"917c784f814c4a1a91a9d5d1af07dbe9\", \"ownerId\": \"2386\", \"jobType\": \"pullToVoSpace\", \"phase\": \"PENDING\", \"startTime\": null, \"endTime\": null, \"creationTime\": \"2021-02-03T15:05:57.233602\", \"jobInfo\": {\"transfer\": {\"view\": null, \"target\": \"vos://example.com!vospace/
user
/aaa\", \"version\": null, \"direction\": \"pullToVoSpace\", \"keepBytes\": null, \"protocols\": [
], \"view\": {\"uri\": \"ivo://ia2.inaf.it/vospace/views#async-recall\"}
}}, \"results\": null}"
;
MAPPER
.
readValue
(
response
,
JobSummary
.
class
);
}
...
...
@@ -78,7 +78,7 @@ public class JobSummaryTest {
Transfer
transfer
=
new
Transfer
();
transfer
.
setVersion
(
"2.1"
);
transfer
.
setTarget
(
Arrays
.
asList
(
"vos://example.com!vospace/mydata1"
)
)
;
transfer
.
setTarget
(
"vos://example.com!vospace/mydata1"
);
transfer
.
setDirection
(
"pullFromVoSpace"
);
Protocol
protocol1
=
new
Protocol
();
protocol1
.
setUri
(
"ivo://ivoa.net/vospace/core#httpget"
);
...
...
@@ -110,7 +110,7 @@ public class JobSummaryTest {
Transfer
transfer
=
(
Transfer
)
deserializedJob
.
getJobInfo
().
getAny
().
get
(
0
);
assertEquals
(
"2.1"
,
transfer
.
getVersion
());
assertEquals
(
"pullFromVoSpace"
,
transfer
.
getDirection
());
assert
Array
Equals
(
new
String
[]{
"vos://example.com!vospace/mydata1"
}
,
transfer
.
getTarget
()
.
toArray
(
String
[]::
new
)
);
assertEquals
(
"vos://example.com!vospace/mydata1"
,
transfer
.
getTarget
());
Protocol
protocol
=
transfer
.
getProtocols
().
get
(
0
);
assertEquals
(
"ivo://ivoa.net/vospace/core#httpget"
,
protocol
.
getUri
());
...
...
src/test/java/net/ivoa/xml/vospace/v2/TransferTest.java
View file @
241471ca
...
...
@@ -26,21 +26,7 @@ public class TransferTest {
public
void
testSingleTarget
()
throws
Exception
{
Transfer
transfer
=
getBaseTransfer
();
transfer
.
setTarget
(
Arrays
.
asList
(
URI_PREFIX
+
"/mynode"
));
testXmlSerialization
(
transfer
);
}
@Test
public
void
testMultipleTargets
()
throws
Exception
{
Transfer
transfer
=
getBaseTransfer
();
transfer
.
setTarget
(
Arrays
.
asList
(
URI_PREFIX
+
"/mynode1"
,
URI_PREFIX
+
"/mynode2"
));
testXmlSerialization
(
transfer
);
}
private
void
testXmlSerialization
(
Transfer
transfer
)
throws
Exception
{
transfer
.
setTarget
(
URI_PREFIX
+
"/mynode"
);
String
xml
;
try
(
StringWriter
sw
=
new
StringWriter
())
{
...
...
@@ -80,7 +66,7 @@ public class TransferTest {
private
void
verifyTransfersAreEquals
(
Transfer
serialized
,
Transfer
deserialized
)
{
assert
Array
Equals
(
serialized
.
getTarget
()
.
toArray
(
String
[]::
new
)
,
deserialized
.
getTarget
()
.
toArray
(
String
[]::
new
)
);
assertEquals
(
serialized
.
getTarget
(),
deserialized
.
getTarget
());
assertEquals
(
serialized
.
getDirection
(),
deserialized
.
getDirection
());
assertEquals
(
serialized
.
getProtocols
().
size
(),
deserialized
.
getProtocols
().
size
());
assertEquals
(
serialized
.
getParam
().
size
(),
deserialized
.
getParam
().
size
());
...
...