nashorn/test/script/nosecurity/JDK-8050964.js
author sundar
Thu, 31 Jul 2014 18:14:46 +0530
changeset 25825 b97d77f4b98e
parent 25586 cac6440168e2
child 26067 b32ccc3a76c9
permissions -rw-r--r--
8053908: jdeps is not PATH on Mac, results in ant clean test failure on Mac Reviewed-by: hannesw, jlaskey
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
25586
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
     1
/*
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
     2
 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
     4
 * 
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
     7
 * published by the Free Software Foundation.
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
     8
 * 
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    13
 * accompanied this code).
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    14
 * 
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    18
 * 
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    21
 * questions.
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    22
 */
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    23
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    24
/**
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    25
 * JDK-8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    26
 *
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    27
 * Make sure that nashorn.jar has only 'compact1' dependency.
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    28
 *
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    29
 * @test
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    30
 * @option -scripting
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    31
 * @run
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    32
 */
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    33
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    34
// assume that this script is run with "nashorn.jar" System
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    35
// property set to relative path of nashorn.jar from the current
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    36
// directory of test execution.
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    37
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    38
if (typeof fail != 'function') {
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    39
    fail = print;
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    40
}
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    41
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    42
var System = java.lang.System;
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    43
var File = java.io.File;
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    44
var nashornJar = new File(System.getProperty("nashorn.jar"));
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    45
if (! nashornJar.isAbsolute()) {
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    46
    nashornJar = new File(".", nashornJar);
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    47
}
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    48
25825
b97d77f4b98e 8053908: jdeps is not PATH on Mac, results in ant clean test failure on Mac
sundar
parents: 25586
diff changeset
    49
var javahome = System.getProperty("java.home");
b97d77f4b98e 8053908: jdeps is not PATH on Mac, results in ant clean test failure on Mac
sundar
parents: 25586
diff changeset
    50
var jdepsPath = javahome + "/../bin/jdeps".replaceAll(/\//g, File.separater);
b97d77f4b98e 8053908: jdeps is not PATH on Mac, results in ant clean test failure on Mac
sundar
parents: 25586
diff changeset
    51
25586
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    52
// run jdep on nashorn.jar - only summary but print profile info
25825
b97d77f4b98e 8053908: jdeps is not PATH on Mac, results in ant clean test failure on Mac
sundar
parents: 25586
diff changeset
    53
`${jdepsPath} -s -P ${nashornJar.absolutePath}`
25586
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    54
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    55
// check for "(compact1)" in output from jdep tool
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    56
if (! /(compact1)/.test($OUT)) {
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    57
    fail("non-compact1 dependency: " + $OUT);
cac6440168e2 8050964: OptimisticTypesPersistence.java should use java.util.Date instead of java.sql.Date
sundar
parents:
diff changeset
    58
}