Example #1
0
  /** Test method. */
  @Test
  public void binaryEntry() {
    query(_ZIP_BINARY_ENTRY.args(ZIP, ENTRY1));
    contains("xs:hexBinary(" + _ZIP_BINARY_ENTRY.args(ZIP, ENTRY1) + ")", "610A61626F");

    error(_ZIP_BINARY_ENTRY.args("abc", "xyz"), Err.ZIP_NOTFOUND);
    error(_ZIP_BINARY_ENTRY.args(ZIP, ""), Err.ZIP_NOTFOUND);
  }
Example #2
0
  /**
   * Test method.
   *
   * @throws IOException I/O exception
   */
  @Test
  public void zipFile() throws IOException {
    // check first file
    query(_ZIP_ZIP_FILE.args(params("<entry name='one'/>")));
    checkEntry("one", new byte[0]);
    // check second file
    query(_ZIP_ZIP_FILE.args(params("<entry name='two'>!</entry>")));
    checkEntry("two", new byte[] {'!'});
    // check third file
    query(_ZIP_ZIP_FILE.args(params("<entry name='three' encoding='UTF-16'>!</entry>")));
    checkEntry("three", new byte[] {'\0', '!'});
    // check fourth file
    query(_ZIP_ZIP_FILE.args(params("<entry name='four' src='" + TMPFILE + "'/>")));
    checkEntry("four", new byte[] {'!'});
    // check fifth file
    query(_ZIP_ZIP_FILE.args(params("<entry src='" + TMPFILE + "'/>")));
    checkEntry(NAME + ".tmp", new byte[] {'!'});
    // check sixth file
    query(
        _ZIP_ZIP_FILE.args(params("<dir name='a'><entry name='b' src='" + TMPFILE + "'/></dir>")));
    checkEntry("a/b", new byte[] {'!'});

    // error: duplicate entry specified
    error(
        _ZIP_ZIP_FILE.args(
            params("<entry src='" + TMPFILE + "'/>" + "<entry src='" + TMPFILE + "'/>")),
        Err.ZIP_FAIL);
  }
Example #3
0
 /** Test query. */
 @Test
 public void duplicateXMLNamespace() {
   create(1);
   query("insert node attribute xml:space { 'preserve' } into /x", "");
   query(".", "<x xml:space='preserve'/>");
   error("insert node attribute xml:space { 'preserve' } into /x", UPATTDUPL_X);
 }
Example #4
0
 /** Test method. */
 @Test
 public void textEntry() {
   query(_ZIP_TEXT_ENTRY.args(ZIP, ENTRY1));
   query(_ZIP_TEXT_ENTRY.args(ZIP, ENTRY1, "US-ASCII"));
   error(_ZIP_TEXT_ENTRY.args(ZIP, ENTRY1, "xyz"), Err.ZIP_FAIL);
   // newlines are removed from the result..
   contains(_ZIP_TEXT_ENTRY.args(ZIP, ENTRY1), "aaboutab");
 }
Example #5
0
 /** Checks namespace declarations. */
 @Test
 public void renameNSCheck5() {
   error(
       "copy $a := <a xmlns:p='A' a='v'/> "
           + "modify rename node $a/@a as QName('uri', 'p:a') "
           + "return $a",
       UPNSCONFL_X_X);
 }
Example #6
0
 /** Checks namespace declarations. */
 @Test
 public void renameRemoveNS1() {
   error(
       "copy $a := <a xmlns='A'><b xmlns='B'/></a> "
           + "modify for $el in $a/descendant-or-self::element() return "
           + "rename node $el as QName('',local-name($el)) "
           + "return $a",
       UPNSCONFL_X_X);
 }
 /** raise errors on initialize. */
 @Test
 public void failure_init() {
   add("com.example.Simple");
   add("com.example.Mock");
   error(
       new OperatorAnnotationProcessor() {
         @Override
         protected CompileEnvironment createCompileEnvironment(
             ProcessingEnvironment processingEnv) {
           throw new RuntimeException();
         }
       });
 }
 /** raise errors on process. */
 @Test
 public void failure_process() {
   add(
       new Driver() {
         @Override
         public OperatorDescription analyze(Context context) {
           throw new RuntimeException();
         }
       });
   add("com.example.Simple");
   add("com.example.Mock");
   error(operatorProcessor());
 }
Example #9
0
 /** Test query. */
 @Test
 public void duplicateNamespaces() {
   query(
       "copy $c := <a xmlns='X'/> modify ("
           + "  rename node $c as QName('X','b'),"
           + "  insert node attribute c{'a'} into $c"
           + ") return $c",
       "<b xmlns=\"X\" c=\"a\"/>");
   error(
       "copy $c := <a xmlns='X'/> modify ("
           + "  rename node $c as QName('Y','b'),"
           + "  insert node attribute c{'a'} into $c"
           + ") return $c",
       UPNSCONFL_X_X);
   query(
       "copy $c := <a/> modify ("
           + "  rename node $c as QName('X','b'),"
           + "  insert node attribute c{'a'} into $c"
           + ") return $c",
       "<b xmlns=\"X\" c=\"a\"/>");
 }
 /** 空の列挙。 */
 @Test
 public void emptyEnum() {
   add("com.example.Empty");
   add("com.example.EmptyEnum");
   error(new BranchOperatorProcessor());
 }
 /** too many parameters. */
 @Test
 public void tooManyInput() {
   add("com.example.TooManyInput");
   error(new FoldOperatorProcessor());
 }
 /** less parameters. */
 @Test
 public void lessParameters() {
   add("com.example.LessParameters");
   error(new FoldOperatorProcessor());
 }
 /** not void type method. */
 @Test
 public void returns() {
   add("com.example.Returns");
   error(new FoldOperatorProcessor());
 }
 /** abstract method. */
 @Test
 public void isAbstract() {
   add("com.example.Abstract");
   error(new FoldOperatorProcessor());
 }
 /** missing key annotation. */
 @Test
 public void noKey() {
   add("com.example.NoKey");
   error(new FoldOperatorProcessor());
 }
 /** inconsistent type between the first and second parameter. */
 @Test
 public void inconsistentType() {
   add("com.example.InconsistentType");
   error(new FoldOperatorProcessor());
 }
 /** 非モデル。 */
 @Test
 public void notModel() {
   add("com.example.NotModel");
   add("com.example.EmptyEnum");
   error(new BranchOperatorProcessor());
 }
 /** 抽象メソッド。 */
 @Test
 public void _abstract() {
   add("com.example.Abstract");
   add("com.example.EmptyEnum");
   error(new BranchOperatorProcessor());
 }
 /** ユーザー定義パラメーターでない。 */
 @Test
 public void notUserParameter() {
   add("com.example.NotUserParameter");
   add("com.example.EmptyEnum");
   error(new BranchOperatorProcessor());
 }