/**
   * Boolean検索のテスト用データを削除する.
   *
   * @param entityTypeName エンティティタイプ名
   */
  protected void deleteTestData(String entityTypeName) {
    // UserODataの削除
    UserDataUtils.delete(DcCoreConfig.getMasterToken(), -1, entityTypeName, "boolTrue", colName);
    UserDataUtils.delete(DcCoreConfig.getMasterToken(), -1, entityTypeName, "boolFalse", colName);
    UserDataUtils.delete(DcCoreConfig.getMasterToken(), -1, entityTypeName, "boolNull", colName);

    // EntityTypeの削除
    EntityTypeUtils.delete(
        colName,
        DcCoreConfig.getMasterToken(),
        MediaType.APPLICATION_JSON,
        entityTypeName,
        boxName,
        cellName,
        -1);
  }
  /**
   * Boolean検索のテスト用データを作成する.
   *
   * @param entityTypeName エンティティタイプ名
   */
  @SuppressWarnings("unchecked")
  protected void createTestData(String entityTypeName) {
    // Booleanの検索のテスト用エンティティタイプ作成
    EntityTypeUtils.create(
        cellName,
        DcCoreConfig.getMasterToken(),
        boxName,
        colName,
        entityTypeName,
        HttpStatus.SC_CREATED);

    // 真偽値が true / false / null のデータを作成
    JSONObject body = new JSONObject();
    body.put("__id", "boolTrue");
    body.put("bool", true);
    UserDataUtils.create(
        DcCoreConfig.getMasterToken(),
        HttpStatus.SC_CREATED,
        body,
        cellName,
        boxName,
        colName,
        entityTypeName);

    body.put("__id", "boolFalse");
    body.put("bool", false);
    UserDataUtils.create(
        DcCoreConfig.getMasterToken(),
        HttpStatus.SC_CREATED,
        body,
        cellName,
        boxName,
        colName,
        entityTypeName);

    body.put("__id", "boolNull");
    body.put("bool", null);
    UserDataUtils.create(
        DcCoreConfig.getMasterToken(),
        HttpStatus.SC_CREATED,
        body,
        cellName,
        boxName,
        colName,
        entityTypeName);
  }
 /** UserDataにboolean型のPropertyに範囲検索クエリを指定した場合_400エラーとなること. */
 @Test
 public final void UserDataにboolean型のPropertyに範囲検索クエリを指定した場合_400エラーとなること() {
   String sdEntityTypeName = "SalesDetail";
   // ユーザデータの一覧取得
   Http.request("box/odatacol/list.txt")
       .with("cell", cellName)
       .with("box", boxName)
       .with("collection", colName)
       .with("entityType", sdEntityTypeName)
       .with("query", "?\\$filter=truth+ge+true&\\$inlinecount=allpages")
       .with("accept", MediaType.APPLICATION_JSON)
       .with("token", DcCoreConfig.getMasterToken())
       .returns()
       .statusCode(HttpStatus.SC_BAD_REQUEST)
       .debug();
 }
  /** UserDataに部分一致検索クエリに真偽値falseを指定した場合ステータスコード400が返却されること. */
  @Test
  public final void UserDataに部分一致検索クエリに真偽値falseを指定した場合ステータスコード400が返却されること() {
    // ユーザデータの一覧取得
    String sdEntityTypeName = "SalesDetail";

    Http.request("box/odatacol/list.txt")
        .with("cell", cellName)
        .with("box", boxName)
        .with("collection", colName)
        .with("entityType", sdEntityTypeName)
        .with("query", "?\\$filter=substringof%28false%2ctruth%29")
        .with("accept", MediaType.APPLICATION_JSON)
        .with("token", DcCoreConfig.getMasterToken())
        .returns()
        .statusCode(HttpStatus.SC_BAD_REQUEST)
        .debug();
  }
Esempio n. 5
0
  /**
   * PropertyをEntityTypeからのNP経由で登録する.
   *
   * @param token トークン
   * @param cell セル名
   * @param box ボックス名
   * @param collection コレクション名
   * @param entityTypeName EntityType名
   * @param propertyName Property名
   * @param type PropertyのType項目
   * @param nullable PropertyのNullable項目
   * @param defaultValue PropertyのDefaultValue項目
   * @param collectionKind PropertyのcollectionKind項目
   * @param isKey PropertyのisKey項目
   * @param uniqueKey PropertyのUniqueKey項目
   * @param code 期待するレスポンスコード
   * @return レスポンス
   */
  @SuppressWarnings("unchecked")
  public static TResponse createViaPropertyNP(
      String token,
      String cell,
      String box,
      String collection,
      String entityTypeName,
      String propertyName,
      String type,
      Boolean nullable,
      String defaultValue,
      String collectionKind,
      Boolean isKey,
      String uniqueKey,
      int code) {

    // リクエストボディの組み立て
    JSONObject body = new JSONObject();
    body.put("Name", propertyName);
    body.put("_EntityType.Name", entityTypeName);
    body.put("Type", type);
    body.put("Nullable", nullable);
    body.put("DefaultValue", defaultValue);
    body.put("CollectionKind", collectionKind);
    body.put("IsKey", isKey);
    body.put("UniqueKey", uniqueKey);

    TResponse res =
        Http.request("box/odatacol/schema/createViaNP.txt")
            .with("cell", cell)
            .with("box", box)
            .with("collection", collection)
            .with("accept", MediaType.APPLICATION_JSON)
            .with("contentType", MediaType.APPLICATION_JSON)
            .with("token", DcCoreConfig.getMasterToken())
            .with("entityType", "EntityType")
            .with("id", entityTypeName)
            .with("navPropName", "_Property")
            .with("body", body.toJSONString())
            .returns()
            .statusCode(code)
            .debug();
    return res;
  }