Here are the examples of the java api org.apache.http.HttpStatus.SC_MULTI_STATUS taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
94 Examples
19
Source : PropfindContentLengthTest.java
with Apache License 2.0
from personium
with Apache License 2.0
from personium
/**
* ServiceのソースコレクションのPROPFINDでbodyなしかつContentLengthなしのテスト.
*/
@Test
public final void ServiceのソースコレクションのPROPFINDでbodyなしかつContentLengthなしのテスト() {
// リクエストボディなしかつContentLengthなしのPROPFIND
DavResourceUtils.propfind("box/propfind-col-body-0-non-content-length.txt", TOKEN, HttpStatus.SC_MULTI_STATUS, SVCCOL_NAME + "/__src");
}
19
Source : PropfindContentLengthTest.java
with Apache License 2.0
from personium
with Apache License 2.0
from personium
/**
* BoxレベルのPROPFINDでbodyありのテスト.
*/
@Test
public final void BoxレベルのPROPFINDでbodyありのテスト() {
// リクエストボディありのPROPFIND
BoxUtils.propfind(TEST_CELL1, BOX_NAME, DEPTH, TOKEN, HttpStatus.SC_MULTI_STATUS);
}
19
Source : PropfindContentLengthTest.java
with Apache License 2.0
from personium
with Apache License 2.0
from personium
/**
* CellのPROPFINDでbodyありのテスト.
*/
@Test
public final void CellのPROPFINDでbodyありのテスト() {
// リクエストボディありのPROPFIND
CellUtils.propfind(TEST_CELL1, "cell/propfind-cell-allprop.txt", TOKEN, "1", HttpStatus.SC_MULTI_STATUS);
}
19
Source : PropfindContentLengthTest.java
with Apache License 2.0
from personium
with Apache License 2.0
from personium
/**
* ODataコレクションのPROPFINDでbodyなしかつContentLengthなしのテスト.
*/
@Test
public final void ODataコレクションのPROPFINDでbodyなしかつContentLengthなしのテスト() {
// リクエストボディなしかつContentLengthなしのPROPFIND
DavResourceUtils.propfind("box/propfind-col-body-0-non-content-length.txt", TOKEN, HttpStatus.SC_MULTI_STATUS, ODATACOL_NAME);
}
19
Source : PropfindContentLengthTest.java
with Apache License 2.0
from personium
with Apache License 2.0
from personium
/**
* BoxレベルのPROPFINDでbodyなしかつContentLengthありのテスト.
*/
@Test
public final void BoxレベルのPROPFINDでbodyなしかつContentLengthありのテスト() {
// リクエストボディなしかつContentLengthありのPROPFIND
BoxUtils.propfind(TEST_CELL1, BOX_NAME, DEPTH, TOKEN, true, HttpStatus.SC_MULTI_STATUS);
}
19
Source : PropfindContentLengthTest.java
with Apache License 2.0
from personium
with Apache License 2.0
from personium
/**
* BoxレベルのPROPFINDでbodyなしかつContentLengthなしのテスト.
*/
@Test
public final void BoxレベルのPROPFINDでbodyなしかつContentLengthなしのテスト() {
// リクエストボディなしかつContentLengthなしのPROPFIND
BoxUtils.propfind(TEST_CELL1, BOX_NAME, DEPTH, TOKEN, false, HttpStatus.SC_MULTI_STATUS);
}
19
Source : PropfindContentLengthTest.java
with Apache License 2.0
from personium
with Apache License 2.0
from personium
/**
* ODataコレクションのPROPFINDでbodyなしかつContentLengthありのテスト.
*/
@Test
public final void ODataコレクションのPROPFINDでbodyなしかつContentLengthありのテスト() {
// リクエストボディなしかつContentLengthありのPROPFIND
DavResourceUtils.propfind("box/propfind-col-body-0.txt", TOKEN, HttpStatus.SC_MULTI_STATUS, ODATACOL_NAME);
}
19
Source : PropfindContentLengthTest.java
with Apache License 2.0
from personium
with Apache License 2.0
from personium
/**
* WebDavCollectionレベルのPROPFINDでbodyなしかつContentLengthなしのテスト.
*/
@Test
public final void WebDavCollectionレベルのPROPFINDでbodyなしかつContentLengthなしのテスト() {
// リクエストボディなしかつContentLengthなしのPROPFIND
DavResourceUtils.propfind("box/propfind-col-body-0-non-content-length.txt", TOKEN, HttpStatus.SC_MULTI_STATUS, DAVCOL_NAME);
}
19
Source : PropfindContentLengthTest.java
with Apache License 2.0
from personium
with Apache License 2.0
from personium
/**
* WebDavCollectionレベルのPROPFINDでbodyなしかつContentLengthなしのテスト.
*/
@Test
public final void WebDavファイルのPROPFINDでbodyなしかつContentLengthなしのテスト() {
// リクエストボディなしかつContentLengthなしのPROPFIND
DavResourceUtils.propfind("box/propfind-col-body-0-non-content-length.txt", TOKEN, HttpStatus.SC_MULTI_STATUS, DAVCOL_NAME + "/" + DAVFILE_NAME);
}
19
Source : PropfindContentLengthTest.java
with Apache License 2.0
from personium
with Apache License 2.0
from personium
/**
* CellのPROPFINDでbodyなしかつContentLengthありのテスト.
*/
@Test
public final void CellのPROPFINDでbodyなしかつContentLengthありのテスト() {
// リクエストボディなしかつContentLengthありのPROPFIND
CellUtils.propfind(TEST_CELL1, "cell/propfind-cell-body-0.txt", TOKEN, "1", HttpStatus.SC_MULTI_STATUS);
}
19
Source : PropfindContentLengthTest.java
with Apache License 2.0
from personium
with Apache License 2.0
from personium
/**
* WebDavCollectionレベルのPROPFINDでbodyなしかつContentLengthありのテスト.
*/
@Test
public final void WebDavファイルのPROPFINDでbodyなしかつContentLengthありのテスト() {
// リクエストボディなしかつContentLengthありのPROPFIND
DavResourceUtils.propfind("box/propfind-col-body-0.txt", TOKEN, HttpStatus.SC_MULTI_STATUS, DAVCOL_NAME + "/" + DAVFILE_NAME);
}
19
Source : PropfindContentLengthTest.java
with Apache License 2.0
from personium
with Apache License 2.0
from personium
/**
* ServiceコレクションのPROPFINDでbodyなしかつContentLengthありのテスト.
*/
@Test
public final void ServiceコレクションのPROPFINDでbodyなしかつContentLengthありのテスト() {
// リクエストボディなしかつContentLengthありのPROPFIND
DavResourceUtils.propfind("box/propfind-col-body-0.txt", TOKEN, HttpStatus.SC_MULTI_STATUS, SVCCOL_NAME);
}
19
Source : PropfindContentLengthTest.java
with Apache License 2.0
from personium
with Apache License 2.0
from personium
/**
* WebDavCollectionレベルのPROPFINDでbodyなしかつContentLengthありのテスト.
*/
@Test
public final void WebDavCollectionレベルのPROPFINDでbodyなしかつContentLengthありのテスト() {
// リクエストボディなしかつContentLengthありのPROPFIND
DavResourceUtils.propfind("box/propfind-col-body-0.txt", TOKEN, HttpStatus.SC_MULTI_STATUS, DAVCOL_NAME);
}
19
Source : PropfindContentLengthTest.java
with Apache License 2.0
from personium
with Apache License 2.0
from personium
/**
* ServiceコレクションのPROPFINDでbodyありのテスト.
*/
@Test
public final void ServiceコレクションのPROPFINDでbodyありのテスト() {
// リクエストボディありのPROPFIND
DavResourceUtils.propfind("box/propfind-col-allprop.txt", TOKEN, HttpStatus.SC_MULTI_STATUS, SVCCOL_NAME);
}
19
Source : PropfindContentLengthTest.java
with Apache License 2.0
from personium
with Apache License 2.0
from personium
/**
* WebDavファイルのPROPFINDでbodyありのテスト.
*/
@Test
public final void WebDavファイルのPROPFINDでbodyありのテスト() {
// リクエストボディありのPROPFIND
DavResourceUtils.propfind("box/propfind-col-allprop.txt", TOKEN, HttpStatus.SC_MULTI_STATUS, DAVCOL_NAME + "/" + DAVFILE_NAME);
}
19
Source : PropfindContentLengthTest.java
with Apache License 2.0
from personium
with Apache License 2.0
from personium
/**
* ServiceコレクションのPROPFINDでbodyなしかつContentLengthなしのテスト.
*/
@Test
public final void ServiceコレクションのPROPFINDでbodyなしかつContentLengthなしのテスト() {
// リクエストボディなしかつContentLengthなしのPROPFIND
DavResourceUtils.propfind("box/propfind-col-body-0-non-content-length.txt", TOKEN, HttpStatus.SC_MULTI_STATUS, SVCCOL_NAME);
}
19
Source : PropfindContentLengthTest.java
with Apache License 2.0
from personium
with Apache License 2.0
from personium
/**
* CellのPROPFINDでbodyなしかつContentLengthなしのテスト.
*/
@Test
public final void CellのPROPFINDでbodyなしかつContentLengthなしのテスト() {
// リクエストボディなしかつContentLengthなしのPROPFIND
CellUtils.propfind(TEST_CELL1, "cell/propfind-cell-body-0-non-content-length.txt", TOKEN, "1", HttpStatus.SC_MULTI_STATUS);
}
19
Source : PropfindContentLengthTest.java
with Apache License 2.0
from personium
with Apache License 2.0
from personium
/**
* ServiceのソースコレクションのPROPFINDでbodyありのテスト.
*/
@Test
public final void ServiceのソースコレクションのPROPFINDでbodyありのテスト() {
// リクエストボディありのPROPFIND
DavResourceUtils.propfind("box/propfind-col-allprop.txt", TOKEN, HttpStatus.SC_MULTI_STATUS, SVCCOL_NAME + "/__src");
}
19
Source : PropfindContentLengthTest.java
with Apache License 2.0
from personium
with Apache License 2.0
from personium
/**
* WebDavCollectionレベルのPROPFINDでbodyありのテスト.
*/
@Test
public final void WebDavCollectionレベルのPROPFINDでbodyありのテスト() {
// リクエストボディありのPROPFIND
DavResourceUtils.propfind("box/propfind-col-allprop.txt", TOKEN, HttpStatus.SC_MULTI_STATUS, DAVCOL_NAME);
}
19
Source : PropfindContentLengthTest.java
with Apache License 2.0
from personium
with Apache License 2.0
from personium
/**
* ServiceのソースコレクションのPROPFINDでbodyなしかつContentLengthありのテスト.
*/
@Test
public final void ServiceのソースコレクションのPROPFINDでbodyなしかつContentLengthありのテスト() {
// リクエストボディなしかつContentLengthありのPROPFIND
DavResourceUtils.propfind("box/propfind-col-body-0.txt", TOKEN, HttpStatus.SC_MULTI_STATUS, SVCCOL_NAME + "/__src");
}
19
Source : PropfindContentLengthTest.java
with Apache License 2.0
from personium
with Apache License 2.0
from personium
/**
* ODataコレクションのPROPFINDでbodyありのテスト.
*/
@Test
public final void ODataコレクションのPROPFINDでbodyありのテスト() {
// リクエストボディありのPROPFIND
DavResourceUtils.propfind("box/propfind-col-allprop.txt", TOKEN, HttpStatus.SC_MULTI_STATUS, ODATACOL_NAME);
}
18
Source : DavNodePropFindTest.java
with Apache License 2.0
from personium
with Apache License 2.0
from personium
/**
* 引数で渡されたリソースに対してPROPFIND(depth=1)を実行して、/multistatus/response/hrefのノードリストを取得する.
* @param propFile リクエストファイル名
* @param token アクセストークン
* @param cellName セル名
* @param path Box配下のリソースパス
* @return 取得したノードリスト
*/
private NodeList requestPropfindAndGetNodes(String propFile, String token, String cellName, String path) {
TResponse res = DavResourceUtils.propfind(propFile, TOKEN, CELL_NAME, path, 1, HttpStatus.SC_MULTI_STATUS);
Element root = res.bodyAsXml().getDoreplacedentElement();
NodeList resElems = root.getElementsByTagName("response");
return resElems;
}
18
Source : ServiceSourceAccessControlTest.java
with Apache License 2.0
from personium
with Apache License 2.0
from personium
/**
* 親コレクションにwriteproperties権限があるアカウントでPROPPATCHを行い207となること.
* @throws JAXBException ACLのパース失敗
*/
@Test
public void 親コレクションにwriteproperties権限があるアカウントでPROPPATCHを行い207となること() throws JAXBException {
String token;
String path = String.format("%s/%s", PARENT_COL_NAME, TARGET_SOURCE_FILE_PATH);
// ACL設定
setAcl(PARENT_COL_NAME, ROLE, "write-properties");
// アクセストークン取得
token = getToken(ACCOUNT);
// リクエスト実行
DavResourceUtils.setProppatch(token, HttpStatus.SC_MULTI_STATUS, CELL_NAME, BOX_NAME, path);
}
18
Source : WebDAVCollectionAccessControlTest.java
with Apache License 2.0
from personium
with Apache License 2.0
from personium
/**
* 親コレクションにwriteproperties権限がある_かつ_対象コレクションに権限がないアカウントでPROPPATCHを行い207となること.
* @throws JAXBException ACLのパース失敗
*/
@Test
public void 親コレクションにwriteproperties権限がある_かつ_対象コレクションに権限がないアカウントでPROPPATCHを行い207となること() throws JAXBException {
String token;
String path = String.format("%s/%s", PARENT_COL_NAME, TARGET_COL_NAME);
// ACL設定
setAcl(PARENT_COL_NAME, ROLE, "write-properties");
// アクセストークン取得
token = getToken(ACCOUNT);
// リクエスト実行
DavResourceUtils.setProppatch(token, HttpStatus.SC_MULTI_STATUS, CELL_NAME, BOX_NAME, path);
}
18
Source : WebDAVCollectionAccessControlTest.java
with Apache License 2.0
from personium
with Apache License 2.0
from personium
/**
* 親コレクションに権限がない_かつ_対象コレクションにwriteproperties権限があるアカウントでPROPPATCHを行い207となること.
* @throws JAXBException ACLのパース失敗
*/
@Test
public void 親コレクションに権限がない_かつ_対象コレクションにwriteproperties権限があるアカウントでPROPPATCHを行い207となること() throws JAXBException {
String token;
String path = String.format("%s/%s", PARENT_COL_NAME, TARGET_COL_NAME);
// ACL設定
setAcl(path, ROLE, "write-properties");
// アクセストークン取得
token = getToken(ACCOUNT);
// リクエスト実行
DavResourceUtils.setProppatch(token, HttpStatus.SC_MULTI_STATUS, CELL_NAME, BOX_NAME, path);
}
18
Source : WebDAVCollectionAccessControlTest.java
with Apache License 2.0
from personium
with Apache License 2.0
from personium
/**
* 親コレクションにwriteproperties権限がある_かつ_対象コレクションにwriteproperties権限があるアカウントでPROPPATCHを行い207となること.
* @throws JAXBException ACLのパース失敗
*/
@Test
public void 親コレクションにwriteproperties権限がある_かつ_対象コレクションにwriteproperties権限があるアカウントでPROPPATCHを行い207となること() throws JAXBException {
String token;
String path = String.format("%s/%s", PARENT_COL_NAME, TARGET_COL_NAME);
// ACL設定
setAcl(PARENT_COL_NAME, ROLE, "write-properties");
setAcl(path, ROLE, "write-properties");
// アクセストークン取得
token = getToken(ACCOUNT);
// リクエスト実行
DavResourceUtils.setProppatch(token, HttpStatus.SC_MULTI_STATUS, CELL_NAME, BOX_NAME, path);
}
17
Source : HttpRedirectsProvider.java
with Apache License 2.0
from vividus-framework
with Apache License 2.0
from vividus-framework
/**
* Executes HEAD request to get redirects.
* Throws IllegalStateException in case of status code outside of "200-207"
* @param from URI to issue HEAD request
* @return List of redirects. {@code null} if there are no redirects.
*/
public List<URI> getRedirects(URI from) {
try {
HttpClientContext httpContext = HttpClientContext.create();
httpClient.doHttpHead(from, httpContext).verifyStatusCodeInRange(HttpStatus.SC_OK, HttpStatus.SC_MULTI_STATUS);
return httpContext.getRedirectLocations();
} catch (IOException | ExternalServiceException e) {
String exceptionMsg;
if (e.getCause() instanceof CircularRedirectException) {
exceptionMsg = e.getCause().getMessage() + " Circular redirects are forbidden by default. " + "To allow them, please set property " + "'http.redirects-provider.circular-redirects-allowed=true'";
} else {
exceptionMsg = e.getMessage();
}
throw new IllegalStateException(exceptionMsg, e);
}
}
17
Source : LogListTest.java
with Apache License 2.0
from personium
with Apache License 2.0
from personium
/**
* アーカイブログファイル一覧取得_ボディなしかつContentLengthありのPROPFINDで207が返却されること.
*/
@Test
public final void アーカイブログファイル一覧取得_ボディなしかつContentLengthありのPROPFINDで207が返却されること() {
Http.request("cell/log-propfind-with-nobody.txt").with("METHOD", io.personium.common.utils.CommonUtils.HttpMethod.PROPFIND).with("token", AbstractCase.MASTER_TOKEN_NAME).with("cellPath", Setup.TEST_CELL_EVENTLOG).with("collection", ARCHIVE_COLLECTION).with("depth", "0").returns().statusCode(HttpStatus.SC_MULTI_STATUS);
}
17
Source : LogListTest.java
with Apache License 2.0
from personium
with Apache License 2.0
from personium
/**
* アーカイブログファイル一覧取得にDepth0を指定した場合に1階層分だけ返却されること.
*/
@Test
public final void アーカイブログファイル一覧取得にDepth0を指定した場合に1階層分だけ返却されること() {
String body = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + "<D:propfind xmlns:D=\"DAV:\"><D:allprop/></D:propfind>";
TResponse tresponse = Http.request("cell/log-propfind-with-body.txt").with("METHOD", io.personium.common.utils.CommonUtils.HttpMethod.PROPFIND).with("token", AbstractCase.MASTER_TOKEN_NAME).with("cellPath", Setup.TEST_CELL_EVENTLOG).with("collection", ARCHIVE_COLLECTION).with("depth", "0").with("body", body).returns().debug().statusCode(HttpStatus.SC_MULTI_STATUS);
// BodyXMLからの要素取得
checkLogListResponse(tresponse, Setup.TEST_CELL_EVENTLOG, 0);
}
17
Source : LogListTest.java
with Apache License 2.0
from personium
with Apache License 2.0
from personium
/**
* アーカイブログファイル一覧取得_ボディなしかつContentLengthなしのPROPFINDで207が返却されること.
*/
@Test
public final void アーカイブログファイル一覧取得_ボディなしかつContentLengthなしのPROPFINDで207が返却されること() {
Http.request("cell/log-propfind-with-nobody-non-content-length.txt").with("METHOD", io.personium.common.utils.CommonUtils.HttpMethod.PROPFIND).with("token", AbstractCase.MASTER_TOKEN_NAME).with("cellPath", Setup.TEST_CELL_EVENTLOG).with("collection", ARCHIVE_COLLECTION).with("depth", "0").returns().statusCode(HttpStatus.SC_MULTI_STATUS);
}
17
Source : LogListTest.java
with Apache License 2.0
from personium
with Apache License 2.0
from personium
/**
* アーカイブログファイル一覧取得_ボディにallpropを指定したPROPFINDで207が返却されること.
*/
@Test
public final void アーカイブログファイル一覧取得_ボディにallpropを指定したPROPFINDで207が返却されること() {
String body = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + "<D:propfind xmlns:D=\"DAV:\"><D:allprop/></D:propfind>";
TResponse tresponse = Http.request("cell/log-propfind-with-body.txt").with("METHOD", io.personium.common.utils.CommonUtils.HttpMethod.PROPFIND).with("token", AbstractCase.MASTER_TOKEN_NAME).with("cellPath", Setup.TEST_CELL_EVENTLOG).with("collection", ARCHIVE_COLLECTION).with("depth", "1").with("body", body).returns().debug().statusCode(HttpStatus.SC_MULTI_STATUS);
checkLogListResponse(tresponse, Setup.TEST_CELL_EVENTLOG, 1);
}
17
Source : ServiceSourceTest.java
with Apache License 2.0
from personium
with Apache License 2.0
from personium
/**
* ServiceSourceのPROPFINDで設定が取得できること.
*/
@Test
public final void ServiceSourceのPROPFINDで設定が取得できること() {
try {
// サービスコレクションの作成
Http.request("box/mkcol-service.txt").with("cellPath", "testcell1").with("path", serviceColPath).with("token", AbstractCase.MASTER_TOKEN_NAME).returns().statusCode(HttpStatus.SC_CREATED);
// サービスソースの取得(bodyあり)
Http.request("box/propfind-col-allprop.txt").with("path", srcPath).with("depth", "0").with("token", AbstractCase.MASTER_TOKEN_NAME).returns().statusCode(HttpStatus.SC_MULTI_STATUS);
} finally {
// サービスコレクションの削除
deleteCollection(serviceColPath);
}
}
17
Source : DavNodePropFindTest.java
with Apache License 2.0
from personium
with Apache License 2.0
from personium
/**
* 複数階層のDavCollectionに対するPROPFINDが正しく取得できること.
*/
@Test
public final void 複数階層のDavCollectionに対するPROPFINDが正しく取得できること() {
final String davColFile = "box/mkcol.txt";
final String davFile = "box/dav-put.txt";
final String propFile = "box/propfind-box-allprop.txt";
final String davBody = "dav body";
// Box配下のDavコレクション作成
// 1階層目のDavコレクション配下にDavコレクション作成
String path = BOX_NAME + "/" + "dav1";
DavResourceUtils.createWebDavCollection(davColFile, CELL_NAME, path, TOKEN, HttpStatus.SC_CREATED);
path = BOX_NAME + "/" + "dav2";
DavResourceUtils.createWebDavCollection(davColFile, CELL_NAME, path, TOKEN, HttpStatus.SC_CREATED);
// Box配下のDavファイル作成
path = "file1.txt";
DavResourceUtils.createWebDavFile(CELL_NAME, TOKEN, davFile, davBody, BOX_NAME, path, HttpStatus.SC_CREATED);
path = "file2.txt";
DavResourceUtils.createWebDavFile(CELL_NAME, TOKEN, davFile, davBody, BOX_NAME, path, HttpStatus.SC_CREATED);
// 1階層目のDavコレクション配下にDavファイル作成
path = "dav1/dav1-file1.txt";
DavResourceUtils.createWebDavFile(CELL_NAME, TOKEN, davFile, davBody, BOX_NAME, path, HttpStatus.SC_CREATED);
path = "dav1/dav1-file2.txt";
DavResourceUtils.createWebDavFile(CELL_NAME, TOKEN, davFile, davBody, BOX_NAME, path, HttpStatus.SC_CREATED);
path = "dav2/dav2-file1.txt";
DavResourceUtils.createWebDavFile(CELL_NAME, TOKEN, davFile, davBody, BOX_NAME, path, HttpStatus.SC_CREATED);
path = "dav2/dav2-file2.txt";
DavResourceUtils.createWebDavFile(CELL_NAME, TOKEN, davFile, davBody, BOX_NAME, path, HttpStatus.SC_CREATED);
// 1階層目のDavコレクション配下にDavコレクション作成
path = BOX_NAME + "/" + "dav2/dav2-1";
DavResourceUtils.createWebDavCollection(davColFile, CELL_NAME, path, TOKEN, HttpStatus.SC_CREATED);
path = BOX_NAME + "/" + "dav2/dav2-2";
DavResourceUtils.createWebDavCollection(davColFile, CELL_NAME, path, TOKEN, HttpStatus.SC_CREATED);
// 2階層目のDavコレクション配下にDavファイル作成
path = "dav2/dav2-1/dav2-1-file1.txt";
DavResourceUtils.createWebDavFile(CELL_NAME, TOKEN, davFile, davBody, BOX_NAME, path, HttpStatus.SC_CREATED);
path = "dav2/dav2-1/dav2-1-file2.txt";
DavResourceUtils.createWebDavFile(CELL_NAME, TOKEN, davFile, davBody, BOX_NAME, path, HttpStatus.SC_CREATED);
path = "dav2/dav2-2/dav2-2-file1.txt";
DavResourceUtils.createWebDavFile(CELL_NAME, TOKEN, davFile, davBody, BOX_NAME, path, HttpStatus.SC_CREATED);
path = "dav2/dav2-2/dav2-2-file2.txt";
DavResourceUtils.createWebDavFile(CELL_NAME, TOKEN, davFile, davBody, BOX_NAME, path, HttpStatus.SC_CREATED);
// Check0: PROPFND Cell (Resources directly below Cell are not displayed)
// * This process essentially corresponds to "290_Cell_Get_Property".
// * However, there is a part that performs the same process as "305_Get_Property" internally,
// * and it was necessary to register and test the subordinate WebDav, so a test case was added here.
List<String> expects = new ArrayList<String>();
expects.add(CELL_NAME);
TResponse cellPropRes = CellUtils.propfind(CELL_NAME, "cell/propfind-cell-allprop.txt", TOKEN, "1", HttpStatus.SC_MULTI_STATUS);
NodeList resElems = cellPropRes.bodyAsXml().getDoreplacedentElement().getElementsByTagName("response");
replacedertEquals(expects.size(), resElems.getLength());
checkPropFindChildren(resElems, expects);
// Check1: Box直下のPROPFND
path = BOX_NAME;
expects = new ArrayList<String>();
expects.add(BOX_NAME);
expects.add("dav1");
expects.add("dav2");
expects.add("file1.txt");
expects.add("file2.txt");
resElems = requestPropfindAndGetNodes(propFile, TOKEN, CELL_NAME, path);
replacedertEquals(expects.size(), resElems.getLength());
checkPropFindChildren(resElems, expects);
// Check2-1: 1階層目のDavコレクションのPROPFND(2File)
path = BOX_NAME + "/" + "dav1";
expects = new ArrayList<String>();
expects.add("dav1");
expects.add("dav1-file1.txt");
expects.add("dav1-file2.txt");
resElems = requestPropfindAndGetNodes(propFile, TOKEN, CELL_NAME, path);
replacedertEquals(expects.size(), resElems.getLength());
checkPropFindChildren(resElems, expects);
// Check2-1: 1階層目のDavコレクションのPROPFND(2Collection + 2File)
path = BOX_NAME + "/" + "dav2";
expects = new ArrayList<String>();
expects.add("dav2");
expects.add("dav2-file1.txt");
expects.add("dav2-file2.txt");
expects.add("dav2-1");
expects.add("dav2-2");
resElems = requestPropfindAndGetNodes(propFile, TOKEN, CELL_NAME, path);
replacedertEquals(expects.size(), resElems.getLength());
checkPropFindChildren(resElems, expects);
// Check3-1: 2階層目のDavコレクションのPROPFND(2File)
path = BOX_NAME + "/" + "dav2/dav2-1";
expects = new ArrayList<String>();
expects.add("dav2-1");
expects.add("dav2-1-file1.txt");
expects.add("dav2-1-file2.txt");
resElems = requestPropfindAndGetNodes(propFile, TOKEN, CELL_NAME, path);
replacedertEquals(expects.size(), resElems.getLength());
checkPropFindChildren(resElems, expects);
// Check3-2: 2階層目のDavコレクションのPROPFND(2File)
path = BOX_NAME + "/" + "dav2/dav2-2";
expects = new ArrayList<String>();
expects.add("dav2-2");
expects.add("dav2-2-file1.txt");
expects.add("dav2-2-file2.txt");
resElems = requestPropfindAndGetNodes(propFile, TOKEN, CELL_NAME, path);
replacedertEquals(expects.size(), resElems.getLength());
checkPropFindChildren(resElems, expects);
}
17
Source : ServiceSourceAccessControlTest.java
with Apache License 2.0
from personium
with Apache License 2.0
from personium
/**
* 親コレクションにreadproperties権限があるアカウントでファイルのPROPFINDを行いACL以外の情報が表示されること.
* @throws JAXBException ACLのパース失敗
*/
@Test
public void 親コレクションにreadproperties権限があるアカウントでファイルのPROPFINDを行いACL以外の情報が表示されること() throws JAXBException {
String token;
String path = String.format("%s/%s", PARENT_COL_NAME, TARGET_SOURCE_FILE_PATH);
String pathForPropfind = String.format("%s/%s/%s", BOX_NAME, PARENT_COL_NAME, TARGET_SOURCE_FILE_PATH);
// ACL設定
setAcl(PARENT_COL_NAME, ROLE, "read-properties");
// アクセストークン取得
token = getToken(ACCOUNT);
// リクエスト実行
TResponse res = DavResourceUtils.propfind(token, CELL_NAME, pathForPropfind, "1", HttpStatus.SC_MULTI_STATUS);
String expectedUrl = UrlUtils.box(CELL_NAME, BOX_NAME, path);
DavResourceUtils.replacedertContainsHrefUrl(expectedUrl, res);
DavResourceUtils.replacedertNotContainsNodeInResXml(res, "ace");
}
17
Source : WebDAVCollectionAccessControlTest.java
with Apache License 2.0
from personium
with Apache License 2.0
from personium
/**
* 親コレクションにreadacl権限がある_かつ_対象コレクションにreadproperties権限があるアカウントでPROPFINDを行い全てが表示されること.
* @throws JAXBException ACLのパース失敗
*/
@Test
public void 親コレクションにreadacl権限がある_かつ_対象コレクションにreadproperties権限があるアカウントでPROPFINDを行い全てが表示されること() throws JAXBException {
String token;
String path = String.format("%s/%s", PARENT_COL_NAME, TARGET_COL_NAME);
String pathForPropfind = String.format("%s/%s/%s", BOX_NAME, PARENT_COL_NAME, TARGET_COL_NAME);
// ACL設定
setAcl(PARENT_COL_NAME, ROLE, "read-acl");
setAcl(path, ROLE, "read-properties");
// アクセストークン取得
token = getToken(ACCOUNT);
// リクエスト実行
TResponse res = DavResourceUtils.propfind(token, CELL_NAME, pathForPropfind, "1", HttpStatus.SC_MULTI_STATUS);
String expectedUrl = UrlUtils.box(CELL_NAME, BOX_NAME, path);
DavResourceUtils.replacedertContainsHrefUrl(expectedUrl, res);
DavResourceUtils.replacedertContainsNodeInResXml(res, "ace");
}
17
Source : WebDAVCollectionAccessControlTest.java
with Apache License 2.0
from personium
with Apache License 2.0
from personium
/**
* 親コレクションにreadproperties権限がある_かつ_対象コレクションにreadacl権限があるアカウントでコレクションのPROPFINDを行い全ての情報が表示されること.
* @throws JAXBException ACLのパース失敗
*/
@Test
public void 親コレクションにreadproperties権限がある_かつ_対象コレクションにreadacl権限があるアカウントでコレクションのPROPFINDを行い全ての情報が表示されること() throws JAXBException {
String token;
String path = String.format("%s/%s", PARENT_COL_NAME, TARGET_COL_NAME);
String pathForPropfind = String.format("%s/%s/%s", BOX_NAME, PARENT_COL_NAME, TARGET_COL_NAME);
// ACL設定
setAcl(PARENT_COL_NAME, ROLE, "read-properties");
setAcl(path, ROLE, "read-acl");
// アクセストークン取得
token = getToken(ACCOUNT);
// リクエスト実行
TResponse res = DavResourceUtils.propfind(token, CELL_NAME, pathForPropfind, "1", HttpStatus.SC_MULTI_STATUS);
String expectedUrl = UrlUtils.box(CELL_NAME, BOX_NAME, path);
DavResourceUtils.replacedertContainsHrefUrl(expectedUrl, res);
DavResourceUtils.replacedertContainsNodeInResXml(res, "ace");
}
17
Source : WebDAVCollectionAccessControlTest.java
with Apache License 2.0
from personium
with Apache License 2.0
from personium
/**
* 親コレクションにreadproperties権限がある_かつ_対象コレクションに権限がないアカウントでコレクションのPROPFINDを行いACL以外の情報が表示されること.
* @throws JAXBException ACLのパース失敗
*/
@Test
public void 親コレクションにreadproperties権限がある_かつ_対象コレクションに権限がないアカウントでコレクションのPROPFINDを行いACL以外の情報が表示されること() throws JAXBException {
String token;
String path = String.format("%s/%s", PARENT_COL_NAME, TARGET_COL_NAME);
String pathForPropfind = String.format("%s/%s/%s", BOX_NAME, PARENT_COL_NAME, TARGET_COL_NAME);
// ACL設定
setAcl(PARENT_COL_NAME, ROLE, "read-properties");
// アクセストークン取得
token = getToken(ACCOUNT);
// リクエスト実行
TResponse res = DavResourceUtils.propfind(token, CELL_NAME, pathForPropfind, "1", HttpStatus.SC_MULTI_STATUS);
String expectedUrl = UrlUtils.box(CELL_NAME, BOX_NAME, path);
DavResourceUtils.replacedertContainsHrefUrl(expectedUrl, res);
DavResourceUtils.replacedertNotContainsNodeInResXml(res, "ace");
}
17
Source : WebDAVCollectionAccessControlTest.java
with Apache License 2.0
from personium
with Apache License 2.0
from personium
/**
* 親コレクションにreadproperties権限がある_かつ_対象コレクションにreadproperties権限があるアカウントでコレクションのPROPFINDを行いACL以外の情報が表示されること.
* @throws JAXBException ACLのパース失敗
*/
@Test
public void 親コレクションにreadproperties権限がある_かつ_対象コレクションにreadproperties権限があるアカウントでコレクションのPROPFINDを行いACL以外の情報が表示されること() throws JAXBException {
String token;
String path = String.format("%s/%s", PARENT_COL_NAME, TARGET_COL_NAME);
String pathForPropfind = String.format("%s/%s/%s", BOX_NAME, PARENT_COL_NAME, TARGET_COL_NAME);
// ACL設定
setAcl(PARENT_COL_NAME, ROLE, "read-properties");
setAcl(path, ROLE, "read-properties");
// アクセストークン取得
token = getToken(ACCOUNT);
// リクエスト実行
TResponse res = DavResourceUtils.propfind(token, CELL_NAME, pathForPropfind, "1", HttpStatus.SC_MULTI_STATUS);
String expectedUrl = UrlUtils.box(CELL_NAME, BOX_NAME, path);
DavResourceUtils.replacedertContainsHrefUrl(expectedUrl, res);
DavResourceUtils.replacedertNotContainsNodeInResXml(res, "ace");
}
17
Source : WebDAVCollectionAccessControlTest.java
with Apache License 2.0
from personium
with Apache License 2.0
from personium
/**
* 親コレクションにreadproperties権限がある_かつ_対象コレクションにreadpropertiesとreadacl権限があるアカウントでPROPFINDを行い全ての情報が表示されること.
* @throws JAXBException ACLのパース失敗
*/
@Test
public void 親コレクションにreadproperties権限がある_かつ_対象コレクションにreadpropertiesとreadacl権限があるアカウントでPROPFINDを行い全ての情報が表示されること() throws JAXBException {
String token;
String path = String.format("%s/%s", PARENT_COL_NAME, TARGET_COL_NAME);
String pathForPropfind = String.format("%s/%s/%s", BOX_NAME, PARENT_COL_NAME, TARGET_COL_NAME);
// ACL設定
setAcl(PARENT_COL_NAME, ROLE, "read-properties");
setAcl(path, ROLE, "read-properties", "read-acl");
// アクセストークン取得
token = getToken(ACCOUNT);
// リクエスト実行
TResponse res = DavResourceUtils.propfind(token, CELL_NAME, pathForPropfind, "1", HttpStatus.SC_MULTI_STATUS);
String expectedUrl = UrlUtils.box(CELL_NAME, BOX_NAME, path);
DavResourceUtils.replacedertContainsHrefUrl(expectedUrl, res);
DavResourceUtils.replacedertContainsNodeInResXml(res, "ace");
}
17
Source : WebDAVCollectionAccessControlTest.java
with Apache License 2.0
from personium
with Apache License 2.0
from personium
/**
* 親コレクションに権限がない_かつ_対象コレクションにreadpropertiesとreadacl権限があるアカウントでコレクションのPROPFINDを行い全てが表示されること.
* @throws JAXBException ACLのパース失敗
*/
@Test
public void 親コレクションに権限がない_かつ_対象コレクションにreadpropertiesとreadacl権限があるアカウントでコレクションのPROPFINDを行い全てが表示されること() throws JAXBException {
String token;
String path = String.format("%s/%s", PARENT_COL_NAME, TARGET_COL_NAME);
String pathForPropfind = String.format("%s/%s/%s", BOX_NAME, PARENT_COL_NAME, TARGET_COL_NAME);
// ACL設定
setAcl(path, ROLE, "read-properties", "read-acl");
// アクセストークン取得
token = getToken(ACCOUNT);
// リクエスト実行
TResponse res = DavResourceUtils.propfind(token, CELL_NAME, pathForPropfind, "1", HttpStatus.SC_MULTI_STATUS);
String expectedUrl = UrlUtils.box(CELL_NAME, BOX_NAME, path);
DavResourceUtils.replacedertContainsHrefUrl(expectedUrl, res);
DavResourceUtils.replacedertContainsNodeInResXml(res, "ace");
}
17
Source : WebDAVCollectionAccessControlTest.java
with Apache License 2.0
from personium
with Apache License 2.0
from personium
/**
* 親コレクションにreadacl権限がある_かつ_対象コレクションにreadpropertiesとreadacl権限があるアカウントでPROPFINDを行い全てが表示されること.
* @throws JAXBException ACLのパース失敗
*/
@Test
public void 親コレクションにreadacl権限がある_かつ_対象コレクションにreadpropertiesとreadacl権限があるアカウントでPROPFINDを行い全てが表示されること() throws JAXBException {
String token;
String path = String.format("%s/%s", PARENT_COL_NAME, TARGET_COL_NAME);
String pathForPropfind = String.format("%s/%s/%s", BOX_NAME, PARENT_COL_NAME, TARGET_COL_NAME);
// ACL設定
setAcl(PARENT_COL_NAME, ROLE, "read-acl");
setAcl(path, ROLE, "read-properties", "read-acl");
// アクセストークン取得
token = getToken(ACCOUNT);
// リクエスト実行
TResponse res = DavResourceUtils.propfind(token, CELL_NAME, pathForPropfind, "1", HttpStatus.SC_MULTI_STATUS);
String expectedUrl = UrlUtils.box(CELL_NAME, BOX_NAME, path);
DavResourceUtils.replacedertContainsHrefUrl(expectedUrl, res);
DavResourceUtils.replacedertContainsNodeInResXml(res, "ace");
}
17
Source : WebDAVCollectionAccessControlTest.java
with Apache License 2.0
from personium
with Apache License 2.0
from personium
/**
* 親コレクションに権限がない_かつ_対象コレクションにreadproperties権限があるアカウントでコレクションのPROPFINDを行いACL情報以外が表示されること.
* @throws JAXBException ACLのパース失敗
*/
@Test
public void 親コレクションに権限がない_かつ_対象コレクションにreadproperties権限があるアカウントでコレクションのPROPFINDを行いACL情報以外が表示されること() throws JAXBException {
String token;
String path = String.format("%s/%s", PARENT_COL_NAME, TARGET_COL_NAME);
String pathForPropfind = String.format("%s/%s/%s", BOX_NAME, PARENT_COL_NAME, TARGET_COL_NAME);
// ACL設定
setAcl(path, ROLE, "read-properties");
// アクセストークン取得
token = getToken(ACCOUNT);
// リクエスト実行
TResponse res = DavResourceUtils.propfind(token, CELL_NAME, pathForPropfind, "1", HttpStatus.SC_MULTI_STATUS);
String expectedUrl = UrlUtils.box(CELL_NAME, BOX_NAME, path);
DavResourceUtils.replacedertContainsHrefUrl(expectedUrl, res);
DavResourceUtils.replacedertNotContainsNodeInResXml(res, "ace");
}
17
Source : ServiceCollectionAccessControlTest.java
with Apache License 2.0
from personium
with Apache License 2.0
from personium
/**
* 親コレクションにreadproperties権限があるアカウントでsrcコレクションのPROPFINDを行いACL情報以外が表示されること.
* @throws JAXBException ACLのパース失敗
*/
@Test
public void 親コレクションにreadproperties権限があるアカウントでsrcコレクションのPROPFINDを行いACL情報以外が表示されること() throws JAXBException {
String token;
String parentColPath = String.format("%s/%s", PARENT_COL_NAME, TARGET_COL_NAME);
String path = String.format("%s/%s/__src", PARENT_COL_NAME, TARGET_COL_NAME);
String pathForPropfind = String.format("%s/%s/%s/__src", BOX_NAME, PARENT_COL_NAME, TARGET_COL_NAME);
// ACL設定
setAcl(parentColPath, ROLE, "read-properties");
// アクセストークン取得
token = getToken(ACCOUNT);
// リクエスト実行
TResponse res = DavResourceUtils.propfind(token, CELL_NAME, pathForPropfind, "1", HttpStatus.SC_MULTI_STATUS);
String expectedUrl = UrlUtils.box(CELL_NAME, BOX_NAME, path);
DavResourceUtils.replacedertContainsHrefUrl(expectedUrl, res);
DavResourceUtils.replacedertNotContainsNodeInResXml(res, "ace");
}
17
Source : ServiceRelayTest.java
with Apache License 2.0
from personium
with Apache License 2.0
from personium
/**
* 事前準備.
*/
@Before
public final void before() {
// PropPatch サービス設定の登録
Http.request("box/proppatch-set-service.txt").with("path", "service_relay").with("token", AbstractCase.MASTER_TOKEN_NAME).with("name", "relay").with("src", "relay.js").returns().statusCode(HttpStatus.SC_MULTI_STATUS);
// WebDAV サービスリソースの登録
Http.request("box/dav-put.txt").with("cellPath", "testcell1").with("path", "service_relay/__src/relay.js").with("token", AbstractCase.MASTER_TOKEN_NAME).with("box", "box1").with("contentType", "text/javascript").with("source", SOURCE).returns().statusCode(HttpStatus.SC_CREATED);
}
16
Source : AuthHistoryTest.java
with Apache License 2.0
from personium
with Apache License 2.0
from personium
/**
* test accountsnotrecordingauthhistory.
*/
@Test
public final void not_recording_auth_history() {
String accountNr2 = "accountNr2";
try {
AccountUtils.create(Setup.MASTER_TOKEN_NAME, TEST_CELL, accountNr2, TEST_PreplacedWORD, HttpStatus.SC_CREATED);
CellUtils.proppatchSet(TEST_CELL, "<p:accountsnotrecordingauthhistory>accountNr1,accountNr2</p:accountsnotrecordingauthhistory>", Setup.MASTER_TOKEN_NAME, HttpStatus.SC_MULTI_STATUS);
// first get token. Authentication history is not recorded.
requestAuthentication(TEST_CELL, accountNr2, "dummypreplacedword1", HttpStatus.SC_BAD_REQUEST);
requestAuthentication(TEST_CELL, accountNr2, "dummypreplacedword1", HttpStatus.SC_BAD_REQUEST);
requestAuthentication(TEST_CELL, accountNr2, "dummypreplacedword1", HttpStatus.SC_BAD_REQUEST);
AuthTestCommon.waitForIntervalLock();
TResponse preplacedRes = requestAuthentication(TEST_CELL, accountNr2, TEST_PreplacedWORD, HttpStatus.SC_OK);
replacedertTrue(preplacedRes.bodyAsJson().containsKey(OAuth2Helper.Key.LAST_AUTHENTICATED));
replacedertNull(preplacedRes.bodyAsJson().get(OAuth2Helper.Key.LAST_AUTHENTICATED));
replacedertThat(preplacedRes.bodyAsJson().get(OAuth2Helper.Key.FAILED_COUNT), is(0L));
// second get token. Authentication history is not recorded.
preplacedRes = requestAuthentication(TEST_CELL, accountNr2, TEST_PreplacedWORD, HttpStatus.SC_OK);
replacedertTrue(preplacedRes.bodyAsJson().containsKey(OAuth2Helper.Key.LAST_AUTHENTICATED));
replacedertNull(preplacedRes.bodyAsJson().get(OAuth2Helper.Key.LAST_AUTHENTICATED));
replacedertThat(preplacedRes.bodyAsJson().get(OAuth2Helper.Key.FAILED_COUNT), is(0L));
// third get token. Authentication history is not recorded.
requestAuthentication(TEST_CELL, accountNr2, "dummypreplacedword1", HttpStatus.SC_BAD_REQUEST);
AuthTestCommon.waitForIntervalLock();
preplacedRes = requestAuthentication(TEST_CELL, accountNr2, TEST_PreplacedWORD, HttpStatus.SC_OK);
replacedertTrue(preplacedRes.bodyAsJson().containsKey(OAuth2Helper.Key.LAST_AUTHENTICATED));
replacedertNull(preplacedRes.bodyAsJson().get(OAuth2Helper.Key.LAST_AUTHENTICATED));
replacedertThat(preplacedRes.bodyAsJson().get(OAuth2Helper.Key.FAILED_COUNT), is(0L));
// The authentication history of other accounts is recorded.
requestAuthentication(TEST_CELL, TEST_ACCOUNT, "dummypreplacedword1", HttpStatus.SC_BAD_REQUEST);
requestAuthentication(TEST_CELL, TEST_ACCOUNT, "dummypreplacedword1", HttpStatus.SC_BAD_REQUEST);
requestAuthentication(TEST_CELL, TEST_ACCOUNT, "dummypreplacedword1", HttpStatus.SC_BAD_REQUEST);
AuthTestCommon.waitForIntervalLock();
preplacedRes = requestAuthentication(TEST_CELL, TEST_ACCOUNT, TEST_PreplacedWORD, HttpStatus.SC_OK);
replacedertThat(preplacedRes.bodyAsJson().get(OAuth2Helper.Key.FAILED_COUNT), is(3L));
} finally {
AccountUtils.delete(TEST_CELL, Setup.MASTER_TOKEN_NAME, accountNr2, -1);
CellUtils.proppatchRemove(TEST_CELL, "<p:accountsnotrecordingauthhistory/>", Setup.MASTER_TOKEN_NAME, -1);
}
}
16
Source : TestCaldavHttpClient4.java
with GNU General Public License v2.0
from mguessan
with GNU General Public License v2.0
from mguessan
public void testGetOtherUserCalendar() throws IOException {
HttpPropfind method = new HttpPropfind("/principals/users/" + Settings.getProperty("davmail.usera"), DavConstants.PROPFIND_ALL_PROP, new DavPropertyNameSet(), DavConstants.DEPTH_INFINITY);
try (CloseableHttpResponse response = httpClient.execute(method)) {
replacedertEquals(HttpStatus.SC_MULTI_STATUS, response.getStatusLine().getStatusCode());
}
}
16
Source : TestCaldavHttpClient4.java
with GNU General Public License v2.0
from mguessan
with GNU General Public License v2.0
from mguessan
public void testPropfindCalendar() throws IOException {
HttpPropfind method = new HttpPropfind("/users/" + session.getEmail() + "/calendar/", null, 1);
try (CloseableHttpResponse response = httpClient.execute(method)) {
replacedertEquals(HttpStatus.SC_MULTI_STATUS, response.getStatusLine().getStatusCode());
}
}
15
Source : PropPatchTest.java
with Apache License 2.0
from personium
with Apache License 2.0
from personium
/**
* CellレベルPROPPATCHのテスト.
*/
@Test
public final void CellレベルPROPPATCHのテスト() {
String token = AbstractCase.MASTER_TOKEN_NAME;
String author1 = "Test User1";
String hoge1 = "Hoge";
String author2 = "Author1 update";
String hoge2 = "Fuga";
String authorKey = "Author";
String hogeKey = "hoge";
TResponse tresponseWebDav = null;
try {
// PROPPATCH設定実行
DavResourceUtils.setProppatch(TEST_CELL1, token, HttpStatus.SC_MULTI_STATUS, author1, hoge1);
// プロパティ変更の確認
tresponseWebDav = CellUtils.propfind(TEST_CELL1, token, DEPTH, HttpStatus.SC_MULTI_STATUS);
Element root = tresponseWebDav.bodyAsXml().getDoreplacedentElement();
String resorce = UrlUtils.cellRoot(TEST_CELL1);
HashMap<String, String> map = new HashMap<String, String>();
map.put(authorKey, author1);
map.put(hogeKey, hoge1);
proppatchResponseTest(root, resorce, map);
// プロパティの変更
DavResourceUtils.setProppatch(TEST_CELL1, token, HttpStatus.SC_MULTI_STATUS, author2, hoge2);
// プロパティの変更確認
tresponseWebDav = CellUtils.propfind(TEST_CELL1, token, DEPTH, HttpStatus.SC_MULTI_STATUS);
Element root2 = tresponseWebDav.bodyAsXml().getDoreplacedentElement();
HashMap<String, String> map2 = new HashMap<String, String>();
map.put(authorKey, author2);
map.put(hogeKey, hoge2);
proppatchResponseTest(root2, resorce, map2);
} finally {
// プロパティの削除
DavResourceUtils.resetProppatch(TEST_CELL1, token);
}
}
15
Source : BoxCrudTest.java
with Apache License 2.0
from personium
with Apache License 2.0
from personium
/**
* Box削除時にDav用の管理データが削除されることを確認.
*/
@Test
public void Box削除時にDav用の管理データが削除されることを確認() {
String boxName = "boxDavName";
try {
// Boxの作成
BoxUtils.create(CELL_NAME, boxName, MASTER_TOKEN_NAME, HttpStatus.SC_CREATED);
// DAV管理データ作成のため、PROPFINDの実行
DavResourceUtils.propfind("box/propfind-box-allprop.txt", MASTER_TOKEN_NAME, HttpStatus.SC_MULTI_STATUS, boxName);
// PROPFINDを行い、Box管理用のDAVが存在する確認する
TResponse res = DavResourceUtils.propfind("box/propfind-box-allprop.txt", MASTER_TOKEN_NAME, HttpStatus.SC_MULTI_STATUS, boxName);
Element root = res.bodyAsXml().getDoreplacedentElement();
NodeList response = root.getElementsByTagName("response");
replacedertTrue("response length is " + response.getLength(), response.getLength() > 0);
// Boxの削除
BoxUtils.delete(CELL_NAME, MASTER_TOKEN_NAME, boxName, HttpStatus.SC_NO_CONTENT);
// PROPFINDを行い、Box管理用のDAVが無いこと確認する
DavResourceUtils.propfind("box/propfind-box-allprop.txt", MASTER_TOKEN_NAME, HttpStatus.SC_NOT_FOUND, boxName);
} finally {
deleteBoxRequest(boxName).returns();
}
}
14
Source : PropPatchTest.java
with Apache License 2.0
from personium
with Apache License 2.0
from personium
/**
* CellレベルPROPPATCHのテスト_Cellの更新あり.
*/
@Test
public final void CellレベルPROPPATCHのテスト_Cellの更新あり() {
String token = AbstractCase.MASTER_TOKEN_NAME;
String author1 = "Test User1";
String hoge1 = "Hoge";
String authorKey = "Author";
String hogeKey = "hoge";
TResponse tresponseWebDav = null;
try {
// PROPPATCH設定実行
DavResourceUtils.setProppatch(TEST_CELL1, token, HttpStatus.SC_MULTI_STATUS, author1, hoge1);
// Cellの更新
String updateCellName = TEST_CELL1;
CellUtils.update(TEST_CELL1, updateCellName, AbstractCase.MASTER_TOKEN_NAME, HttpStatus.SC_NO_CONTENT);
// プロパティ変更の確認
tresponseWebDav = CellUtils.propfind(TEST_CELL1, token, DEPTH, HttpStatus.SC_MULTI_STATUS);
Element root = tresponseWebDav.bodyAsXml().getDoreplacedentElement();
String resorce = UrlUtils.cellRoot(TEST_CELL1);
HashMap<String, String> map = new HashMap<String, String>();
map.put(authorKey, author1);
map.put(hogeKey, hoge1);
proppatchResponseTest(root, resorce, map);
} finally {
// プロパティの削除
DavResourceUtils.resetProppatch(TEST_CELL1, token);
}
}
See More Examples