com.fujitsu.dc.test.jersey.bar.BarInstallTest.java Source code

Java tutorial

Introduction

Here is the source code for com.fujitsu.dc.test.jersey.bar.BarInstallTest.java

Source

/**
 * personium.io
 * Copyright 2014 FUJITSU LIMITED
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.fujitsu.dc.test.jersey.bar;

    import static org.junit.Assert.assertEquals;

    import java.io.File;
    import java.util.ArrayList;
    import java.util.HashMap;
    import java.util.LinkedHashMap;
    import java.util.List;
    import java.util.Map;

    import org.apache.http.HttpHeaders;
    import org.apache.http.HttpStatus;
    import org.json.simple.JSONArray;
    import org.json.simple.JSONObject;
    import org.junit.After;
    import org.junit.AfterClass;
    import org.junit.Before;
    import org.junit.BeforeClass;
    import org.junit.Ignore;
    import org.junit.Test;
    import org.junit.experimental.categories.Category;
    import org.junit.runner.RunWith;
    import org.slf4j.Logger;
    import org.slf4j.LoggerFactory;
    import org.w3c.dom.Element;

    import com.fujitsu.dc.common.utils.DcCoreUtils;
    import com.fujitsu.dc.core.DcCoreException;
    import com.fujitsu.dc.core.auth.OAuth2Helper;
    import com.fujitsu.dc.core.model.Box;
    import com.fujitsu.dc.core.model.ctl.AssociationEnd;
    import com.fujitsu.dc.core.model.ctl.ComplexType;
    import com.fujitsu.dc.core.model.ctl.ComplexTypeProperty;
    import com.fujitsu.dc.core.model.ctl.EntityType;
    import com.fujitsu.dc.core.model.ctl.ExtRole;
    import com.fujitsu.dc.core.model.ctl.Property;
    import com.fujitsu.dc.core.model.ctl.Relation;
    import com.fujitsu.dc.core.model.ctl.Role;
    import com.fujitsu.dc.core.model.progress.ProgressInfo;
    import com.fujitsu.dc.test.categories.Integration;
    import com.fujitsu.dc.test.categories.Regression;
    import com.fujitsu.dc.test.categories.Unit;
    import com.fujitsu.dc.test.jersey.AbstractCase;
    import com.fujitsu.dc.test.jersey.DcResponse;
    import com.fujitsu.dc.test.jersey.DcRunner;
    import com.fujitsu.dc.test.jersey.ODataCommon;
    import com.fujitsu.dc.test.jersey.cell.ctl.CellCtlUtils;
    import com.fujitsu.dc.test.setup.Setup;
    import com.fujitsu.dc.test.unit.core.UrlUtils;
    import com.fujitsu.dc.test.utils.AccountUtils;
    import com.fujitsu.dc.test.utils.AssociationEndUtils;
    import com.fujitsu.dc.test.utils.BoxUtils;
    import com.fujitsu.dc.test.utils.CellUtils;
    import com.fujitsu.dc.test.utils.DavResourceUtils;
    import com.fujitsu.dc.test.utils.EntityTypeUtils;
    import com.fujitsu.dc.test.utils.ExtCellUtils;
    import com.fujitsu.dc.test.utils.Http;
    import com.fujitsu.dc.test.utils.RelationUtils;
    import com.fujitsu.dc.test.utils.ResourceUtils;
    import com.fujitsu.dc.test.utils.RoleUtils;
    import com.fujitsu.dc.test.utils.TResponse;
    import com.fujitsu.dc.test.utils.TestMethodUtils;
    import com.fujitsu.dc.test.utils.UserDataUtils;
    import com.sun.jersey.test.framework.JerseyTest;
    import com.sun.jersey.test.framework.WebAppDescriptor;

    /**
     * bar.
     */
    @RunWith(DcRunner.class)
    @Category({ Unit.class, Integration.class, Regression.class })
    public class BarInstallTest extends JerseyTest {
        /**
         * .
         */
        private static Logger log = LoggerFactory.getLogger(BarInstallTest.class);

        private static final String INSTALL_TARGET = "installBox";
        private static final String REQ_CONTENT_TYPE = "application/zip";
        private static final String REQUEST_NORM_FILE = "bar-install.txt";
        private static final String REQUEST_NOTYPE_FILE = "bar-install-without-type.txt";
        private static final String REQUEST_METHOD_OVERRIDE_FILE = "bar-install-method-override.txt";
        private static final String RESOURCE_PATH = "requestData/barInstall";
        private static final String BAR_FILE_MINIMUM = "/V1_1_2_bar_minimum.bar";
        private static final String BAR_FILE_ROOTPROP = "/V1_1_2_bar_90rootprops.bar";
        private static final String BAR_FILE_EMPTY = "/V1_1_2_bar_empty.bar";
        private static final String BAR_FILE_WRONGDIR = "/V1_1_2_bar_wrongdir.bar";
        private static final String BAR_FILE_WRONGFILE = "/V1_1_2_bar_wrongfile.bar";
        private static final String BAR_FILE_00META_NOTEXSIST = "/V1_1_2_bar_00meta_notexsist.bar";
        private static final String BAR_FILE_00MANIFEST_NOTEXSIST = "/V1_1_2_bar_00manifest_notexsist.bar";
        private static final String BAR_FILE_90ROOTPROPS_NOTEXSIST = "/V1_1_2_bar_90rootprops_notexsist.bar";
        private static final String BAR_FILE_ROOTDIR_ORDER = "/V1_1_2_bar_rootdir_order.bar";
        private static final String BAR_FILE_00META_ORDER = "/V1_1_2_bar_00meta_order.bar";
        private static final String BAR_FILE_RELATION_NONAME = "/V1_1_2_bar_relation_noname.bar";
        private static final String BAR_FILE_RELATION_NOFIELDNAME = "/V1_1_2_bar_relation_nofield.bar";
        private static final String BAR_FILE_ROLE_NOFIELDNAME = "/V1_1_2_bar_role_nofield.bar";
        private static final String BAR_FILE_EXROLE_NOFIELDNAME = "/V1_1_2_bar_extrole_nofield.bar";
        private static final String BAR_FILE_RELATION_FILE_NAME = "/V1_1_2_bar_relation_bad_name.bar";
        private static final String BAR_FILE_ROLE_FILE_NAME = "/V1_1_2_bar_role_bad_name.bar";
        private static final String BAR_FILE_EXROLE_FILE_NAME = "/V1_1_2_bar_extrole_bad_name.bar";
        private static final String BAR_FILE_NO_JSON_FORM = "/V1_1_2_bar_no_json_form.bar";
        private static final String BAR_FILE_NGROLE = "/V1_1_2_bar_role_ng.bar";
        private static final String BAR_FILE_NGRELATION = "/V1_1_2_bar_relation_ng.bar";
        private static final String BAR_FILE_RELATION_CONFLICT = "/V1_1_2_bar_relation_conflict.bar";
        private static final String BAR_FILE_EXTROLE_CONFLICT = "/V1_1_2_bar_extrole_conflict.bar";
        private static final String BAR_FILE_LINK_ENTITYNOEXIST = "/V1_1_2_bar_links_entitynoexist.bar";
        private static final String BAR_FILE_ODATA_CONT_NOTEXIST = "/V1_1_2_bar_odata_contents_notexist.bar";
        private static final String BAR_FILE_ODATA_SPEC_NOTEXIST = "/V1_1_2_bar_odata_spcifiy_notexist.bar";
        private static final String BAR_FILE_ODATA_CONT_EMPTY = "/V1_1_2_bar_odata_contents_empty.bar";
        private static final String BAR_FILE_00METADATA_NOTEXIST = "/V1_1_2_bar_00metadata_notexist.bar";
        private static final String BAR_FILE_INVALID_CONT_ORDER = "/V1_1_2_bar_invalid_contents_order.bar";
        private static final String BAR_FILE_WEBDAV_ODATA = "/V1_1_2_bar_webdav_odata.bar";

        private static final String SCHEMA_URL = "https://fqdn/testcell1";

        private static final Map<String, String> INIT_PARAMS = new HashMap<String, String>();

        static {
            INIT_PARAMS.put("com.sun.jersey.config.property.packages", "com.fujitsu.dc.core.rs");
            INIT_PARAMS.put("com.sun.jersey.spi.container.ContainerRequestFilters",
                    "com.fujitsu.dc.core.jersey.filter.DcCoreContainerFilter");
            INIT_PARAMS.put("com.sun.jersey.spi.container.ContainerResponseFilters",
                    "com.fujitsu.dc.core.jersey.filter.DcCoreContainerFilter");
        }

        /**
         * . ?super?????
         */
        public BarInstallTest() {
            super(new WebAppDescriptor.Builder(BarInstallTest.INIT_PARAMS).build());
        }

        /**
         * ????????.
         */
        @BeforeClass
        public static void beforeClass() {
        }

        /**
         * ???????.
         */
        @AfterClass
        public static void afterClass() {
        }

        /**
         * ???????.
         * @throws InterruptedException InterruptedException
         */
        @Before
        public void before() throws InterruptedException {
            cleanup();
        }

        /**
         * ???????.
         */
        @After
        public void after() {
            cleanup();
        }

        private static void cleanup() {
            String reqCell = Setup.TEST_CELL1;

            try {
                // ?
                Http.request("box/delete-box-col.txt").with("cellPath", reqCell).with("box", "installBox")
                        .with("path", "col1/col11").with("token", AbstractCase.MASTER_TOKEN_NAME).returns().debug();
            } catch (Exception ex) {
                log.debug(ex.getMessage());
            }

            try {
                // ?
                Http.request("box/delete-box-col.txt").with("cellPath", reqCell).with("box", "installBox")
                        .with("path", "col1").with("token", AbstractCase.MASTER_TOKEN_NAME).returns().debug();
            } catch (Exception ex) {
                log.debug(ex.getMessage());
            }

            try {
                // ?
                Http.request("box/delete-box-col.txt").with("cellPath", reqCell).with("box", "installBox")
                        .with("path", "col3").with("token", AbstractCase.MASTER_TOKEN_NAME).returns().debug();
            } catch (Exception ex) {
                log.debug(ex.getMessage());
            }

            try {
                // ?
                Http.request("box/delete-box-col.txt").with("cellPath", reqCell).with("box", "installBox")
                        .with("path", "col2").with("token", AbstractCase.MASTER_TOKEN_NAME).returns().debug();
            } catch (Exception ex) {
                log.debug(ex.getMessage());
            }

            try {
                Http.request("cell/box-delete.txt").with("cellPath", reqCell)
                        .with("token", AbstractCase.MASTER_TOKEN_NAME).with("boxPath", INSTALL_TARGET).returns()
                        .debug();
            } catch (Exception ex) {
                log.debug(ex.getMessage());
            }
        }

        /**
         * ??????bar?404????.
         */
        @Test
        public final void ??????bar?404 ????()
        {
            String reqCell = "dummyCell";
            String reqPath = "box";

            TResponse res = null;
            File barFile = new File(RESOURCE_PATH + BAR_FILE_MINIMUM);
            byte[] body = BarInstallTestUtils.readBarFile(barFile);
            Map<String, String> headers = new LinkedHashMap<String, String>();
            headers.put(HttpHeaders.CONTENT_TYPE, REQ_CONTENT_TYPE);
            headers.put(HttpHeaders.CONTENT_LENGTH, String.valueOf(body.length));

            res = BarInstallTestUtils.request(REQUEST_NORM_FILE, reqCell, reqPath, headers, body);
            res.statusCode(HttpStatus.SC_NOT_FOUND);
            String code = DcCoreException.Dav.CELL_NOT_FOUND.getCode();
            String message = DcCoreException.Dav.CELL_NOT_FOUND.getMessage();
            res.checkErrorResponse(code, message);
        }

        /**
         * Owner?????????bar?????????.
         */
        @Test
        public final void Owner?????????bar?????????()
        {

        String cellName = "barInstallTest_ownercell";
        String ownerName = "http://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";

        String reqPath = INSTALL_TARGET;

        try {
            // Cell?
            CellUtils.create(cellName, AbstractCase.MASTER_TOKEN_NAME, ownerName, HttpStatus.SC_CREATED);

            TResponse res = null;
            File barFile = new File(RESOURCE_PATH + BAR_FILE_MINIMUM);
            byte[] body = BarInstallTestUtils.readBarFile(barFile);
            Map<String, String> headers = new LinkedHashMap<String, String>();
            headers.put(HttpHeaders.CONTENT_TYPE, REQ_CONTENT_TYPE);
            headers.put(HttpHeaders.CONTENT_LENGTH, String.valueOf(body.length));

            res = BarInstallTestUtils.request(REQUEST_NORM_FILE, cellName, reqPath, headers, body);
            res.statusCode(HttpStatus.SC_ACCEPTED);
            String location = res.getHeader(HttpHeaders.LOCATION);
            String expected = UrlUtils.cellRoot(cellName) + reqPath;
            assertEquals(expected, location);

            BarInstallTestUtils.assertBarInstallStatus(location, SCHEMA_URL, ProgressInfo.STATUS.COMPLETED);

        } finally {
            // Box
            Http.request("cell/box-delete.txt")
                    .with("cellPath", cellName)
                    .with("token", AbstractCase.MASTER_TOKEN_NAME)
                    .with("boxPath", INSTALL_TARGET)
                    .returns()
                    .debug();

            // Cell
            CellUtils.delete(AbstractCase.MASTER_TOKEN_NAME, cellName, -1);
        }
    }

    /**
     * ??Box???bar?400????.
     */
    @Test
    public final void ? ?Box???bar?400 ????()
        {
            String reqCell = Setup.TEST_CELL1;
            String reqPath = INSTALL_TARGET;

            TResponse res = null;
            File barFile = new File(RESOURCE_PATH + BAR_FILE_MINIMUM);
            byte[] body = BarInstallTestUtils.readBarFile(barFile);
            Map<String, String> headers = new LinkedHashMap<String, String>();
            headers.put(HttpHeaders.CONTENT_TYPE, REQ_CONTENT_TYPE);
            headers.put(HttpHeaders.CONTENT_LENGTH, String.valueOf(body.length));

            try {
                // Box?Schema
                BoxUtils.createWithScheme(reqCell, "boxInstallTestBox", AbstractCase.MASTER_TOKEN_NAME, SCHEMA_URL);
                res = BarInstallTestUtils.request(REQUEST_NORM_FILE, reqCell, reqPath, headers, body);
                res.statusCode(HttpStatus.SC_BAD_REQUEST);
                String code = DcCoreException.BarInstall.BAR_FILE_BOX_SCHEMA_ALREADY_EXISTS.getCode();
                String message = DcCoreException.BarInstall.BAR_FILE_BOX_SCHEMA_ALREADY_EXISTS.params(SCHEMA_URL)
                        .getMessage();
                res.checkErrorResponse(code, message);
            } finally {
                BoxUtils.delete(reqCell, AbstractCase.MASTER_TOKEN_NAME, "boxInstallTestBox", -1);
                BoxUtils.delete(reqCell, AbstractCase.MASTER_TOKEN_NAME, INSTALL_TARGET, -1);
            }
        }

    /**
     * ???Box???bar?405????.
     */
    @Test
    public final void ? ??Box???bar?405 ????()
        {
            String reqCell = Setup.TEST_CELL1;
            String reqPath = Setup.TEST_BOX2;

            TResponse res = null;
            File barFile = new File(RESOURCE_PATH + BAR_FILE_MINIMUM);
            byte[] body = BarInstallTestUtils.readBarFile(barFile);
            Map<String, String> headers = new LinkedHashMap<String, String>();
            headers.put(HttpHeaders.CONTENT_TYPE, REQ_CONTENT_TYPE);
            headers.put(HttpHeaders.CONTENT_LENGTH, String.valueOf(body.length));

            try {
                res = BarInstallTestUtils.request(REQUEST_NORM_FILE, reqCell, reqPath, headers, body);
                res.statusCode(HttpStatus.SC_METHOD_NOT_ALLOWED);
                String code = DcCoreException.BarInstall.BAR_FILE_BOX_ALREADY_EXISTS.getCode();
                String message = DcCoreException.BarInstall.BAR_FILE_BOX_ALREADY_EXISTS.params(reqPath).getMessage();
                res.checkErrorResponse(code, message);
            } finally {
                BoxUtils.delete(reqCell, AbstractCase.MASTER_TOKEN_NAME, "boxInstallTestBox", -1);
                BoxUtils.delete(reqCell, AbstractCase.MASTER_TOKEN_NAME, INSTALL_TARGET, -1);
            }
        }

    /**
     * ???bar??405????.
     */
    @Test
    public final void ???bar??405 ????()
        {
            String reqCell = Setup.TEST_CELL1;
            String reqPath = Box.DEFAULT_BOX_NAME;

            TResponse res = null;
            File barFile = new File(RESOURCE_PATH + BAR_FILE_MINIMUM);
            byte[] body = BarInstallTestUtils.readBarFile(barFile);
            Map<String, String> headers = new LinkedHashMap<String, String>();
            headers.put(HttpHeaders.CONTENT_TYPE, REQ_CONTENT_TYPE);
            headers.put(HttpHeaders.CONTENT_LENGTH, String.valueOf(body.length));

            res = BarInstallTestUtils.request(REQUEST_NORM_FILE, reqCell, reqPath, headers, body);
            res.statusCode(HttpStatus.SC_METHOD_NOT_ALLOWED);
            String code = DcCoreException.Misc.METHOD_NOT_ALLOWED.getCode();
            String message = DcCoreException.Misc.METHOD_NOT_ALLOWED.params("'" + reqPath + "'").getMessage();
            res.checkErrorResponse(code, message);
        }

    /**
     * ContentType?????400????.
     */
    @Test
    public final void ContentType?????400 ????()
        {
            String reqCell = Setup.TEST_CELL1;
            String reqPath = INSTALL_TARGET;

            TResponse res = null;
            File barFile = new File(RESOURCE_PATH + BAR_FILE_MINIMUM);
            byte[] body = BarInstallTestUtils.readBarFile(barFile);
            Map<String, String> headers = new LinkedHashMap<String, String>();
            headers.put(HttpHeaders.CONTENT_LENGTH, String.valueOf(body.length));

            res = BarInstallTestUtils.request(REQUEST_NOTYPE_FILE, reqCell, reqPath, headers, body);
            res.statusCode(HttpStatus.SC_BAD_REQUEST);
            String code = DcCoreException.BarInstall.REQUEST_HEADER_FORMAT_ERROR.getCode();
            String message = DcCoreException.BarInstall.REQUEST_HEADER_FORMAT_ERROR.params(HttpHeaders.CONTENT_TYPE)
                    .getMessage();
            res.checkErrorResponse(code, message);
        }

    /**
     * ContentType??????400????. dc1-core?????"Bad Content-Type header value: ''"?????
     */
    @Test
    @Ignore
    public final void ContentType??????400 ????()
        {
            String reqCell = Setup.TEST_CELL1;
            String reqPath = INSTALL_TARGET;
            String contType = "";

            TResponse res = null;
            File barFile = new File(RESOURCE_PATH + BAR_FILE_MINIMUM);
            byte[] body = BarInstallTestUtils.readBarFile(barFile);
            Map<String, String> headers = new LinkedHashMap<String, String>();
            headers.put(HttpHeaders.CONTENT_TYPE, contType);
            headers.put(HttpHeaders.CONTENT_LENGTH, String.valueOf(body.length));

            res = BarInstallTestUtils.request(REQUEST_NORM_FILE, reqCell, reqPath, headers, body);
            res.statusCode(HttpStatus.SC_BAD_REQUEST);
            String code = DcCoreException.BarInstall.REQUEST_HEADER_FORMAT_ERROR.getCode();
            String message = DcCoreException.BarInstall.REQUEST_HEADER_FORMAT_ERROR.params(HttpHeaders.CONTENT_TYPE)
                    .getMessage();
            res.checkErrorResponse(code, message);
        }

    /**
     * ContentType???????400????.
     */
    @Test
    public final void ContentType???????400 ????()
        {
            String reqCell = Setup.TEST_CELL1;
            String reqPath = INSTALL_TARGET;
            String contType = "application/xml";

            TResponse res = null;
            File barFile = new File(RESOURCE_PATH + BAR_FILE_MINIMUM);
            byte[] body = BarInstallTestUtils.readBarFile(barFile);
            Map<String, String> headers = new LinkedHashMap<String, String>();
            headers.put(HttpHeaders.CONTENT_TYPE, contType);
            headers.put(HttpHeaders.CONTENT_LENGTH, String.valueOf(body.length));

            res = BarInstallTestUtils.request(REQUEST_NORM_FILE, reqCell, reqPath, headers, body);
            res.statusCode(HttpStatus.SC_BAD_REQUEST);
            String code = DcCoreException.BarInstall.REQUEST_HEADER_FORMAT_ERROR.getCode();
            String message = DcCoreException.BarInstall.REQUEST_HEADER_FORMAT_ERROR.params(HttpHeaders.CONTENT_TYPE)
                    .getMessage();
            res.checkErrorResponse(code, message);
        }

    /**
     * ????bar?400????.
     */
    @Test
    public final void ????bar?400 ????()
        {
            String reqCell = Setup.TEST_CELL1;
            String reqPath = INSTALL_TARGET;

            TResponse res = null;
            byte[] body = new byte[0];
            Map<String, String> headers = new LinkedHashMap<String, String>();
            headers.put(HttpHeaders.CONTENT_TYPE, REQ_CONTENT_TYPE);
            headers.put(HttpHeaders.CONTENT_LENGTH, String.valueOf(body.length));

            res = BarInstallTestUtils.request(REQUEST_NORM_FILE, reqCell, reqPath, headers, body);
            res.statusCode(HttpStatus.SC_BAD_REQUEST);
            String code = DcCoreException.BarInstall.BAR_FILE_CANNOT_OPEN.getCode();
            String message = DcCoreException.BarInstall.BAR_FILE_CANNOT_OPEN.params("archive is not a ZIP archive")
                    .getMessage();
            res.checkErrorResponse(code, message);
        }

    /**
     * bar??bar?????????.
     */
    @Test
    public final void bar??bar?????????()
        {
            String reqCell = Setup.TEST_CELL1;
            String reqPath = INSTALL_TARGET;

            TResponse res = null;
            File barFile = new File(RESOURCE_PATH + BAR_FILE_WRONGDIR);
            byte[] body = BarInstallTestUtils.readBarFile(barFile);
            Map<String, String> headers = new LinkedHashMap<String, String>();
            headers.put(HttpHeaders.CONTENT_TYPE, REQ_CONTENT_TYPE);
            headers.put(HttpHeaders.CONTENT_LENGTH, String.valueOf(body.length));

            res = BarInstallTestUtils.request(REQUEST_NORM_FILE, reqCell, reqPath, headers, body);

            res.statusCode(HttpStatus.SC_BAD_REQUEST);
            String code = DcCoreException.BarInstall.BAR_FILE_INVALID_STRUCTURES.getCode();
            String message = DcCoreException.BarInstall.BAR_FILE_INVALID_STRUCTURES
                    .params("bar/ bar/00_meta/ bar/00_meta/00_manifest.json bar/00_meta/90_rootprops.xml").getMessage();
            res.checkErrorResponse(code, message);
        }

    /**
     * ??Odata?bar?????.
     */
    @Test
    public final void ??Odata?bar?????()
        {
            final String barFilename = "/V1_3_12_bar_maximum.bar";
            final String reqCell = Setup.TEST_CELL1;
            final String reqPath = INSTALL_TARGET;
            final String user = "testuser";
            final String password = "password";
            final String testCell = "dummyCell00";
            final String odataColName = "odatacol1";

            TResponse res = null;
            File barFile = new File(RESOURCE_PATH + barFilename);
            byte[] body = BarInstallTestUtils.readBarFile(barFile);
            Map<String, String> headers = new LinkedHashMap<String, String>();
            headers.put(HttpHeaders.CONTENT_TYPE, REQ_CONTENT_TYPE);
            headers.put(HttpHeaders.CONTENT_LENGTH, String.valueOf(body.length));

            try {
                AccountUtils.create(AbstractCase.MASTER_TOKEN_NAME, Setup.TEST_CELL1, user, password,
                        HttpStatus.SC_CREATED);
                ExtCellUtils.create(AbstractCase.MASTER_TOKEN_NAME, Setup.TEST_CELL1, UrlUtils.cellRoot(testCell),
                        HttpStatus.SC_CREATED);

                res = BarInstallTestUtils.request(REQUEST_NORM_FILE, reqCell, reqPath, headers, body);
                res.statusCode(HttpStatus.SC_ACCEPTED);
                String location = res.getHeader(HttpHeaders.LOCATION);
                String expected = UrlUtils.cellRoot(reqCell) + reqPath;
                assertEquals(expected, location);

                BarInstallTestUtils.assertBarInstallStatus(location, SCHEMA_URL, ProgressInfo.STATUS.COMPLETED);
                checkRegistData();
            } finally {
                deleteAllData(reqCell, reqPath, user, testCell, odataColName);
            }
        }

    /**
     * ??Odata?barMethodOverride?MKCOL?????.
     */
    @Test
    public final void ??Odata?barMethodOverride?MKCOL?????()
        {
            final String barFilename = "/V1_3_12_bar_maximum.bar";
            final String reqCell = Setup.TEST_CELL1;
            final String reqPath = INSTALL_TARGET;
            final String user = "testuser";
            final String password = "password";
            final String testCell = "dummyCell00";
            final String odataColName = "odatacol1";

            TResponse res = null;
            File barFile = new File(RESOURCE_PATH + barFilename);
            byte[] body = BarInstallTestUtils.readBarFile(barFile);
            Map<String, String> headers = new LinkedHashMap<String, String>();
            headers.put(HttpHeaders.CONTENT_TYPE, REQ_CONTENT_TYPE);
            headers.put(HttpHeaders.CONTENT_LENGTH, String.valueOf(body.length));
            headers.put("X-HTTP-Method-Override", "MKCOL");

            try {
                AccountUtils.create(AbstractCase.MASTER_TOKEN_NAME, Setup.TEST_CELL1, user, password,
                        HttpStatus.SC_CREATED);
                ExtCellUtils.create(AbstractCase.MASTER_TOKEN_NAME, Setup.TEST_CELL1, UrlUtils.cellRoot(testCell),
                        HttpStatus.SC_CREATED);

                res = BarInstallTestUtils.request(REQUEST_METHOD_OVERRIDE_FILE, reqCell, reqPath, headers, body);
                res.statusCode(HttpStatus.SC_ACCEPTED);
                String location = res.getHeader(HttpHeaders.LOCATION);
                String expected = UrlUtils.cellRoot(reqCell) + reqPath;
                assertEquals(expected, location);

                BarInstallTestUtils.assertBarInstallStatus(location, SCHEMA_URL, ProgressInfo.STATUS.COMPLETED);
                checkRegistData();
            } finally {
                deleteAllData(reqCell, reqPath, user, testCell, odataColName);
            }
        }

    /**
     * ??Odata?barMethodOverride?POST????.
     */
    @Test
    public final void ??Odata?barMethodOverride?PUT????()
        {
            final String barFilename = "/V1_3_12_bar_maximum.bar";
            final String reqCell = Setup.TEST_CELL1;
            final String reqPath = INSTALL_TARGET;
            final String user = "testuser";
            final String testCell = "dummyCell00";
            final String odataColName = "odatacol1";

            TResponse res = null;
            File barFile = new File(RESOURCE_PATH + barFilename);
            byte[] body = BarInstallTestUtils.readBarFile(barFile);
            Map<String, String> headers = new LinkedHashMap<String, String>();
            headers.put(HttpHeaders.CONTENT_TYPE, REQ_CONTENT_TYPE);
            headers.put(HttpHeaders.CONTENT_LENGTH, String.valueOf(body.length));
            headers.put("X-HTTP-Method-Override", "PUT");

            try {
                res = BarInstallTestUtils.request(REQUEST_METHOD_OVERRIDE_FILE, reqCell, reqPath, headers, body);
                res.statusCode(HttpStatus.SC_NOT_FOUND);
                String code = DcCoreException.Dav.BOX_NOT_FOUND.getCode();
                String message = DcCoreException.Dav.BOX_NOT_FOUND.params(UrlUtils.boxRoot(reqCell, INSTALL_TARGET))
                        .getMessage();
                res.checkErrorResponse(code, message);
            } finally {
                deleteAllData(reqCell, reqPath, user, testCell, odataColName);
            }
        }

    private void deleteAllData(final String reqCell,
            final String reqPath,
            final String user,
            final String testCell,
            final String odataColName) {
        // ?
        String resourceUrl = UrlUtils.userdata(reqCell, reqPath, odataColName, "entity3", "barInstallTest");
        ODataCommon.deleteOdataResource(resourceUrl);

        // ComplexTypeProperty
        resourceUrl = UrlUtils.complexTypeProperty(reqCell, INSTALL_TARGET,
                odataColName, "compProp1", "complex1");
        ODataCommon.deleteOdataResource(resourceUrl);
        resourceUrl = UrlUtils.complexTypeProperty(reqCell, INSTALL_TARGET,
                odataColName, "compProp2", "complex1");
        ODataCommon.deleteOdataResource(resourceUrl);
        resourceUrl = UrlUtils.complexTypeProperty(reqCell, INSTALL_TARGET,
                odataColName, "compProp3", "complex2");
        ODataCommon.deleteOdataResource(resourceUrl);
        // Property
        resourceUrl = UrlUtils.property(reqCell, INSTALL_TARGET, odataColName, "property1", "entity1");
        ODataCommon.deleteOdataResource(resourceUrl);
        resourceUrl = UrlUtils.property(reqCell, INSTALL_TARGET, odataColName, "property2", "entity1");
        ODataCommon.deleteOdataResource(resourceUrl);
        resourceUrl = UrlUtils.property(reqCell, INSTALL_TARGET, odataColName, "property3", "entity2");
        ODataCommon.deleteOdataResource(resourceUrl);
        // AssociationEnd
        String key = "Name='entity1-entity2',_EntityType.Name='entity1'";
        String navKey = "Name='entity2-entity1',_EntityType.Name='entity2'";
        AssociationEndUtils.deleteLink(reqCell, odataColName, INSTALL_TARGET, key, navKey, -1);
        AssociationEndUtils.delete(AbstractCase.MASTER_TOKEN_NAME, reqCell, odataColName, "entity1",
                INSTALL_TARGET, "entity1-entity2", -1);
        AssociationEndUtils.delete(AbstractCase.MASTER_TOKEN_NAME, reqCell, odataColName, "entity2",
                INSTALL_TARGET, "entity2-entity1", -1);

        // ComplexType
        resourceUrl = UrlUtils.complexType(reqCell, reqPath, odataColName, "complex1");
        ODataCommon.deleteOdataResource(resourceUrl);
        resourceUrl = UrlUtils.complexType(reqCell, reqPath, odataColName, "complex2");
        ODataCommon.deleteOdataResource(resourceUrl);

        // EntityType
        Setup.entityTypeDelete(odataColName, "entity1", Setup.TEST_CELL1, INSTALL_TARGET);
        Setup.entityTypeDelete(odataColName, "entity2", Setup.TEST_CELL1, INSTALL_TARGET);
        Setup.entityTypeDelete(odataColName, "entity3", Setup.TEST_CELL1, INSTALL_TARGET);
        BarInstallTestUtils.deleteCollection(odataColName);

        String role1 = "Name='role1',_Box.Name='" + INSTALL_TARGET + "'";
        // Role <--> Relation
        deleteLink(Relation.EDM_TYPE_NAME, "Name='relation1',_Box.Name='" + INSTALL_TARGET + "'",
                "_" + Role.EDM_TYPE_NAME, role1);
        // Role <--> ExtRole
        String extRole = DcCoreUtils.encodeUrlComp("https://fqdn/cellName/__role/__/role2");
        deleteLink(Role.EDM_TYPE_NAME, role1, "_" + ExtRole.EDM_TYPE_NAME,
                "ExtRole='" + extRole + "'"
                        + ",_Relation.Name='relation1',_Relation._Box.Name='" + INSTALL_TARGET + "'");

        // ExtRole
        resourceUrl = UrlUtils.extRoleUrl(Setup.TEST_CELL1, INSTALL_TARGET, "relation1", extRole);
        ODataCommon.deleteOdataResource(resourceUrl);

        // Relation
        resourceUrl = UrlUtils.relationUrl(Setup.TEST_CELL1, INSTALL_TARGET, "relation1");
        ODataCommon.deleteOdataResource(resourceUrl);
        resourceUrl = UrlUtils.relationUrl(Setup.TEST_CELL1, INSTALL_TARGET, "relation2");
        ODataCommon.deleteOdataResource(resourceUrl);
        resourceUrl = UrlUtils.relationUrl(Setup.TEST_CELL1, INSTALL_TARGET, "relation3");
        ODataCommon.deleteOdataResource(resourceUrl);

        // Role
        resourceUrl = UrlUtils.roleUrl(Setup.TEST_CELL1, INSTALL_TARGET, "role1");
        ODataCommon.deleteOdataResource(resourceUrl);
        resourceUrl = UrlUtils.roleUrl(Setup.TEST_CELL1, INSTALL_TARGET, "role2");
        ODataCommon.deleteOdataResource(resourceUrl);
        resourceUrl = UrlUtils.roleUrl(Setup.TEST_CELL1, INSTALL_TARGET, "role3");
        ODataCommon.deleteOdataResource(resourceUrl);

        ExtCellUtils.delete(AbstractCase.MASTER_TOKEN_NAME, Setup.TEST_CELL1,
                UrlUtils.cellRoot(testCell));
        AccountUtils.delete(Setup.TEST_CELL1, AbstractCase.MASTER_TOKEN_NAME, user, -1);

        // ?
        DavResourceUtils.deleteWebDavFile(Setup.TEST_CELL1, AbstractCase.MASTER_TOKEN_NAME, INSTALL_TARGET,
                "webdavcol1/testdavfile.txt");
        DavResourceUtils.deleteWebDavFile(Setup.TEST_CELL1, AbstractCase.MASTER_TOKEN_NAME, INSTALL_TARGET,
                "svccol1/__src/test.js");

        // ?
        DavResourceUtils.deleteCollection(reqCell, INSTALL_TARGET, "webdavcol1", AbstractCase.MASTER_TOKEN_NAME, -1);
        DavResourceUtils.deleteCollection(reqCell, INSTALL_TARGET, odataColName, AbstractCase.MASTER_TOKEN_NAME, -1);
        DavResourceUtils.deleteCollection(reqCell, INSTALL_TARGET, "svccol1", AbstractCase.MASTER_TOKEN_NAME, -1);
    }

    /**
     * bar?????????.
     */
    private void checkRegistData() {
        final String token = AbstractCase.MASTER_TOKEN_NAME;
        final String colName = "odatacol1";
        final String roleName = "../__/role1";
        final String nameSpace = "http://www.w3.com/standards/z39.50/";
        List<String> rolList = new ArrayList<String>();
        rolList.add("read");
        rolList.add("write");

        String resorce = UrlUtils.box(Setup.TEST_CELL1, INSTALL_TARGET);
        StringBuffer sb = new StringBuffer(resorce);
        // UrlUtil???URL???
        String boxUrl = sb.deleteCharAt(resorce.length() - 1).toString();

        // ?
        BoxUtils.get(Setup.TEST_CELL1, token, INSTALL_TARGET, HttpStatus.SC_OK);
        RelationUtils.get(Setup.TEST_CELL1, token, "relation1", INSTALL_TARGET, HttpStatus.SC_OK);
        RelationUtils.get(Setup.TEST_CELL1, token, "relation2", INSTALL_TARGET, HttpStatus.SC_OK);
        RelationUtils.get(Setup.TEST_CELL1, token, "relation3", INSTALL_TARGET, HttpStatus.SC_OK);
        RoleUtils.get(Setup.TEST_CELL1, token, "role1", INSTALL_TARGET, HttpStatus.SC_OK);
        RoleUtils.get(Setup.TEST_CELL1, token, "role2", INSTALL_TARGET, HttpStatus.SC_OK);
        RoleUtils.get(Setup.TEST_CELL1, token, "role3", INSTALL_TARGET, HttpStatus.SC_OK);
        // ComplexType?
        checkComplexType(Setup.TEST_CELL1, INSTALL_TARGET, colName, "complex1");
        checkComplexType(Setup.TEST_CELL1, INSTALL_TARGET, colName, "complex2");
        // EntityType?
        checkEntityType(Setup.TEST_CELL1, INSTALL_TARGET, colName, "entity1");
        checkEntityType(Setup.TEST_CELL1, INSTALL_TARGET, colName, "entity2");
        // AssociationEnd?
        checkAssocEnd(Setup.TEST_CELL1, INSTALL_TARGET, colName, "entity1", "entity1-entity2");
        checkAssocEnd(Setup.TEST_CELL1, INSTALL_TARGET, colName, "entity2", "entity2-entity1");
        // AssociationEnd?$links?
        checkAssocEndLinks(colName);
        // Property??
        checkProperty(Setup.TEST_CELL1, INSTALL_TARGET, colName, "entity1", null, "property1", true);
        checkProperty(Setup.TEST_CELL1, INSTALL_TARGET, colName, "entity1", null, "property2", true);
        checkProperty(Setup.TEST_CELL1, INSTALL_TARGET, colName, "entity2", null, "property3", false);
        // ComplexTypeProperty??
        checkProperty(Setup.TEST_CELL1, INSTALL_TARGET, colName, null, "complex1", "compProp1", true);
        checkProperty(Setup.TEST_CELL1, INSTALL_TARGET, colName, null, "complex1", "compProp2", true);
        checkProperty(Setup.TEST_CELL1, INSTALL_TARGET, colName, null, "complex2", "compProp3", false);

        // ??
        checkUserData(Setup.TEST_CELL1, INSTALL_TARGET, colName, "entity3", "barInstallTest");
        // OdataCollection?ACL?
        TResponse res = BarInstallTestUtils.propfind(Setup.TEST_CELL1, INSTALL_TARGET, colName,
                AbstractCase.MASTER_TOKEN_NAME,
                HttpStatus.SC_MULTI_STATUS);
        Element root = res.bodyAsXml().getDocumentElement();
        // DavCollection?ACL?
        checkAcl(root, rolList, roleName, boxUrl + "/" + colName);

        // DavCollection
        DavResourceUtils.getWebDavFile(Setup.TEST_CELL1, AbstractCase.MASTER_TOKEN_NAME, "box/dav-get.txt",
                INSTALL_TARGET, "webdavcol1", HttpStatus.SC_OK);
        // DavCollection?PROPFIND
        res = BarInstallTestUtils.propfind(Setup.TEST_CELL1, INSTALL_TARGET, "webdavcol1", "0",
                AbstractCase.MASTER_TOKEN_NAME,
                HttpStatus.SC_MULTI_STATUS);
        root = res.bodyAsXml().getDocumentElement();
        // DavCollection?ACL?
        checkAcl(root, rolList, roleName, boxUrl + "/webdavcol1");
        // DavCollection?Author?
        String author = root.getElementsByTagNameNS(nameSpace, "Author").item(0).getFirstChild().getNodeValue();
        assertEquals("Test User2", author);

        // DavFile
        DavResourceUtils.getWebDavFile(Setup.TEST_CELL1, AbstractCase.MASTER_TOKEN_NAME, "box/dav-get.txt",
                INSTALL_TARGET, "webdavcol1/testdavfile.txt", HttpStatus.SC_OK);

        // ServiceCollection
        BarInstallTestUtils.propfind(Setup.TEST_CELL1, INSTALL_TARGET, "svccol1", AbstractCase.MASTER_TOKEN_NAME,
                HttpStatus.SC_MULTI_STATUS);

        // ServiceFile
        DavResourceUtils.getWebDavFile(Setup.TEST_CELL1, AbstractCase.MASTER_TOKEN_NAME, "box/dav-get.txt",
                INSTALL_TARGET, "svccol1/__src/test.js", HttpStatus.SC_OK);

        // Box??
        res = DavResourceUtils.propfind("box/propfind-box-allprop.txt",
                token, HttpStatus.SC_MULTI_STATUS, INSTALL_TARGET);
        root = res.bodyAsXml().getDocumentElement();
        // BOX?ACL?
        checkAcl(root, rolList, roleName, boxUrl);
        // Box Author??
        author = root.getElementsByTagNameNS(nameSpace, "Author").item(0).getFirstChild().getNodeValue();
        assertEquals("Test User1", author);
    }

        // BOX ACL??
    private void checkAcl(Element root, List<String> rolList, String roleName, String resourceUrl) {
        List<Map<String, List<String>>> list = new ArrayList<Map<String, List<String>>>();
        Map<String, List<String>> map = new HashMap<String, List<String>>();
        list.add(map);
        map.put(roleName, rolList);
        TestMethodUtils.aclResponseTest(root, resourceUrl, list, 1,
                UrlUtils.roleResource(Setup.TEST_CELL1, INSTALL_TARGET, ""), null);
    }

        /**
         * EntityType??.
         * @param cellName Cell??
         * @param boxName Box??
         * @param colName Collection??
         * @param entityName EntityType??
         */
        private void checkEntityType(String cellName, String boxName, String colName, String entityName) {
            TResponse res = EntityTypeUtils.get(cellName, AbstractCase.MASTER_TOKEN_NAME, boxName, colName, entityName,
                    HttpStatus.SC_OK);
            JSONObject json = res.bodyAsJson();
            JSONObject results = (JSONObject) ((JSONObject) json.get("d")).get("results");
            String value = results.get(EntityType.P_ENTITYTYPE_NAME.getName()).toString();
            assertEquals(entityName, value);
        }

        /**
         * ComplexType??.
         * @param cellName Cell??
         * @param boxName Box??
         * @param colName Collection??
         * @param complexName ComplexType??
         */
        private void checkComplexType(String cellName, String boxName, String colName, String complexName) {
            String complex1Url = UrlUtils.complexType(cellName, boxName, colName, complexName);
            DcResponse dres = ODataCommon.getOdataResource(complex1Url);
            JSONObject json = dres.bodyAsJson();
            JSONObject results = (JSONObject) ((JSONObject) json.get("d")).get("results");
            String value = results.get(ComplexType.P_COMPLEXTYPE_NAME.getName()).toString();
            assertEquals(complexName, value);
        }

        /**
         * associationEnd??.
         * @param cellName Cell??
         * @param boxName Box??
         * @param colName Collection??
         * @param entityName EntityType??
         * @param assocName associationEnd??
         */
        private void checkAssocEnd(String cellName, String boxName, String colName, String entityName,
                String assocName) {
            String aeUrl = UrlUtils.associationEnd(cellName, boxName, colName, assocName, entityName);
            DcResponse res = ODataCommon.getOdataResource(aeUrl);
            JSONObject json = res.bodyAsJson();
            JSONObject results = (JSONObject) ((JSONObject) json.get("d")).get("results");
            String value = results.get(AssociationEnd.P_ASSOCIATION_NAME.getName()).toString();
            assertEquals(assocName, value);
        }

        /**
         * AssociationEnd??.
         * @param colName Collection??
         */
        private void checkAssocEndLinks(final String colName) {
            String path = UrlUtils.associationEnd(Setup.TEST_CELL1, INSTALL_TARGET, colName, "entity1-entity2",
                    "entity1") + "/$links/_AssociationEnd";
            DcResponse dres = ODataCommon.getOdataResource(path);
            JSONObject json = dres.bodyAsJson();
            JSONArray reses = (JSONArray) ((JSONObject) json.get("d")).get("results");
            assertEquals(1, reses.size());
            JSONObject jsonResult = (JSONObject) reses.get(0);
            String value = jsonResult.get("uri").toString();
            String aeUrl = UrlUtils.associationEnd(Setup.TEST_CELL1, INSTALL_TARGET, colName, "entity2-entity1",
                    "entity2");
            assertEquals(aeUrl, value);
        }

        /**
         * Property??.
         * @param cellName Cell??
         * @param boxName Box??
         * @param colName Collection??
         * @param entityName EntityType
         * @param complexName ComplexType??
         * @param propName Property??
         */
        private void checkProperty(String cellName, String boxName, String colName, String entityName,
                String complexName, String propName, boolean master) {
            String refTypeName = Property.P_ENTITYTYPE_NAME.getName();
            String typeName = entityName;
            String aeUrl = UrlUtils.property(cellName, boxName, colName, propName, entityName);
            if (complexName != null) {
                refTypeName = ComplexTypeProperty.P_COMPLEXTYPE_NAME.getName();
                typeName = complexName;
                aeUrl = UrlUtils.complexTypeProperty(cellName, boxName, colName, propName, complexName);
            }
            DcResponse res = ODataCommon.getOdataResource(aeUrl);
            JSONObject json = res.bodyAsJson();
            JSONObject results = (JSONObject) ((JSONObject) json.get("d")).get("results");
            String value = results.get(Property.P_NAME.getName()).toString();
            assertEquals(propName, value);
            value = results.get(refTypeName).toString();
            assertEquals(typeName, value);
            // Nullable??"true"????
            value = results.get(Property.P_NULLABLE.getName()).toString();
            assertEquals(String.valueOf(master), value);
        }

        /**
         * ??.
         * @param cellName Cell??
         * @param boxName Box??
         * @param colName Collection??
         * @param entityName EntityType??
         * @param userId ID
         */
        private void checkUserData(String cellName, String boxName, String colName, String entityName, String userId) {
            TResponse res = UserDataUtils.get(cellName, AbstractCase.MASTER_TOKEN_NAME, boxName, colName, entityName,
                    userId, HttpStatus.SC_OK);
            JSONObject json = res.bodyAsJson();
            JSONObject results = (JSONObject) ((JSONObject) json.get("d")).get("results");
            String value = results.get("__id").toString();
            assertEquals(userId, value);
        }

        /**
         * $links?.
         * @param entitySet EntitySet??
         * @param key EntitySet???
         * @param navProp NavigationProperty??
         * @param navKey NavigationProperty???
         */
        protected void deleteLink(String entitySet, String key, String navProp, String navKey) {
            Http.request("links-request.txt").with("method", "DELETE").with("token", AbstractCase.MASTER_TOKEN_NAME)
                    .with("cellPath", Setup.TEST_CELL1).with("entitySet", entitySet).with("key", key)
                    .with("navProp", navProp).with("navKey", navKey).returns().statusCode(-1).debug();
        }

        /**
         * ???bar?????.
         */
        @Test
        public final void ???bar?????()
        {
            String reqCell = Setup.TEST_CELL1;
            String reqPath = INSTALL_TARGET;

            TResponse res = null;
            File barFile = new File(RESOURCE_PATH + BAR_FILE_MINIMUM);
            byte[] body = BarInstallTestUtils.readBarFile(barFile);
            Map<String, String> headers = new LinkedHashMap<String, String>();
            headers.put(HttpHeaders.CONTENT_TYPE, REQ_CONTENT_TYPE);
            headers.put(HttpHeaders.CONTENT_LENGTH, String.valueOf(body.length));

            res = BarInstallTestUtils.request(REQUEST_NORM_FILE, reqCell, reqPath, headers, body);
            res.statusCode(HttpStatus.SC_ACCEPTED);
            String location = res.getHeader(HttpHeaders.LOCATION);
            String expected = UrlUtils.cellRoot(reqCell) + reqPath;
            assertEquals(expected, location);

            BarInstallTestUtils.assertBarInstallStatus(location, SCHEMA_URL, ProgressInfo.STATUS.COMPLETED);
        }

        /**
         * 90_rootprops.xml?????.
         */
        @Test
        public final void rootprops_xml?????()
        {
            String reqCell = Setup.TEST_CELL1;
            String reqPath = INSTALL_TARGET;

            TResponse res = null;
            File barFile = new File(RESOURCE_PATH + BAR_FILE_ROOTPROP);
            byte[] body = BarInstallTestUtils.readBarFile(barFile);
            Map<String, String> headers = new LinkedHashMap<String, String>();
            headers.put(HttpHeaders.CONTENT_TYPE, REQ_CONTENT_TYPE);
            headers.put(HttpHeaders.CONTENT_LENGTH, String.valueOf(body.length));

            try {
                res = BarInstallTestUtils.request(REQUEST_NORM_FILE, reqCell, reqPath, headers, body);
                res.statusCode(HttpStatus.SC_ACCEPTED);
                String location = res.getHeader(HttpHeaders.LOCATION);
                String expected = UrlUtils.cellRoot(reqCell) + reqPath;
                assertEquals(expected, location);

                BarInstallTestUtils.assertBarInstallStatus(location, SCHEMA_URL, ProgressInfo.STATUS.COMPLETED);

                // PROPFIND?ACL??_admin???all???????
                TResponse tresponse = CellUtils.propfind(reqCell + "/" + reqPath, AbstractCase.MASTER_TOKEN_NAME, "1",
                        HttpStatus.SC_MULTI_STATUS);
                List<Map<String, List<String>>> list = new ArrayList<Map<String, List<String>>>();
                Map<String, List<String>> map = new HashMap<String, List<String>>();
                List<String> rolList = new ArrayList<String>();
                rolList.add("all");
                list.add(map);
                map.put("admin", rolList);
                Element root = tresponse.bodyAsXml().getDocumentElement();
                String resorce = UrlUtils.box(reqCell, reqPath);
                // UrlUtil???URL?????
                StringBuffer sb = new StringBuffer(resorce);
                sb.deleteCharAt(resorce.length() - 1);
                TestMethodUtils.aclResponseTest(root, sb.toString(), list, 4,
                        UrlUtils.roleResource(reqCell, reqPath, ""), null);
            } finally {
                CellCtlUtils.deleteRole(Setup.TEST_CELL1, "admin", INSTALL_TARGET);
                CellCtlUtils.deleteRole(Setup.TEST_CELL1, "user", INSTALL_TARGET);
            }
        }

        /**
         * ??????Role?bar???????.
         */
        @Test
        public final void ??????Role?bar???????()
        {
            String reqCell = Setup.TEST_CELL1;
            String reqPath = INSTALL_TARGET;

            TResponse res = null;
            File barFile = new File(RESOURCE_PATH + BAR_FILE_NGROLE);
            byte[] body = BarInstallTestUtils.readBarFile(barFile);
            Map<String, String> headers = new LinkedHashMap<String, String>();
            headers.put(HttpHeaders.CONTENT_TYPE, REQ_CONTENT_TYPE);
            headers.put(HttpHeaders.CONTENT_LENGTH, String.valueOf(body.length));

            try {
                res = BarInstallTestUtils.request(REQUEST_NORM_FILE, reqCell, reqPath, headers, body);
                res.statusCode(HttpStatus.SC_ACCEPTED);
                String location = res.getHeader(HttpHeaders.LOCATION);
                String expected = UrlUtils.cellRoot(reqCell) + reqPath;
                assertEquals(expected, location);

                BarInstallTestUtils.assertBarInstallStatus(location, SCHEMA_URL, ProgressInfo.STATUS.FAILED);
            } finally {
                CellCtlUtils.deleteRelation(Setup.TEST_CELL1, "relation1", INSTALL_TARGET);
            }
        }

        /**
         * ??????Relation?bar???????.
         */
        @Test
        public final void ??????Relation?bar???????()
        {
            String reqCell = Setup.TEST_CELL1;
            String reqPath = INSTALL_TARGET;

            TResponse res = null;
            File barFile = new File(RESOURCE_PATH + BAR_FILE_NGRELATION);
            byte[] body = BarInstallTestUtils.readBarFile(barFile);
            Map<String, String> headers = new LinkedHashMap<String, String>();
            headers.put(HttpHeaders.CONTENT_TYPE, REQ_CONTENT_TYPE);
            headers.put(HttpHeaders.CONTENT_LENGTH, String.valueOf(body.length));

            res = BarInstallTestUtils.request(REQUEST_NORM_FILE, reqCell, reqPath, headers, body);
            res.statusCode(HttpStatus.SC_ACCEPTED);
            String location = res.getHeader(HttpHeaders.LOCATION);
            String expected = UrlUtils.cellRoot(reqCell) + reqPath;
            assertEquals(expected, location);

            BarInstallTestUtils.assertBarInstallStatus(location, SCHEMA_URL, ProgressInfo.STATUS.FAILED);
        }

        /**
         * Relation?????bar???????.
         */
        @Test
        public final void Relation?????bar???????()
        {
            String reqCell = Setup.TEST_CELL1;
            String reqPath = INSTALL_TARGET;

            TResponse res = null;
            File barFile = new File(RESOURCE_PATH + BAR_FILE_RELATION_CONFLICT);
            byte[] body = BarInstallTestUtils.readBarFile(barFile);
            Map<String, String> headers = new LinkedHashMap<String, String>();
            headers.put(HttpHeaders.CONTENT_TYPE, REQ_CONTENT_TYPE);
            headers.put(HttpHeaders.CONTENT_LENGTH, String.valueOf(body.length));

            try {
                res = BarInstallTestUtils.request(REQUEST_NORM_FILE, reqCell, reqPath, headers, body);
                res.statusCode(HttpStatus.SC_ACCEPTED);
                String location = res.getHeader(HttpHeaders.LOCATION);
                String expected = UrlUtils.cellRoot(reqCell) + reqPath;
                assertEquals(expected, location);

                BarInstallTestUtils.assertBarInstallStatus(location, SCHEMA_URL, ProgressInfo.STATUS.FAILED);
            } finally {
                CellCtlUtils.deleteRelation(Setup.TEST_CELL1, "relation1", INSTALL_TARGET);
            }
        }

        /**
         * ExtRole?????bar???????.
         */
        @Test
        public final void ExtRole?????bar???????()
        {
            String reqCell = Setup.TEST_CELL1;
            String reqPath = INSTALL_TARGET;

            TResponse res = null;
            File barFile = new File(RESOURCE_PATH + BAR_FILE_EXTROLE_CONFLICT);
            byte[] body = BarInstallTestUtils.readBarFile(barFile);
            Map<String, String> headers = new LinkedHashMap<String, String>();
            headers.put(HttpHeaders.CONTENT_TYPE, REQ_CONTENT_TYPE);
            headers.put(HttpHeaders.CONTENT_LENGTH, String.valueOf(body.length));

            try {
                res = BarInstallTestUtils.request(REQUEST_NORM_FILE, reqCell, reqPath, headers, body);
                res.statusCode(HttpStatus.SC_ACCEPTED);
                String location = res.getHeader(HttpHeaders.LOCATION);
                String expected = UrlUtils.cellRoot(reqCell) + reqPath;
                assertEquals(expected, location);

                BarInstallTestUtils.assertBarInstallStatus(location, SCHEMA_URL, ProgressInfo.STATUS.FAILED);
            } finally {
                String extRole = "https://fqdn/cellName/__role/__/role2";
                CellCtlUtils.deleteExtRole(Setup.TEST_CELL1, extRole, "relation1", INSTALL_TARGET);
                CellCtlUtils.deleteRelation(Setup.TEST_CELL1, "relation1", INSTALL_TARGET);
                CellCtlUtils.deleteRole(Setup.TEST_CELL1, "role1", INSTALL_TARGET);
            }
        }

        /**
         * $link????bar???????.
         */
        @Test
        public final void $link????bar???????()
        {
            String reqCell = Setup.TEST_CELL1;
            String reqPath = INSTALL_TARGET;

            TResponse res = null;
            File barFile = new File(RESOURCE_PATH + BAR_FILE_LINK_ENTITYNOEXIST);
            byte[] body = BarInstallTestUtils.readBarFile(barFile);
            Map<String, String> headers = new LinkedHashMap<String, String>();
            headers.put(HttpHeaders.CONTENT_TYPE, REQ_CONTENT_TYPE);
            headers.put(HttpHeaders.CONTENT_LENGTH, String.valueOf(body.length));

            try {
                res = BarInstallTestUtils.request(REQUEST_NORM_FILE, reqCell, reqPath, headers, body);
                res.statusCode(HttpStatus.SC_ACCEPTED);
                String location = res.getHeader(HttpHeaders.LOCATION);
                String expected = UrlUtils.cellRoot(reqCell) + reqPath;
                assertEquals(expected, location);

                BarInstallTestUtils.assertBarInstallStatus(location, SCHEMA_URL, ProgressInfo.STATUS.FAILED);
            } finally {
                CellCtlUtils.deleteRelation(Setup.TEST_CELL1, "relation1", INSTALL_TARGET);
                CellCtlUtils.deleteRole(Setup.TEST_CELL1, "role1", INSTALL_TARGET);
            }
        }

        /**
         * bar?????????.
         */
        @Test
        public final void bar?????????()
        {
            String reqCell = Setup.TEST_CELL1;
            String reqPath = INSTALL_TARGET;

            TResponse res = null;
            File barFile = new File(RESOURCE_PATH + BAR_FILE_EMPTY);
            byte[] body = BarInstallTestUtils.readBarFile(barFile);
            Map<String, String> headers = new LinkedHashMap<String, String>();
            headers.put(HttpHeaders.CONTENT_TYPE, REQ_CONTENT_TYPE);
            headers.put(HttpHeaders.CONTENT_LENGTH, String.valueOf(body.length));

            res = BarInstallTestUtils.request(REQUEST_NORM_FILE, reqCell, reqPath, headers, body);
            res.statusCode(HttpStatus.SC_BAD_REQUEST);
            String code = DcCoreException.BarInstall.BAR_FILE_INVALID_STRUCTURES.getCode();
            String message = DcCoreException.BarInstall.BAR_FILE_INVALID_STRUCTURES
                    .params("bar/ bar/00_meta/ bar/00_meta/00_manifest.json bar/00_meta/90_rootprops.xml").getMessage();
            res.checkErrorResponse(code, message);
        }

        /**
         * bar???????????.
         */
        @Test
        public final void bar???????????()
        {
            String reqCell = Setup.TEST_CELL1;
            String reqPath = INSTALL_TARGET;

            TResponse res = null;
            File barFile = new File(RESOURCE_PATH + BAR_FILE_WRONGFILE);
            byte[] body = BarInstallTestUtils.readBarFile(barFile);
            Map<String, String> headers = new LinkedHashMap<String, String>();
            headers.put(HttpHeaders.CONTENT_TYPE, REQ_CONTENT_TYPE);
            headers.put(HttpHeaders.CONTENT_LENGTH, String.valueOf(body.length));

            try {
                res = BarInstallTestUtils.request(REQUEST_NORM_FILE, reqCell, reqPath, headers, body);

                res.statusCode(HttpStatus.SC_ACCEPTED);
                String location = res.getHeader(HttpHeaders.LOCATION);
                String expected = UrlUtils.cellRoot(reqCell) + reqPath;
                assertEquals(expected, location);

                BarInstallTestUtils.assertBarInstallStatus(location, SCHEMA_URL, ProgressInfo.STATUS.FAILED);
            } finally {
                deleteLink(Relation.EDM_TYPE_NAME, "Name='relation1',_Box.Name='" + INSTALL_TARGET + "'",
                        "_" + Role.EDM_TYPE_NAME, "Name='role1',_Box.Name='" + INSTALL_TARGET + "'");
                String extRole = "https://fqdn/cellName/__role/__/role2";
                CellCtlUtils.deleteExtRole(Setup.TEST_CELL1, extRole, "relation1", INSTALL_TARGET);
                CellCtlUtils.deleteRelation(Setup.TEST_CELL1, "relation1", INSTALL_TARGET);
                CellCtlUtils.deleteRole(Setup.TEST_CELL1, "role1", INSTALL_TARGET);
            }
        }

        /**
         * bar?00_meta?????????.
         */
        @Test
        public final void bar?00_ meta?????????()
        {
            String reqCell = Setup.TEST_CELL1;
            String reqPath = INSTALL_TARGET;

            TResponse res = null;
            File barFile = new File(RESOURCE_PATH + BAR_FILE_00META_NOTEXSIST);
            byte[] body = BarInstallTestUtils.readBarFile(barFile);
            Map<String, String> headers = new LinkedHashMap<String, String>();
            headers.put(HttpHeaders.CONTENT_TYPE, REQ_CONTENT_TYPE);
            headers.put(HttpHeaders.CONTENT_LENGTH, String.valueOf(body.length));

            res = BarInstallTestUtils.request(REQUEST_NORM_FILE, reqCell, reqPath, headers, body);

            res.statusCode(HttpStatus.SC_BAD_REQUEST);
            String code = DcCoreException.BarInstall.BAR_FILE_INVALID_STRUCTURES.getCode();
            String message = DcCoreException.BarInstall.BAR_FILE_INVALID_STRUCTURES
                    .params("bar/00_meta/ bar/00_meta/00_manifest.json bar/00_meta/90_rootprops.xml").getMessage();
            res.checkErrorResponse(code, message);
        }

        /**
         * bar?00_manifest?????????.
         */
        @Test
        public final void bar?00_ manifest?????????()
        {
            String reqCell = Setup.TEST_CELL1;
            String reqPath = INSTALL_TARGET;

            TResponse res = null;
            File barFile = new File(RESOURCE_PATH + BAR_FILE_00MANIFEST_NOTEXSIST);
            byte[] body = BarInstallTestUtils.readBarFile(barFile);
            Map<String, String> headers = new LinkedHashMap<String, String>();
            headers.put(HttpHeaders.CONTENT_TYPE, REQ_CONTENT_TYPE);
            headers.put(HttpHeaders.CONTENT_LENGTH, String.valueOf(body.length));

            res = BarInstallTestUtils.request(REQUEST_NORM_FILE, reqCell, reqPath, headers, body);

            res.statusCode(HttpStatus.SC_BAD_REQUEST);
            String code = DcCoreException.BarInstall.BAR_FILE_INVALID_STRUCTURES.getCode();
            String message = DcCoreException.BarInstall.BAR_FILE_INVALID_STRUCTURES
                    .params("bar/00_meta/00_manifest.json").getMessage();
            res.checkErrorResponse(code, message);
        }

        /**
         * bar?90_rootprops?????????.
         */
        @Test
        public final void bar?90_ rootprops?????????()
        {
            String reqCell = Setup.TEST_CELL1;
            String reqPath = INSTALL_TARGET;

            TResponse res = null;
            File barFile = new File(RESOURCE_PATH + BAR_FILE_90ROOTPROPS_NOTEXSIST);
            byte[] body = BarInstallTestUtils.readBarFile(barFile);
            Map<String, String> headers = new LinkedHashMap<String, String>();
            headers.put(HttpHeaders.CONTENT_TYPE, REQ_CONTENT_TYPE);
            headers.put(HttpHeaders.CONTENT_LENGTH, String.valueOf(body.length));

            res = BarInstallTestUtils.request(REQUEST_NORM_FILE, reqCell, reqPath, headers, body);

            res.statusCode(HttpStatus.SC_BAD_REQUEST);
            String code = DcCoreException.BarInstall.BAR_FILE_INVALID_STRUCTURES.getCode();
            String message = DcCoreException.BarInstall.BAR_FILE_INVALID_STRUCTURES
                    .params("bar/00_meta/90_rootprops.xml").getMessage();
            res.checkErrorResponse(code, message);
        }

        /**
         * bar??????????????.
         */
        @Test
        public final void bar??????????????()
        {
            String reqCell = Setup.TEST_CELL1;
            String reqPath = INSTALL_TARGET;

            TResponse res = null;
            File barFile = new File(RESOURCE_PATH + BAR_FILE_ROOTDIR_ORDER);
            byte[] body = BarInstallTestUtils.readBarFile(barFile);
            Map<String, String> headers = new LinkedHashMap<String, String>();
            headers.put(HttpHeaders.CONTENT_TYPE, REQ_CONTENT_TYPE);
            headers.put(HttpHeaders.CONTENT_LENGTH, String.valueOf(body.length));

            res = BarInstallTestUtils.request(REQUEST_NORM_FILE, reqCell, reqPath, headers, body);

            res.statusCode(HttpStatus.SC_BAD_REQUEST);
            String code = DcCoreException.BarInstall.BAR_FILE_INVALID_STRUCTURES.getCode();
            String message = DcCoreException.BarInstall.BAR_FILE_INVALID_STRUCTURES.params("bar/00_meta/").getMessage();
            res.checkErrorResponse(code, message);
        }

        /**
         * bar?00_metadata?????????????.
         */
        @Test
        public final void bar?00_ metadata?????????????()
        {
            String reqCell = Setup.TEST_CELL1;
            String reqPath = INSTALL_TARGET;

            TResponse res = null;
            File barFile = new File(RESOURCE_PATH + BAR_FILE_00META_ORDER);
            byte[] body = BarInstallTestUtils.readBarFile(barFile);
            Map<String, String> headers = new LinkedHashMap<String, String>();
            headers.put(HttpHeaders.CONTENT_TYPE, REQ_CONTENT_TYPE);
            headers.put(HttpHeaders.CONTENT_LENGTH, String.valueOf(body.length));

            res = BarInstallTestUtils.request(REQUEST_NORM_FILE, reqCell, reqPath, headers, body);

            res.statusCode(HttpStatus.SC_ACCEPTED);
            String location = res.getHeader(HttpHeaders.LOCATION);
            String expected = UrlUtils.cellRoot(reqCell) + reqPath;
            assertEquals(expected, location);

            BarInstallTestUtils.assertBarInstallStatus(location, SCHEMA_URL, ProgressInfo.STATUS.FAILED);
        }

        /**
         * relation_json?????????.
         */
        @Test
        public final void relation_json?????????()
        {
            String reqCell = Setup.TEST_CELL1;
            String reqPath = INSTALL_TARGET;

            TResponse res = null;
            File barFile = new File(RESOURCE_PATH + BAR_FILE_RELATION_NONAME);
            byte[] body = BarInstallTestUtils.readBarFile(barFile);
            Map<String, String> headers = new LinkedHashMap<String, String>();
            headers.put(HttpHeaders.CONTENT_TYPE, REQ_CONTENT_TYPE);
            headers.put(HttpHeaders.CONTENT_LENGTH, String.valueOf(body.length));

            res = BarInstallTestUtils.request(REQUEST_NORM_FILE, reqCell, reqPath, headers, body);

            res.statusCode(HttpStatus.SC_ACCEPTED);
            String location = res.getHeader(HttpHeaders.LOCATION);
            String expected = UrlUtils.cellRoot(reqCell) + reqPath;
            assertEquals(expected, location);

            BarInstallTestUtils.assertBarInstallStatus(location, SCHEMA_URL, ProgressInfo.STATUS.FAILED);
        }

        /**
         * relation_json?FIELDNAME????????.
         */
        @Test
        public final void relation_json?FIELDNAME????????()
        {
            // JSON??
            String reqCell = Setup.TEST_CELL1;
            String reqPath = INSTALL_TARGET;

            TResponse res = null;
            File barFile = new File(RESOURCE_PATH + BAR_FILE_RELATION_NOFIELDNAME);
            byte[] body = BarInstallTestUtils.readBarFile(barFile);
            Map<String, String> headers = new LinkedHashMap<String, String>();
            headers.put(HttpHeaders.CONTENT_TYPE, REQ_CONTENT_TYPE);
            headers.put(HttpHeaders.CONTENT_LENGTH, String.valueOf(body.length));

            res = BarInstallTestUtils.request(REQUEST_NORM_FILE, reqCell, reqPath, headers, body);

            res.statusCode(HttpStatus.SC_ACCEPTED);
            String location = res.getHeader(HttpHeaders.LOCATION);
            String expected = UrlUtils.cellRoot(reqCell) + reqPath;
            assertEquals(expected, location);

            BarInstallTestUtils.assertBarInstallStatus(location, SCHEMA_URL, ProgressInfo.STATUS.FAILED);
        }

        /**
         * role_json?FIELDNAME????????.
         */
        @Test
        public final void role_json?FIELDNAME????????()
        {
            // JSON??
            String reqCell = Setup.TEST_CELL1;
            String reqPath = INSTALL_TARGET;

            TResponse res = null;
            File barFile = new File(RESOURCE_PATH + BAR_FILE_ROLE_NOFIELDNAME);
            byte[] body = BarInstallTestUtils.readBarFile(barFile);
            Map<String, String> headers = new LinkedHashMap<String, String>();
            headers.put(HttpHeaders.CONTENT_TYPE, REQ_CONTENT_TYPE);
            headers.put(HttpHeaders.CONTENT_LENGTH, String.valueOf(body.length));

            res = BarInstallTestUtils.request(REQUEST_NORM_FILE, reqCell, reqPath, headers, body);

            try {
                res.statusCode(HttpStatus.SC_ACCEPTED);
                String location = res.getHeader(HttpHeaders.LOCATION);
                String expected = UrlUtils.cellRoot(reqCell) + reqPath;
                assertEquals(expected, location);

                BarInstallTestUtils.assertBarInstallStatus(location, SCHEMA_URL, ProgressInfo.STATUS.FAILED);
            } finally {
                CellCtlUtils.deleteRelation(Setup.TEST_CELL1, "relation1", INSTALL_TARGET);
            }
        }

        /**
         * extrole_json?FIELDNAME????????.
         */
        @Test
        public final void extrole_json?FIELDNAME????????()
        {
            // JSON??
            String reqCell = Setup.TEST_CELL1;
            String reqPath = INSTALL_TARGET;

            TResponse res = null;
            File barFile = new File(RESOURCE_PATH + BAR_FILE_EXROLE_NOFIELDNAME);
            byte[] body = BarInstallTestUtils.readBarFile(barFile);
            Map<String, String> headers = new LinkedHashMap<String, String>();
            headers.put(HttpHeaders.CONTENT_TYPE, REQ_CONTENT_TYPE);
            headers.put(HttpHeaders.CONTENT_LENGTH, String.valueOf(body.length));

            try {
                res = BarInstallTestUtils.request(REQUEST_NORM_FILE, reqCell, reqPath, headers, body);

                res.statusCode(HttpStatus.SC_ACCEPTED);
                String location = res.getHeader(HttpHeaders.LOCATION);
                String expected = UrlUtils.cellRoot(reqCell) + reqPath;
                assertEquals(expected, location);

                BarInstallTestUtils.assertBarInstallStatus(location, SCHEMA_URL, ProgressInfo.STATUS.FAILED);
            } finally {
                CellCtlUtils.deleteRelation(Setup.TEST_CELL1, "relation1", INSTALL_TARGET);
                CellCtlUtils.deleteRole(Setup.TEST_CELL1, "role1", INSTALL_TARGET);
            }

        }

        /**
         * relation_json?JSON?????????.
         */
        @Test
        public final void relation_json?JSON?????????()
        {
            // JSON??
            String reqCell = Setup.TEST_CELL1;
            String reqPath = INSTALL_TARGET;

            TResponse res = null;
            File barFile = new File(RESOURCE_PATH + BAR_FILE_NO_JSON_FORM);
            byte[] body = BarInstallTestUtils.readBarFile(barFile);
            Map<String, String> headers = new LinkedHashMap<String, String>();
            headers.put(HttpHeaders.CONTENT_TYPE, REQ_CONTENT_TYPE);
            headers.put(HttpHeaders.CONTENT_LENGTH, String.valueOf(body.length));

            res = BarInstallTestUtils.request(REQUEST_NORM_FILE, reqCell, reqPath, headers, body);

            res.statusCode(HttpStatus.SC_ACCEPTED);
            String location = res.getHeader(HttpHeaders.LOCATION);
            String expected = UrlUtils.cellRoot(reqCell) + reqPath;
            assertEquals(expected, location);

            BarInstallTestUtils.assertBarInstallStatus(location, SCHEMA_URL, ProgressInfo.STATUS.FAILED);
        }

        /**
         * relation_json???????????.
         */
        @Test
        public final void relation_json???????????()
        {
            // JSON?
            String reqCell = Setup.TEST_CELL1;
            String reqPath = INSTALL_TARGET;

            TResponse res = null;
            File barFile = new File(RESOURCE_PATH + BAR_FILE_RELATION_FILE_NAME);
            byte[] body = BarInstallTestUtils.readBarFile(barFile);
            Map<String, String> headers = new LinkedHashMap<String, String>();
            headers.put(HttpHeaders.CONTENT_TYPE, REQ_CONTENT_TYPE);
            headers.put(HttpHeaders.CONTENT_LENGTH, String.valueOf(body.length));

            res = BarInstallTestUtils.request(REQUEST_NORM_FILE, reqCell, reqPath, headers, body);

            res.statusCode(HttpStatus.SC_ACCEPTED);
            String location = res.getHeader(HttpHeaders.LOCATION);
            String expected = UrlUtils.cellRoot(reqCell) + reqPath;
            assertEquals(expected, location);

            BarInstallTestUtils.assertBarInstallStatus(location, SCHEMA_URL, ProgressInfo.STATUS.FAILED);
        }

        /**
         * role_json???????????.
         */
        @Test
        public final void role_json???????????()
        {
            // JSON?
            String reqCell = Setup.TEST_CELL1;
            String reqPath = INSTALL_TARGET;

            TResponse res = null;
            File barFile = new File(RESOURCE_PATH + BAR_FILE_ROLE_FILE_NAME);
            byte[] body = BarInstallTestUtils.readBarFile(barFile);
            Map<String, String> headers = new LinkedHashMap<String, String>();
            headers.put(HttpHeaders.CONTENT_TYPE, REQ_CONTENT_TYPE);
            headers.put(HttpHeaders.CONTENT_LENGTH, String.valueOf(body.length));

            try {
                res = BarInstallTestUtils.request(REQUEST_NORM_FILE, reqCell, reqPath, headers, body);

                res.statusCode(HttpStatus.SC_ACCEPTED);
                String location = res.getHeader(HttpHeaders.LOCATION);
                String expected = UrlUtils.cellRoot(reqCell) + reqPath;
                assertEquals(expected, location);

                BarInstallTestUtils.assertBarInstallStatus(location, SCHEMA_URL, ProgressInfo.STATUS.FAILED);
            } finally {
                CellCtlUtils.deleteRelation(Setup.TEST_CELL1, "relation1", INSTALL_TARGET);
            }
        }

        /**
         * extrole_json???????????.
         */
        @Test
        public final void extrole_json???????????()
        {
            // JSON?
            String reqCell = Setup.TEST_CELL1;
            String reqPath = INSTALL_TARGET;

            TResponse res = null;
            File barFile = new File(RESOURCE_PATH + BAR_FILE_EXROLE_FILE_NAME);
            byte[] body = BarInstallTestUtils.readBarFile(barFile);
            Map<String, String> headers = new LinkedHashMap<String, String>();
            headers.put(HttpHeaders.CONTENT_TYPE, REQ_CONTENT_TYPE);
            headers.put(HttpHeaders.CONTENT_LENGTH, String.valueOf(body.length));

            try {
                res = BarInstallTestUtils.request(REQUEST_NORM_FILE, reqCell, reqPath, headers, body);

                res.statusCode(HttpStatus.SC_ACCEPTED);
                String location = res.getHeader(HttpHeaders.LOCATION);
                String expected = UrlUtils.cellRoot(reqCell) + reqPath;
                assertEquals(expected, location);

                BarInstallTestUtils.assertBarInstallStatus(location, SCHEMA_URL, ProgressInfo.STATUS.FAILED);
            } finally {
                CellCtlUtils.deleteRelation(Setup.TEST_CELL1, "relation1", INSTALL_TARGET);
                CellCtlUtils.deleteRole(Setup.TEST_CELL1, "role1", INSTALL_TARGET);
            }
        }

        /**
         * ??XML??????.
         */
        @Test
        public final void ??XML??????()
        {
            // JSON?
            String reqCell = Setup.TEST_CELL1;
            String reqPath = INSTALL_TARGET;

            TResponse res = null;
            File barFile = new File(RESOURCE_PATH + "/V1_1_2_bar_invalid_xml.bar");
            byte[] body = BarInstallTestUtils.readBarFile(barFile);
            Map<String, String> headers = new LinkedHashMap<String, String>();
            headers.put(HttpHeaders.CONTENT_TYPE, REQ_CONTENT_TYPE);
            headers.put(HttpHeaders.CONTENT_LENGTH, String.valueOf(body.length));

            res = BarInstallTestUtils.request(REQUEST_NORM_FILE, reqCell, reqPath, headers, body);
            res.statusCode(HttpStatus.SC_ACCEPTED);
            String location = res.getHeader(HttpHeaders.LOCATION);
            String expected = UrlUtils.cellRoot(reqCell) + reqPath;
            assertEquals(expected, location);

            BarInstallTestUtils.assertBarInstallStatus(location, SCHEMA_URL, ProgressInfo.STATUS.FAILED);
        }

        /**
         * rootprops_xml??ODataColcontents?????.
         */
        @Test
        public final void rootprops_xml??ODataColcontents?????()
        {
            String reqCell = Setup.TEST_CELL1;
            String reqPath = INSTALL_TARGET;

            try {
                TResponse res = null;
                File barFile = new File(RESOURCE_PATH + BAR_FILE_ODATA_CONT_NOTEXIST);
                byte[] body = BarInstallTestUtils.readBarFile(barFile);
                Map<String, String> headers = new LinkedHashMap<String, String>();
                headers.put(HttpHeaders.CONTENT_TYPE, REQ_CONTENT_TYPE);
                headers.put(HttpHeaders.CONTENT_LENGTH, String.valueOf(body.length));

                res = BarInstallTestUtils.request(REQUEST_NORM_FILE, reqCell, reqPath, headers, body);
                res.statusCode(HttpStatus.SC_ACCEPTED);
                String location = res.getHeader(HttpHeaders.LOCATION);
                String expected = UrlUtils.cellRoot(reqCell) + reqPath;
                assertEquals(expected, location);

                BarInstallTestUtils.assertBarInstallStatus(location, SCHEMA_URL, ProgressInfo.STATUS.FAILED);
            } finally {
                BarInstallTestUtils.deleteCollection("odatacol1");
            }
        }

        /**
         * rootprops_xml???ODataColcontents??????.
         */
        @Test
        public final void rootprops_xml???ODataColcontents??????()
        {
            String reqCell = Setup.TEST_CELL1;
            String reqPath = INSTALL_TARGET;

            try {
                TResponse res = null;
                File barFile = new File(RESOURCE_PATH + BAR_FILE_ODATA_SPEC_NOTEXIST);
                byte[] body = BarInstallTestUtils.readBarFile(barFile);
                Map<String, String> headers = new LinkedHashMap<String, String>();
                headers.put(HttpHeaders.CONTENT_TYPE, REQ_CONTENT_TYPE);
                headers.put(HttpHeaders.CONTENT_LENGTH, String.valueOf(body.length));

                res = BarInstallTestUtils.request(REQUEST_NORM_FILE, reqCell, reqPath, headers, body);
                res.statusCode(HttpStatus.SC_ACCEPTED);
                String location = res.getHeader(HttpHeaders.LOCATION);
                String expected = UrlUtils.cellRoot(reqCell) + reqPath;
                assertEquals(expected, location);

                BarInstallTestUtils.assertBarInstallStatus(location, SCHEMA_URL, ProgressInfo.STATUS.FAILED);
            } finally {
                BarInstallTestUtils.deleteCollection("odatacol1");
            }
        }

        /**
         * ODataCol??????.
         */
        @Test
        public final void ODataCol??????()
        {
            String reqCell = Setup.TEST_CELL1;
            String reqPath = INSTALL_TARGET;

            try {
                TResponse res = null;
                File barFile = new File(RESOURCE_PATH + BAR_FILE_ODATA_CONT_EMPTY);
                byte[] body = BarInstallTestUtils.readBarFile(barFile);
                Map<String, String> headers = new LinkedHashMap<String, String>();
                headers.put(HttpHeaders.CONTENT_TYPE, REQ_CONTENT_TYPE);
                headers.put(HttpHeaders.CONTENT_LENGTH, String.valueOf(body.length));

                res = BarInstallTestUtils.request(REQUEST_NORM_FILE, reqCell, reqPath, headers, body);
                res.statusCode(HttpStatus.SC_ACCEPTED);
                String location = res.getHeader(HttpHeaders.LOCATION);
                String expected = UrlUtils.cellRoot(reqCell) + reqPath;
                assertEquals(expected, location);

                BarInstallTestUtils.assertBarInstallStatus(location, SCHEMA_URL, ProgressInfo.STATUS.FAILED);
            } finally {
                BarInstallTestUtils.deleteCollection("odatacol1");
            }
        }

        /**
         * ODataCol?00_metadata_xml??????.
         */
        @Test
        public final void ODataCol?00_ metadata_xml??????()
        {
            String reqCell = Setup.TEST_CELL1;
            String reqPath = INSTALL_TARGET;

            try {
                TResponse res = null;
                File barFile = new File(RESOURCE_PATH + BAR_FILE_00METADATA_NOTEXIST);
                byte[] body = BarInstallTestUtils.readBarFile(barFile);
                Map<String, String> headers = new LinkedHashMap<String, String>();
                headers.put(HttpHeaders.CONTENT_TYPE, REQ_CONTENT_TYPE);
                headers.put(HttpHeaders.CONTENT_LENGTH, String.valueOf(body.length));

                res = BarInstallTestUtils.request(REQUEST_NORM_FILE, reqCell, reqPath, headers, body);
                res.statusCode(HttpStatus.SC_ACCEPTED);
                String location = res.getHeader(HttpHeaders.LOCATION);
                String expected = UrlUtils.cellRoot(reqCell) + reqPath;
                assertEquals(expected, location);

                BarInstallTestUtils.assertBarInstallStatus(location, SCHEMA_URL, ProgressInfo.STATUS.FAILED);
            } finally {
                BarInstallTestUtils.deleteCollection("odatacol1");
            }
        }

        /**
         * ODataCol?00_metadata_xml?10_odatarelations_json????????.
         */
        @Test
        public final void ODataCol?00_ metadata_xml?10_ odatarelations_json????????()
        {
            String reqCell = Setup.TEST_CELL1;
            String reqPath = INSTALL_TARGET;

            try {
                TResponse res = null;
                File barFile = new File(RESOURCE_PATH + BAR_FILE_INVALID_CONT_ORDER);
                byte[] body = BarInstallTestUtils.readBarFile(barFile);
                Map<String, String> headers = new LinkedHashMap<String, String>();
                headers.put(HttpHeaders.CONTENT_TYPE, REQ_CONTENT_TYPE);
                headers.put(HttpHeaders.CONTENT_LENGTH, String.valueOf(body.length));

                res = BarInstallTestUtils.request(REQUEST_NORM_FILE, reqCell, reqPath, headers, body);
                res.statusCode(HttpStatus.SC_ACCEPTED);
                String location = res.getHeader(HttpHeaders.LOCATION);
                String expected = UrlUtils.cellRoot(reqCell) + reqPath;
                assertEquals(expected, location);

                BarInstallTestUtils.assertBarInstallStatus(location, SCHEMA_URL, ProgressInfo.STATUS.FAILED);
            } finally {
                BarInstallTestUtils.deleteCollection("odatacol1");
            }
        }

        /**
         * WebDAV(_OData??bar?????.
         */
        @Test
        public final void WebDAV_OData??bar?????()
        {
            final String reqCell = Setup.TEST_CELL1;
            final String reqPath = INSTALL_TARGET;
            final String odataColName = "odatacol1";

            TResponse res = null;
            File barFile = new File(RESOURCE_PATH + BAR_FILE_WEBDAV_ODATA);
            byte[] body = BarInstallTestUtils.readBarFile(barFile);
            Map<String, String> headers = new LinkedHashMap<String, String>();
            headers.put(HttpHeaders.CONTENT_TYPE, REQ_CONTENT_TYPE);
            headers.put(HttpHeaders.CONTENT_LENGTH, String.valueOf(body.length));

            try {
                res = BarInstallTestUtils.request(REQUEST_NORM_FILE, reqCell, reqPath, headers, body);
                res.statusCode(HttpStatus.SC_ACCEPTED);
                String location = res.getHeader(HttpHeaders.LOCATION);
                String expected = UrlUtils.cellRoot(reqCell) + reqPath;
                assertEquals(expected, location);

                BarInstallTestUtils.assertBarInstallStatus(location, SCHEMA_URL, ProgressInfo.STATUS.COMPLETED);

                // ??
                checkUserData(Setup.TEST_CELL1, INSTALL_TARGET, odataColName, "entity1", "barInstallTest");

                // File??
                DavResourceUtils.getWebDavFile(Setup.TEST_CELL1, AbstractCase.MASTER_TOKEN_NAME, "box/dav-get.txt",
                        INSTALL_TARGET, "davcol1/testdavfile.txt", HttpStatus.SC_OK);
                DavResourceUtils.getWebDavFile(Setup.TEST_CELL1, AbstractCase.MASTER_TOKEN_NAME, "box/dav-get.txt",
                        INSTALL_TARGET, "davcol1/testdavfile2.txt", HttpStatus.SC_OK);
            } finally {
                // ?
                String resourceUrl = UrlUtils.userdata(reqCell, reqPath, odataColName, "entity1", "barInstallTest");
                ODataCommon.deleteOdataResource(resourceUrl);
                resourceUrl = UrlUtils.userdata(reqCell, reqPath, odataColName, "entity1", "barInstallTest2");
                ODataCommon.deleteOdataResource(resourceUrl);

                // ComplexTypeProperty?
                resourceUrl = UrlUtils.complexTypeProperty(reqCell, INSTALL_TARGET, odataColName, "compProp1",
                        "complex1");
                ODataCommon.deleteOdataResource(resourceUrl);
                // Property?
                resourceUrl = UrlUtils.property(reqCell, INSTALL_TARGET, odataColName, "property1", "entity1");
                ODataCommon.deleteOdataResource(resourceUrl);
                resourceUrl = UrlUtils.property(reqCell, INSTALL_TARGET, odataColName, "property2", "entity1");
                ODataCommon.deleteOdataResource(resourceUrl);
                // ComplexType?
                resourceUrl = UrlUtils.complexType(reqCell, reqPath, odataColName, "complex1");
                ODataCommon.deleteOdataResource(resourceUrl);

                // EntityType?
                Setup.entityTypeDelete(odataColName, "entity1", Setup.TEST_CELL1, INSTALL_TARGET);

                // ?
                DavResourceUtils.deleteWebDavFile(Setup.TEST_CELL1, AbstractCase.MASTER_TOKEN_NAME, INSTALL_TARGET,
                        "davcol1/testdavfile.txt");
                DavResourceUtils.deleteWebDavFile(Setup.TEST_CELL1, AbstractCase.MASTER_TOKEN_NAME, INSTALL_TARGET,
                        "davcol1/testdavfile2.txt");

                // ?
                DavResourceUtils.deleteCollection(reqCell, INSTALL_TARGET, "davcol1", AbstractCase.MASTER_TOKEN_NAME,
                        -1);
                DavResourceUtils.deleteCollection(reqCell, INSTALL_TARGET, odataColName, AbstractCase.MASTER_TOKEN_NAME,
                        -1);
            }
        }

        /**
         * ODataCol?90_data??entityType?????????.
         */
        @Test
        public final void ODataCol?90_ data??entityType?????????()
        {
            final String reqCell = Setup.TEST_CELL1;
            final String reqBox = INSTALL_TARGET;
            final String odataColName = "davcol1/odatacol1";

            TResponse res = null;
            File barFile = new File(RESOURCE_PATH + "/V1_1_2_bar_90data_order.bar");
            byte[] body = BarInstallTestUtils.readBarFile(barFile);
            Map<String, String> headers = new LinkedHashMap<String, String>();
            headers.put(HttpHeaders.CONTENT_TYPE, REQ_CONTENT_TYPE);
            headers.put(HttpHeaders.CONTENT_LENGTH, String.valueOf(body.length));

            try {
                res = BarInstallTestUtils.request(REQUEST_NORM_FILE, reqCell, reqBox, headers, body);
                res.statusCode(HttpStatus.SC_ACCEPTED);
                String location = res.getHeader(HttpHeaders.LOCATION);
                String expected = UrlUtils.cellRoot(reqCell) + reqBox;
                assertEquals(expected, location);

                BarInstallTestUtils.assertBarInstallStatus(location, SCHEMA_URL, ProgressInfo.STATUS.COMPLETED);

                // ??
                res = UserDataUtils.get(reqCell, AbstractCase.MASTER_TOKEN_NAME, reqBox, odataColName, "entity1",
                        "barInstallTest", HttpStatus.SC_OK);
                String locationHeader = UrlUtils.userdata(reqCell, reqBox, odataColName, "entity1", "barInstallTest");
                Map<String, Object> additional = new HashMap<String, Object>();
                additional.put("__id", "barInstallTest");
                additional.put("name", "barInstall");
                additional.put("property1", "property");
                Map<String, String> compProp = new HashMap<String, String>();
                compProp.put("compProp1", "compProp1");
                additional.put("property2", compProp);
                ODataCommon.checkResponseBody(res.bodyAsJson(), locationHeader, "UserData.entity1", additional);

                res = UserDataUtils.get(reqCell, AbstractCase.MASTER_TOKEN_NAME, reqBox, odataColName, "entity1",
                        "barInstallTest2", HttpStatus.SC_OK);
                locationHeader = UrlUtils.userdata(reqCell, reqBox, odataColName, "entity1", "barInstallTest2");
                additional = new HashMap<String, Object>();
                additional.put("__id", "barInstallTest2");
                additional.put("name", "barInstall2");
                additional.put("property1", "property");
                compProp = new HashMap<String, String>();
                compProp.put("compProp1", "compProp1");
                additional.put("property2", compProp);
                ODataCommon.checkResponseBody(res.bodyAsJson(), locationHeader, "UserData.entity1", additional);

                res = UserDataUtils.get(reqCell, AbstractCase.MASTER_TOKEN_NAME, reqBox, odataColName, "entity2",
                        "barInstallTest", HttpStatus.SC_OK);
                locationHeader = UrlUtils.userdata(reqCell, reqBox, odataColName, "entity2", "barInstallTest");
                additional = new HashMap<String, Object>();
                additional.put("__id", "barInstallTest");
                additional.put("name", "barInstall");
                additional.put("property1", "property");
                ODataCommon.checkResponseBody(res.bodyAsJson(), locationHeader, "UserData.entity2", additional);
            } finally {
                // ?
                String resourceUrl = UrlUtils.userdata(reqCell, reqBox, odataColName, "entity1", "barInstallTest");
                ODataCommon.deleteOdataResource(resourceUrl);
                resourceUrl = UrlUtils.userdata(reqCell, reqBox, odataColName, "entity1", "barInstallTest2");
                ODataCommon.deleteOdataResource(resourceUrl);
                resourceUrl = UrlUtils.userdata(reqCell, reqBox, odataColName, "entity2", "barInstallTest");
                ODataCommon.deleteOdataResource(resourceUrl);

                // ComplexTypeProperty?
                resourceUrl = UrlUtils.complexTypeProperty(reqCell, INSTALL_TARGET, odataColName, "compProp1",
                        "complex1");
                ODataCommon.deleteOdataResource(resourceUrl);
                // Property?
                resourceUrl = UrlUtils.property(reqCell, INSTALL_TARGET, odataColName, "property1", "entity1");
                ODataCommon.deleteOdataResource(resourceUrl);
                resourceUrl = UrlUtils.property(reqCell, INSTALL_TARGET, odataColName, "property2", "entity1");
                ODataCommon.deleteOdataResource(resourceUrl);
                // ComplexType?
                resourceUrl = UrlUtils.complexType(reqCell, reqBox, odataColName, "complex1");
                ODataCommon.deleteOdataResource(resourceUrl);

                // EntityType?
                Setup.entityTypeDelete(odataColName, "entity1", Setup.TEST_CELL1, INSTALL_TARGET);
                Setup.entityTypeDelete(odataColName, "entity2", Setup.TEST_CELL1, INSTALL_TARGET);

                // ?
                DavResourceUtils.deleteCollection(reqCell, INSTALL_TARGET, odataColName, AbstractCase.MASTER_TOKEN_NAME,
                        -1);
                DavResourceUtils.deleteCollection(reqCell, INSTALL_TARGET, "davcol1", AbstractCase.MASTER_TOKEN_NAME,
                        -1);
            }
        }

        /**
         * ?Box????????barInstarll??403?????.
         */
        @Test
        public final void ?Box????????barInstarll??403 ?????()
        {
            String reqCellName = "boxInstallTestCell";
            String reqBoxName = INSTALL_TARGET;
            String userName = "boxInstallTestAccount";
            String password = "password27";

            try {
                createInstallTarget(reqCellName, userName, password, true);

                // Box?
                BoxUtils.create(reqCellName, reqBoxName, AbstractCase.MASTER_TOKEN_NAME);

                // ?
                String token = getAccessToken(reqCellName, userName, password);

                TResponse res = null;
                File barFile = new File(RESOURCE_PATH + BAR_FILE_MINIMUM);
                byte[] body = BarInstallTestUtils.readBarFile(barFile);
                Map<String, String> headers = new LinkedHashMap<String, String>();
                headers.put(HttpHeaders.CONTENT_TYPE, REQ_CONTENT_TYPE);
                headers.put(HttpHeaders.CONTENT_LENGTH, String.valueOf(body.length));

                res = BarInstallTestUtils.request(token, REQUEST_NORM_FILE, reqCellName, reqBoxName, headers, body);
                res.statusCode(HttpStatus.SC_FORBIDDEN);
                String code = DcCoreException.Auth.NECESSARY_PRIVILEGE_LACKING.getCode();
                String message = DcCoreException.Auth.NECESSARY_PRIVILEGE_LACKING.getMessage();
                res.checkErrorResponse(code, message);
            } finally {
                Setup.cellBulkDeletion(reqCellName);
            }
        }

        /**
         * ?Box???????barInstarll??400?????.
         */
        @Test
        public final void ? Box???????barInstarll??400 ?????()
        {
            String reqCellName = "boxInstallTestCell";
            String reqBoxName = INSTALL_TARGET;
            String userName = "boxInstallTestAccount";
            String password = "password27";

            try {
                createInstallTarget(reqCellName, userName, password, false);

                // Box?Schema
                BoxUtils.createWithScheme(reqCellName, reqBoxName, AbstractCase.MASTER_TOKEN_NAME, SCHEMA_URL);

                // ?
                String token = getAccessToken(reqCellName, userName, password);

                // 
                TResponse res = null;
                File barFile = new File(RESOURCE_PATH + BAR_FILE_MINIMUM);
                byte[] body = BarInstallTestUtils.readBarFile(barFile);
                Map<String, String> headers = new LinkedHashMap<String, String>();
                headers.put(HttpHeaders.CONTENT_TYPE, REQ_CONTENT_TYPE);
                headers.put(HttpHeaders.CONTENT_LENGTH, String.valueOf(body.length));

                res = BarInstallTestUtils.request(token, REQUEST_NORM_FILE, reqCellName, reqBoxName, headers, body);
                res.statusCode(HttpStatus.SC_BAD_REQUEST);
                String code = DcCoreException.BarInstall.BAR_FILE_BOX_SCHEMA_ALREADY_EXISTS.getCode();
                String message = DcCoreException.BarInstall.BAR_FILE_BOX_SCHEMA_ALREADY_EXISTS.params(SCHEMA_URL)
                        .getMessage();
                res.checkErrorResponse(code, message);
            } finally {
                Setup.cellBulkDeletion(reqCellName);
            }
        }

        /**
         * ???Box???????barInstarll??405?????.
         */
        @Test
        public final void ? ??Box???????barInstarll??405 ?????()
        {
            String reqCellName = "boxInstallTestCell";
            String reqBoxName = INSTALL_TARGET;
            String userName = "boxInstallTestAccount";
            String password = "password27";

            try {
                createInstallTarget(reqCellName, userName, password, false);

                // Box?
                BoxUtils.create(reqCellName, reqBoxName, AbstractCase.MASTER_TOKEN_NAME);

                // ?
                String token = getAccessToken(reqCellName, userName, password);

                TResponse res = null;
                File barFile = new File(RESOURCE_PATH + BAR_FILE_MINIMUM);
                byte[] body = BarInstallTestUtils.readBarFile(barFile);
                Map<String, String> headers = new LinkedHashMap<String, String>();
                headers.put(HttpHeaders.CONTENT_TYPE, REQ_CONTENT_TYPE);
                headers.put(HttpHeaders.CONTENT_LENGTH, String.valueOf(body.length));

                res = BarInstallTestUtils.request(token, REQUEST_NORM_FILE, reqCellName, reqBoxName, headers, body);
                res.statusCode(HttpStatus.SC_METHOD_NOT_ALLOWED);
                String code = DcCoreException.BarInstall.BAR_FILE_BOX_ALREADY_EXISTS.getCode();
                String message = DcCoreException.BarInstall.BAR_FILE_BOX_ALREADY_EXISTS.params(reqBoxName).getMessage();
                res.checkErrorResponse(code, message);
            } finally {
                Setup.cellBulkDeletion(reqCellName);
            }
        }

        /**
         * ??__src????Box????.
         */
        @Test
        public final void ??__src????Box????()
        {
            String reqCell = Setup.TEST_CELL1;
            String reqPath = INSTALL_TARGET;

            TResponse res = null;
            File barFile = new File(RESOURCE_PATH + "/V1_1_2_bar_90rootprops_invalid_src.bar");
            byte[] body = BarInstallTestUtils.readBarFile(barFile);
            Map<String, String> headers = new LinkedHashMap<String, String>();
            headers.put(HttpHeaders.CONTENT_TYPE, REQ_CONTENT_TYPE);
            headers.put(HttpHeaders.CONTENT_LENGTH, String.valueOf(body.length));

            res = BarInstallTestUtils.request(REQUEST_NORM_FILE, reqCell, reqPath, headers, body);
            res.statusCode(HttpStatus.SC_ACCEPTED);
            String location = res.getHeader(HttpHeaders.LOCATION);
            String expected = UrlUtils.cellRoot(reqCell) + reqPath;
            assertEquals(expected, location);

            BarInstallTestUtils.assertBarInstallStatus(location, SCHEMA_URL, ProgressInfo.STATUS.FAILED);
            // ??????????
            BarInstallTestUtils.propfind(reqCell, reqPath, "engine", AbstractCase.MASTER_TOKEN_NAME,
                    HttpStatus.SC_NOT_FOUND);
            BarInstallTestUtils.propfind(reqCell, reqPath, "svccol1", AbstractCase.MASTER_TOKEN_NAME,
                    HttpStatus.SC_NOT_FOUND);
        }

        /**
         * ?URL??Box??400????.
         */
        @Test
        public final void ? URL??Box??400 ????()
        {
            String reqCell = Setup.TEST_CELL1;
            String reqPath = INSTALL_TARGET;

            TResponse res = null;
            File barFile = new File(RESOURCE_PATH + BAR_FILE_MINIMUM);
            byte[] body = BarInstallTestUtils.readBarFile(barFile);
            Map<String, String> headers = new LinkedHashMap<String, String>();
            headers.put(HttpHeaders.CONTENT_TYPE, REQ_CONTENT_TYPE);
            headers.put(HttpHeaders.CONTENT_LENGTH, String.valueOf(body.length));

            // Box
            res = BarInstallTestUtils.request(REQUEST_NORM_FILE, reqCell, reqPath, headers, body);
            res.statusCode(HttpStatus.SC_ACCEPTED);
            String location = res.getHeader(HttpHeaders.LOCATION);
            String expected = UrlUtils.cellRoot(reqCell) + reqPath;
            assertEquals(expected, location);
            BarInstallTestUtils.assertBarInstallStatus(location, SCHEMA_URL, ProgressInfo.STATUS.COMPLETED);

            // Box???URL??Box????400
            res = BarInstallTestUtils.request(REQUEST_NORM_FILE, reqCell, "anotherBox", headers, body);
            res.statusCode(HttpStatus.SC_BAD_REQUEST);
            String code = DcCoreException.BarInstall.BAR_FILE_BOX_SCHEMA_ALREADY_EXISTS.getCode();
            String message = DcCoreException.BarInstall.BAR_FILE_BOX_SCHEMA_ALREADY_EXISTS
                    .params("https://fqdn/testcell1").getMessage();
            res.checkErrorResponse(code, message);
        }

        /**
         * ???Box?????URL??Box?????.
         */
        @Test
        public final void ???Box????? URL??Box?????()
        {
            String cell1Name = "barInstallTest_ownercell_1";
            String cell2Name = "barInstallTest_ownercell_2";
            String ownerName = "http://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";

            TResponse res = null;
            File barFile = new File(RESOURCE_PATH + BAR_FILE_MINIMUM);
            byte[] body = BarInstallTestUtils.readBarFile(barFile);
            Map<String, String> headers = new LinkedHashMap<String, String>();
            headers.put(HttpHeaders.CONTENT_TYPE, REQ_CONTENT_TYPE);
            headers.put(HttpHeaders.CONTENT_LENGTH, String.valueOf(body.length));

            try {
                // Cell?
                CellUtils.create(cell1Name, AbstractCase.MASTER_TOKEN_NAME, ownerName, HttpStatus.SC_CREATED);
                CellUtils.create(cell2Name, AbstractCase.MASTER_TOKEN_NAME, ownerName, HttpStatus.SC_CREATED);

                // Cell1??Box?
                BoxUtils.createWithScheme(cell1Name, INSTALL_TARGET, AbstractCase.MASTER_TOKEN_NAME, SCHEMA_URL);

                // ????Box???URL??Box??????Box??Box?Cell?????
                res = BarInstallTestUtils.request(REQUEST_NORM_FILE, cell2Name, INSTALL_TARGET, headers, body);
                res.statusCode(HttpStatus.SC_ACCEPTED);
                String location = res.getHeader(HttpHeaders.LOCATION);
                String expected = UrlUtils.cellRoot(cell2Name) + INSTALL_TARGET;
                assertEquals(expected, location);
                BarInstallTestUtils.assertBarInstallStatus(location, SCHEMA_URL, ProgressInfo.STATUS.COMPLETED);
                // ??Box??
                BoxUtils.get(cell2Name, AbstractCase.MASTER_TOKEN_NAME, INSTALL_TARGET, HttpStatus.SC_OK);
            } finally {
                Setup.cellBulkDeletion(cell1Name);
                Setup.cellBulkDeletion(cell2Name);
            }
        }

        private void createInstallTarget(String reqCellName, String userName, String password,
                Boolean isForbiddenUser) {
            // Cell?
            CellUtils.create(reqCellName, AbstractCase.MASTER_TOKEN_NAME, HttpStatus.SC_CREATED);
            // Account?
            AccountUtils.create(AbstractCase.MASTER_TOKEN_NAME, reqCellName, userName, password, HttpStatus.SC_CREATED);
            // Role?
            RoleUtils.create(reqCellName, AbstractCase.MASTER_TOKEN_NAME, "boxInstallTestRole", HttpStatus.SC_CREATED);
            // Account-Role $links?
            ResourceUtils.linkAccountRole(reqCellName, AbstractCase.MASTER_TOKEN_NAME, userName, null,
                    "boxInstallTestRole", HttpStatus.SC_NO_CONTENT);

            if (!isForbiddenUser) {
                // Box-install?
                Http.request("cell/acl-setting-single-request.txt").with("url", reqCellName)
                        .with("token", AbstractCase.MASTER_TOKEN_NAME)
                        .with("roleBaseUrl", UrlUtils.roleResource(reqCellName, null, ""))
                        .with("role", "boxInstallTestRole").with("privilege", "<D:box-install/>").returns()
                        .statusCode(HttpStatus.SC_OK);
            }
        }

        /**
         * ?????.
         * @param cellName Cell??
         * @param user user
         * @param password password
         * @return 
         */
        protected String getAccessToken(String cellName, String user, String password) {
            TResponse res = Http.request("authn/password-cl-c0.txt").with("remoteCell", cellName).with("username", user)
                    .with("password", password).returns().statusCode(HttpStatus.SC_OK);
            JSONObject json = res.bodyAsJson();
            String token = (String) json.get(OAuth2Helper.Key.ACCESS_TOKEN);
            return token;
        }

    }