Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
officejs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
officejs
Commits
bbf74f1f
Commit
bbf74f1f
authored
Aug 14, 2012
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update DavStorage and Jio tests
parent
27016e9e
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
196 additions
and
139 deletions
+196
-139
OfficeJS/src/jio.storage/davstorage.js
OfficeJS/src/jio.storage/davstorage.js
+127
-78
OfficeJS/test/jiotests.js
OfficeJS/test/jiotests.js
+62
-54
OfficeJS/test/responsexml/davlist
OfficeJS/test/responsexml/davlist
+3
-3
OfficeJS/test/responsexml/davload
OfficeJS/test/responsexml/davload
+2
-2
OfficeJS/test/responsexml/davsave
OfficeJS/test/responsexml/davsave
+2
-2
No files found.
OfficeJS/src/jio.storage/davstorage.js
View file @
bbf74f1f
This diff is collapsed.
Click to expand it.
OfficeJS/test/jiotests.js
View file @
bbf74f1f
...
@@ -640,20 +640,20 @@ test ('Document load', function () {
...
@@ -640,20 +640,20 @@ test ('Document load', function () {
o
.
mytest
=
function
(
message
,
doc
,
errprop
,
errget
)
{
o
.
mytest
=
function
(
message
,
doc
,
errprop
,
errget
)
{
var
server
=
o
.
t
.
sandbox
.
useFakeServer
();
var
server
=
o
.
t
.
sandbox
.
useFakeServer
();
server
.
respondWith
(
server
.
respondWith
(
"
PROPFIND
"
,
"
https://ca-davstorage:8080/dav
/dav
load/jiotests/file
"
,
"
PROPFIND
"
,
"
https://ca-davstorage:8080/davload/jiotests/file
"
,
[
errprop
,{
'
Content-Type
'
:
'
text/xml; charset="utf-8"
'
},
[
errprop
,{
'
Content-Type
'
:
'
text/xml; charset="utf-8"
'
},
o
.
davload
]);
o
.
davload
]);
server
.
respondWith
(
server
.
respondWith
(
"
GET
"
,
"
https://ca-davstorage:8080/dav
/dav
load/jiotests/file
"
,
"
GET
"
,
"
https://ca-davstorage:8080/davload/jiotests/file
"
,
[
errget
,{},
'
content
'
]);
[
errget
,{},
'
content
'
]);
o
.
f
=
function
(
result
)
{
o
.
f
=
function
(
err
,
val
)
{
if
(
result
&&
result
.
status
)
{
if
(
err
)
{
result
=
undefined
;
err
=
err
.
status
;
}
}
deepEqual
(
result
,
doc
,
message
);
deepEqual
(
err
||
val
,
doc
,
message
);
};
};
o
.
t
.
spy
(
o
,
'
f
'
);
o
.
t
.
spy
(
o
,
'
f
'
);
o
.
jio
.
loadDocument
(
'
file
'
,{
success
:
o
.
f
,
error
:
o
.
f
,
max_retry
:
1
}
);
o
.
jio
.
get
(
'
file
'
,{
max_retry
:
1
},
o
.
f
);
o
.
clock
.
tick
(
1000
);
o
.
clock
.
tick
(
1000
);
server
.
respond
();
server
.
respond
();
if
(
!
o
.
f
.
calledOnce
)
{
if
(
!
o
.
f
.
calledOnce
)
{
...
@@ -676,11 +676,11 @@ test ('Document load', function () {
...
@@ -676,11 +676,11 @@ test ('Document load', function () {
// 403 Forbidden
// 403 Forbidden
// 404 Not Found
// 404 Not Found
// load an inexistant document.
// load an inexistant document.
o
.
mytest
(
'
load inexistant document
'
,
undefined
,
404
,
404
);
o
.
mytest
(
'
load inexistant document
'
,
404
,
404
,
404
);
// load a document.
// load a document.
o
.
mytest
(
'
load document
'
,{
name
:
'
file
'
,
content
:
'
content
'
,
o
.
mytest
(
'
load document
'
,{
_id
:
'
file
'
,
content
:
'
content
'
,
last_modified
:
1335953199000
,
_
last_modified
:
1335953199000
,
creation_date
:
1335953202000
},
207
,
200
);
_
creation_date
:
1335953202000
},
207
,
200
);
o
.
jio
.
stop
();
o
.
jio
.
stop
();
});
});
...
@@ -696,16 +696,16 @@ test ('Document save', function () {
...
@@ -696,16 +696,16 @@ test ('Document save', function () {
var
server
=
o
.
t
.
sandbox
.
useFakeServer
();
var
server
=
o
.
t
.
sandbox
.
useFakeServer
();
server
.
respondWith
(
server
.
respondWith
(
// lastmodified = 7000, creationdate = 5000
// lastmodified = 7000, creationdate = 5000
"
PROPFIND
"
,
"
https://ca-davstorage:8080/dav
/dav
save/jiotests/file
"
,
"
PROPFIND
"
,
"
https://ca-davstorage:8080/davsave/jiotests/file
"
,
[
errnoprop
,{
'
Content-Type
'
:
'
text/xml; charset="utf-8"
'
},
[
errnoprop
,{
'
Content-Type
'
:
'
text/xml; charset="utf-8"
'
},
o
.
davsave
]);
o
.
davsave
]);
server
.
respondWith
(
server
.
respondWith
(
"
PUT
"
,
"
PUT
"
,
"
https://ca-davstorage:8080/dav
/dav
save/jiotests/file
"
,
"
https://ca-davstorage:8080/davsave/jiotests/file
"
,
[
errnoput
,
{
'
Content-Type
'
:
'
x-www-form-urlencoded
'
},
[
errnoput
,
{
'
Content-Type
'
:
'
x-www-form-urlencoded
'
},
'
content
'
]);
'
content
'
]);
server
.
respondWith
(
server
.
respondWith
(
"
GET
"
,
"
https://ca-davstorage:8080/dav
/dav
save/jiotests/file
"
,
"
GET
"
,
"
https://ca-davstorage:8080/davsave/jiotests/file
"
,
[
errnoprop
===
207
?
200
:
errnoprop
,{},
'
content
'
]);
[
errnoprop
===
207
?
200
:
errnoprop
,{},
'
content
'
]);
// server.respondWith ("MKCOL","https://ca-davstorage:8080/dav",
// server.respondWith ("MKCOL","https://ca-davstorage:8080/dav",
// [200,{},'']);
// [200,{},'']);
...
@@ -714,16 +714,9 @@ test ('Document save', function () {
...
@@ -714,16 +714,9 @@ test ('Document save', function () {
// server.respondWith ("MKCOL",
// server.respondWith ("MKCOL",
// "https://ca-davstorage:8080/dav/davsave/jiotests",
// "https://ca-davstorage:8080/dav/davsave/jiotests",
// [200,{},'']);
// [200,{},'']);
o
.
f
=
function
(
result
)
{
o
.
f
=
basic_test_function_generator
(
o
,
'
value
'
,
value
,
message
);
if
(
result
&&
result
.
status
)
{
result
=
'
fail
'
;
}
else
{
result
=
'
done
'
;
}
deepEqual
(
result
,
value
,
message
);
};
o
.
t
.
spy
(
o
,
'
f
'
);
o
.
t
.
spy
(
o
,
'
f
'
);
o
.
jio
.
saveDocument
(
'
file
'
,
'
content
'
,{
success
:
o
.
f
,
error
:
o
.
f
}
);
o
.
jio
.
put
({
_id
:
'
file
'
,
content
:
'
content
'
},
o
.
f
);
o
.
clock
.
tick
(
1000
);
o
.
clock
.
tick
(
1000
);
server
.
respond
();
server
.
respond
();
if
(
!
o
.
f
.
calledOnce
)
{
if
(
!
o
.
f
.
calledOnce
)
{
...
@@ -749,10 +742,10 @@ test ('Document save', function () {
...
@@ -749,10 +742,10 @@ test ('Document save', function () {
// mytest('create path if not exists, and create document',
// mytest('create path if not exists, and create document',
// true,201,404);
// true,201,404);
// the document does not exist, we want to create it
// the document does not exist, we want to create it
o
.
mytest
(
'
create document
'
,
'
done
'
,
201
,
404
);
o
.
mytest
(
'
create document
'
,
{
ok
:
true
,
id
:
'
file
'
}
,
201
,
404
);
o
.
clock
.
tick
(
8000
);
o
.
clock
.
tick
(
8000
);
// the document already exists, we want to overwrite it
// the document already exists, we want to overwrite it
o
.
mytest
(
'
overwrite document
'
,
'
done
'
,
204
,
207
);
o
.
mytest
(
'
overwrite document
'
,
{
ok
:
true
,
id
:
'
file
'
}
,
204
,
207
);
o
.
jio
.
stop
();
o
.
jio
.
stop
();
});
});
...
@@ -767,28 +760,27 @@ test ('Get Document List', function () {
...
@@ -767,28 +760,27 @@ test ('Get Document List', function () {
o
.
mytest
=
function
(
message
,
metadata_only
,
value
,
errnoprop
)
{
o
.
mytest
=
function
(
message
,
metadata_only
,
value
,
errnoprop
)
{
var
server
=
o
.
t
.
sandbox
.
useFakeServer
();
var
server
=
o
.
t
.
sandbox
.
useFakeServer
();
server
.
respondWith
(
server
.
respondWith
(
"
PROPFIND
"
,
'
https://ca-davstorage:8080/dav
/dav
list/jiotests/
'
,
"
PROPFIND
"
,
'
https://ca-davstorage:8080/davlist/jiotests/
'
,
[
errnoprop
,{
'
Content-Type
'
:
'
text/xml; charset="utf-8"
'
},
[
errnoprop
,{
'
Content-Type
'
:
'
text/xml; charset="utf-8"
'
},
o
.
davlist
]);
o
.
davlist
]);
server
.
respondWith
(
server
.
respondWith
(
"
GET
"
,
"
https://ca-davstorage:8080/dav
/dav
list/jiotests/file
"
,
"
GET
"
,
"
https://ca-davstorage:8080/davlist/jiotests/file
"
,
[
200
,{},
'
content
'
]);
[
200
,{},
'
content
'
]);
server
.
respondWith
(
server
.
respondWith
(
"
GET
"
,
"
https://ca-davstorage:8080/dav
/dav
list/jiotests/memo
"
,
"
GET
"
,
"
https://ca-davstorage:8080/davlist/jiotests/memo
"
,
[
200
,{},
'
content2
'
]);
[
200
,{},
'
content2
'
]);
o
.
f
=
function
(
result
)
{
o
.
f
=
function
(
err
,
val
)
{
if
(
result
&&
result
.
status
)
{
if
(
err
)
{
result
=
undefined
;
result
=
undefined
;
}
else
{
}
else
{
deepEqual
(
objectifyDocumentArray
(
result
),
deepEqual
(
objectifyDocumentArray
(
val
.
rows
),
objectifyDocumentArray
(
value
),
message
);
objectifyDocumentArray
(
value
),
message
);
return
;
return
;
}
}
deepEqual
(
result
,
value
,
message
);
deepEqual
(
result
,
value
,
message
);
};
};
o
.
t
.
spy
(
o
,
'
f
'
);
o
.
t
.
spy
(
o
,
'
f
'
);
o
.
jio
.
getDocumentList
(
'
.
'
,{
success
:
o
.
f
,
error
:
o
.
f
,
o
.
jio
.
allDocs
({
metadata_only
:
metadata_only
},
o
.
f
);
metadata_only
:
metadata_only
});
o
.
clock
.
tick
(
1000
);
o
.
clock
.
tick
(
1000
);
server
.
respond
();
server
.
respond
();
if
(
!
o
.
f
.
calledOnce
)
{
if
(
!
o
.
f
.
calledOnce
)
{
...
@@ -804,16 +796,34 @@ test ('Get Document List', function () {
...
@@ -804,16 +796,34 @@ test ('Get Document List', function () {
url
:
'
https://ca-davstorage:8080
'
,
url
:
'
https://ca-davstorage:8080
'
,
applicationname
:
'
jiotests
'
});
applicationname
:
'
jiotests
'
});
o
.
mytest
(
'
fail to get list
'
,
true
,
undefined
,
404
);
o
.
mytest
(
'
fail to get list
'
,
true
,
undefined
,
404
);
o
.
mytest
(
'
getting list
'
,
true
,[{
name
:
'
file
'
,
creation_date
:
1335962911000
,
o
.
mytest
(
'
getting list
'
,
true
,[{
last_modified
:
1335962907000
},
id
:
'
file
'
,
key
:
'
file
'
,
{
name
:
'
memo
'
,
creation_date
:
1335894073000
,
value
:{
last_modified
:
1335955713000
}],
207
);
_creation_date
:
1335962911000
,
o
.
mytest
(
'
getting list
'
,
false
,[{
name
:
'
file
'
,
content
:
'
content
'
,
_last_modified
:
1335962907000
creation_date
:
1335962911000
,
}
last_modified
:
1335962907000
},
},{
{
name
:
'
memo
'
,
content
:
'
content2
'
,
id
:
'
memo
'
,
key
:
'
memo
'
,
creation_date
:
1335894073000
,
value
:{
last_modified
:
1335955713000
}],
207
);
_creation_date
:
1335894073000
,
_last_modified
:
1335955713000
}
}],
207
);
o
.
mytest
(
'
getting list
'
,
false
,[{
id
:
'
file
'
,
key
:
'
file
'
,
value
:{
content
:
'
content
'
,
_creation_date
:
1335962911000
,
_last_modified
:
1335962907000
}
},{
id
:
'
memo
'
,
key
:
'
memo
'
,
value
:{
content
:
'
content2
'
,
_creation_date
:
1335894073000
,
_last_modified
:
1335955713000
}
}],
207
);
o
.
jio
.
stop
();
o
.
jio
.
stop
();
});
});
...
@@ -825,18 +835,16 @@ test ('Remove document', function () {
...
@@ -825,18 +835,16 @@ test ('Remove document', function () {
o
.
mytest
=
function
(
message
,
value
,
errnodel
)
{
o
.
mytest
=
function
(
message
,
value
,
errnodel
)
{
var
server
=
o
.
t
.
sandbox
.
useFakeServer
();
var
server
=
o
.
t
.
sandbox
.
useFakeServer
();
server
.
respondWith
(
server
.
respondWith
(
"
DELETE
"
,
"
https://ca-davstorage:8080/dav
/dav
remove/jiotests/file
"
,
"
DELETE
"
,
"
https://ca-davstorage:8080/davremove/jiotests/file
"
,
[
errnodel
,{},
''
]);
[
errnodel
,{},
''
]);
o
.
f
=
function
(
result
)
{
o
.
f
=
function
(
err
,
val
)
{
if
(
result
&&
result
.
status
)
{
if
(
err
)
{
result
=
'
fail
'
;
err
=
err
.
status
;
}
else
{
result
=
'
done
'
;
}
}
deepEqual
(
result
,
value
,
message
);
deepEqual
(
err
||
val
,
value
,
message
);
};
};
o
.
t
.
spy
(
o
,
'
f
'
);
o
.
t
.
spy
(
o
,
'
f
'
);
o
.
jio
.
remove
Document
(
'
file
'
,{
success
:
o
.
f
,
error
:
o
.
f
}
);
o
.
jio
.
remove
({
_id
:
'
file
'
},
o
.
f
);
o
.
clock
.
tick
(
1000
);
o
.
clock
.
tick
(
1000
);
server
.
respond
();
server
.
respond
();
if
(
!
o
.
f
.
calledOnce
)
{
if
(
!
o
.
f
.
calledOnce
)
{
...
@@ -850,10 +858,10 @@ test ('Remove document', function () {
...
@@ -850,10 +858,10 @@ test ('Remove document', function () {
o
.
jio
=
JIO
.
newJio
({
type
:
'
dav
'
,
username
:
'
davremove
'
,
o
.
jio
=
JIO
.
newJio
({
type
:
'
dav
'
,
username
:
'
davremove
'
,
password
:
'
checkpwd
'
,
password
:
'
checkpwd
'
,
url
:
'
https://ca-davstorage:8080
'
,
url
:
'
https://ca-davstorage:8080
'
,
appli
ac
tionname
:
'
jiotests
'
});
appli
ca
tionname
:
'
jiotests
'
});
o
.
mytest
(
'
remove document
'
,
'
done
'
,
204
);
o
.
mytest
(
'
remove document
'
,
{
ok
:
true
,
id
:
'
file
'
}
,
204
);
o
.
mytest
(
'
remove an already removed document
'
,
'
done
'
,
404
);
o
.
mytest
(
'
remove an already removed document
'
,
404
,
404
);
o
.
jio
.
stop
();
o
.
jio
.
stop
();
});
});
...
...
OfficeJS/test/responsexml/davlist
View file @
bbf74f1f
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<D:multistatus
xmlns:D=
"DAV:"
>
<D:multistatus
xmlns:D=
"DAV:"
>
<D:response
xmlns:lp1=
"DAV:"
xmlns:lp2=
"http://apache.org/dav/props/"
>
<D:response
xmlns:lp1=
"DAV:"
xmlns:lp2=
"http://apache.org/dav/props/"
>
<D:href>
/dav
/dav
getlist/jiotests/
</D:href>
<D:href>
/davgetlist/jiotests/
</D:href>
<D:propstat>
<D:propstat>
<D:prop>
<D:prop>
<lp1:resourcetype><D:collection/></lp1:resourcetype>
<lp1:resourcetype><D:collection/></lp1:resourcetype>
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
</D:propstat>
</D:propstat>
</D:response>
</D:response>
<D:response
xmlns:lp1=
"DAV:"
xmlns:lp2=
"http://apache.org/dav/props/"
>
<D:response
xmlns:lp1=
"DAV:"
xmlns:lp2=
"http://apache.org/dav/props/"
>
<D:href>
/dav
/dav
getlist/jiotests/file
</D:href>
<D:href>
/davgetlist/jiotests/file
</D:href>
<D:propstat>
<D:propstat>
<D:prop>
<D:prop>
<lp1:resourcetype/>
<lp1:resourcetype/>
...
@@ -50,7 +50,7 @@
...
@@ -50,7 +50,7 @@
</D:propstat>
</D:propstat>
</D:response>
</D:response>
<D:response
xmlns:lp1=
"DAV:"
xmlns:lp2=
"http://apache.org/dav/props/"
>
<D:response
xmlns:lp1=
"DAV:"
xmlns:lp2=
"http://apache.org/dav/props/"
>
<D:href>
/dav
/dav
getlist/jiotests/memo
</D:href>
<D:href>
/davgetlist/jiotests/memo
</D:href>
<D:propstat>
<D:propstat>
<D:prop>
<D:prop>
<lp1:resourcetype/>
<lp1:resourcetype/>
...
...
OfficeJS/test/responsexml/davload
View file @
bbf74f1f
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<D:multistatus
xmlns:D=
"DAV:"
>
<D:multistatus
xmlns:D=
"DAV:"
>
<D:response
xmlns:lp1=
"DAV:"
xmlns:lp2=
"http://apache.org/dav/props/"
>
<D:response
xmlns:lp1=
"DAV:"
xmlns:lp2=
"http://apache.org/dav/props/"
>
<D:href>
/dav
/dav
load/jiotests/file
</D:href>
<D:href>
/davload/jiotests/file
</D:href>
<D:propstat>
<D:propstat>
<D:prop>
<D:prop>
<lp1:resourcetype/>
<lp1:resourcetype/>
...
...
OfficeJS/test/responsexml/davsave
View file @
bbf74f1f
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<D:multistatus
xmlns:D=
"DAV:"
>
<D:multistatus
xmlns:D=
"DAV:"
>
<D:response
xmlns:lp1=
"DAV:"
xmlns:lp2=
"http://apache.org/dav/props/"
>
<D:response
xmlns:lp1=
"DAV:"
xmlns:lp2=
"http://apache.org/dav/props/"
>
<D:href>
/dav
/dav
save/jiotests/file
</D:href>
<D:href>
/davsave/jiotests/file
</D:href>
<D:propstat>
<D:propstat>
<D:prop>
<D:prop>
<lp1:resourcetype/>
<lp1:resourcetype/>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment