Re: RFR: JDK-8224597: create automated tests for platform create-app-image options

2019-06-11 Thread Andy Herrick

looks good.

/Andy


On 6/10/2019 10:24 PM, Alexander Matveev wrote:

http://cr.openjdk.java.net/~almatvee/8224597/webrev.03/

- Tests are updated to use DOM+XPath.

Thanks,
Alexander

On 6/10/2019 5:41 PM, Alexey Semenyuk wrote:
I agree that SAX/StAX are faster and more memory efficient compared 
to DOM. But the use case is just to query a string from 2Kb XML file. 
in this scenario use of DOM+XPath results in less coding with a tiny 
performance degradation. Does this sound reasonable?


- Alexey

On 6/7/2019 7:09 PM, Semyon Sadetsky wrote:

On 6/7/19 9:52 AM, Alexey Semenyuk wrote:

Not quite exactly what I meant by suggesting to use xml api. Sorry 
for not being specific. With DOM and Xpath this can be as simple as 
the following:


XPath is DOM based = slow. That point is not clear.

--Semyon



---
package sample;

import java.io.FileInputStream;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathFactory;

public class Sample {
    public static void main(String[] args) throws Exception {
    DocumentBuilder b = 
DocumentBuilderFactory.newDefaultInstance().newDocumentBuilder();
    org.w3c.dom.Document doc = b.parse(new 
FileInputStream(args[0]));


    XPath xPath = XPathFactory.newInstance().newXPath();
    // Query for the value of  element preceding  
element

    // with value equal to CFBundleIdentifier
    String v = 
(String)xPath.evaluate("//string[preceding-sibling::key = 
\"CFBundleIdentifier\"][1]", doc, XPathConstants.STRING);


    if (!v.equals(args[1])) {
    throw new AssertionError("Unexpected value of 
CFBundleIdentifier key: [" + v + "]. Expected value: [" + args[1] + 
"]");

    }
    }
}
---

Running the sample:
java sample.Sample 
jp_sandbox\jdk\open\src\jdk.jpackage\macosx\classes\jdk\jpackage\internal\resources\Info-lite.plist.template 
foo
Exception in thread "main" java.lang.AssertionError: Unexpected 
value of CFBundleIdentifier key: [DEPLOY_BUNDLE_IDENTIFIER]. 
Expected value: [foo]

    at sample.Sample.main(Sample.java:25)

java sample.Sample 
jp_sandbox\jdk\open\src\jdk.jpackage\macosx\classes\jdk\jpackage\internal\resources\Info-lite.plist.templateDEPLOY_BUNDLE_IDENTIFIER


- Alexey

On 6/6/2019 10:56 PM, Alexander Matveev wrote:

http://cr.openjdk.java.net/~almatvee/8224597/webrev.02/

Updated OS X tests to use XML APIs to parse Info.plist.

Thanks,
Alexander

On 6/6/2019 2:43 PM, Alexey Semenyuk wrote:

Any particular reason not to use xml api to read xml files?
The way to extract app attributes from xml files produced by 
jpackage looks fragile.


- Alexey

On 6/6/2019 5:37 PM, Alexander Matveev wrote:

Please review the jpackage fix for bug [1] at [2].

This is a fix for the JDK-8200758-branch branch of the open 
sandbox repository (jpackage).


- Added tests for --win-console, --mac-bundle-identifier and 
--mac-bundle-name.


[1] https://bugs.openjdk.java.net/browse/JDK-8224597
[2] http://cr.openjdk.java.net/~almatvee/8224597/webrev.00/

Thanks,
Alexander














Re: RFR: JDK-8224597: create automated tests for platform create-app-image options

2019-06-10 Thread Alexander Matveev

http://cr.openjdk.java.net/~almatvee/8224597/webrev.03/

- Tests are updated to use DOM+XPath.

Thanks,
Alexander

On 6/10/2019 5:41 PM, Alexey Semenyuk wrote:
I agree that SAX/StAX are faster and more memory efficient compared to 
DOM. But the use case is just to query a string from 2Kb XML file. in 
this scenario use of DOM+XPath results in less coding with a tiny 
performance degradation. Does this sound reasonable?


- Alexey

On 6/7/2019 7:09 PM, Semyon Sadetsky wrote:

On 6/7/19 9:52 AM, Alexey Semenyuk wrote:

Not quite exactly what I meant by suggesting to use xml api. Sorry 
for not being specific. With DOM and Xpath this can be as simple as 
the following:


XPath is DOM based = slow. That point is not clear.

--Semyon



---
package sample;

import java.io.FileInputStream;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathFactory;

public class Sample {
    public static void main(String[] args) throws Exception {
    DocumentBuilder b = 
DocumentBuilderFactory.newDefaultInstance().newDocumentBuilder();
    org.w3c.dom.Document doc = b.parse(new 
FileInputStream(args[0]));


    XPath xPath = XPathFactory.newInstance().newXPath();
    // Query for the value of  element preceding  
element

    // with value equal to CFBundleIdentifier
    String v = 
(String)xPath.evaluate("//string[preceding-sibling::key = 
\"CFBundleIdentifier\"][1]", doc, XPathConstants.STRING);


    if (!v.equals(args[1])) {
    throw new AssertionError("Unexpected value of 
CFBundleIdentifier key: [" + v + "]. Expected value: [" + args[1] + 
"]");

    }
    }
}
---

Running the sample:
java sample.Sample 
jp_sandbox\jdk\open\src\jdk.jpackage\macosx\classes\jdk\jpackage\internal\resources\Info-lite.plist.template 
foo
Exception in thread "main" java.lang.AssertionError: Unexpected 
value of CFBundleIdentifier key: [DEPLOY_BUNDLE_IDENTIFIER]. 
Expected value: [foo]

    at sample.Sample.main(Sample.java:25)

java sample.Sample 
jp_sandbox\jdk\open\src\jdk.jpackage\macosx\classes\jdk\jpackage\internal\resources\Info-lite.plist.templateDEPLOY_BUNDLE_IDENTIFIER


- Alexey

On 6/6/2019 10:56 PM, Alexander Matveev wrote:

http://cr.openjdk.java.net/~almatvee/8224597/webrev.02/

Updated OS X tests to use XML APIs to parse Info.plist.

Thanks,
Alexander

On 6/6/2019 2:43 PM, Alexey Semenyuk wrote:

Any particular reason not to use xml api to read xml files?
The way to extract app attributes from xml files produced by 
jpackage looks fragile.


- Alexey

On 6/6/2019 5:37 PM, Alexander Matveev wrote:

Please review the jpackage fix for bug [1] at [2].

This is a fix for the JDK-8200758-branch branch of the open 
sandbox repository (jpackage).


- Added tests for --win-console, --mac-bundle-identifier and 
--mac-bundle-name.


[1] https://bugs.openjdk.java.net/browse/JDK-8224597
[2] http://cr.openjdk.java.net/~almatvee/8224597/webrev.00/

Thanks,
Alexander












Re: RFR: JDK-8224597: create automated tests for platform create-app-image options

2019-06-10 Thread Alexey Semenyuk
I agree that SAX/StAX are faster and more memory efficient compared to 
DOM. But the use case is just to query a string from 2Kb XML file. in 
this scenario use of DOM+XPath results in less coding with a tiny 
performance degradation. Does this sound reasonable?


- Alexey

On 6/7/2019 7:09 PM, Semyon Sadetsky wrote:

On 6/7/19 9:52 AM, Alexey Semenyuk wrote:

Not quite exactly what I meant by suggesting to use xml api. Sorry 
for not being specific. With DOM and Xpath this can be as simple as 
the following:


XPath is DOM based = slow. That point is not clear.

--Semyon



---
package sample;

import java.io.FileInputStream;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathFactory;

public class Sample {
    public static void main(String[] args) throws Exception {
    DocumentBuilder b = 
DocumentBuilderFactory.newDefaultInstance().newDocumentBuilder();
    org.w3c.dom.Document doc = b.parse(new 
FileInputStream(args[0]));


    XPath xPath = XPathFactory.newInstance().newXPath();
    // Query for the value of  element preceding  
element

    // with value equal to CFBundleIdentifier
    String v = 
(String)xPath.evaluate("//string[preceding-sibling::key = 
\"CFBundleIdentifier\"][1]", doc, XPathConstants.STRING);


    if (!v.equals(args[1])) {
    throw new AssertionError("Unexpected value of 
CFBundleIdentifier key: [" + v + "]. Expected value: [" + args[1] + 
"]");

    }
    }
}
---

Running the sample:
java sample.Sample 
jp_sandbox\jdk\open\src\jdk.jpackage\macosx\classes\jdk\jpackage\internal\resources\Info-lite.plist.template 
foo
Exception in thread "main" java.lang.AssertionError: Unexpected value 
of CFBundleIdentifier key: [DEPLOY_BUNDLE_IDENTIFIER]. Expected 
value: [foo]

    at sample.Sample.main(Sample.java:25)

java sample.Sample 
jp_sandbox\jdk\open\src\jdk.jpackage\macosx\classes\jdk\jpackage\internal\resources\Info-lite.plist.templateDEPLOY_BUNDLE_IDENTIFIER


- Alexey

On 6/6/2019 10:56 PM, Alexander Matveev wrote:

http://cr.openjdk.java.net/~almatvee/8224597/webrev.02/

Updated OS X tests to use XML APIs to parse Info.plist.

Thanks,
Alexander

On 6/6/2019 2:43 PM, Alexey Semenyuk wrote:

Any particular reason not to use xml api to read xml files?
The way to extract app attributes from xml files produced by 
jpackage looks fragile.


- Alexey

On 6/6/2019 5:37 PM, Alexander Matveev wrote:

Please review the jpackage fix for bug [1] at [2].

This is a fix for the JDK-8200758-branch branch of the open 
sandbox repository (jpackage).


- Added tests for --win-console, --mac-bundle-identifier and 
--mac-bundle-name.


[1] https://bugs.openjdk.java.net/browse/JDK-8224597
[2] http://cr.openjdk.java.net/~almatvee/8224597/webrev.00/

Thanks,
Alexander










Re: RFR: JDK-8224597: create automated tests for platform create-app-image options

2019-06-07 Thread Semyon Sadetsky

On 6/7/19 9:52 AM, Alexey Semenyuk wrote:

Not quite exactly what I meant by suggesting to use xml api. Sorry for 
not being specific. With DOM and Xpath this can be as simple as the 
following:


XPath is DOM based = slow. That point is not clear.

--Semyon



---
package sample;

import java.io.FileInputStream;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathFactory;

public class Sample {
    public static void main(String[] args) throws Exception {
    DocumentBuilder b = 
DocumentBuilderFactory.newDefaultInstance().newDocumentBuilder();

    org.w3c.dom.Document doc = b.parse(new FileInputStream(args[0]));

    XPath xPath = XPathFactory.newInstance().newXPath();
    // Query for the value of  element preceding  
element

    // with value equal to CFBundleIdentifier
    String v = 
(String)xPath.evaluate("//string[preceding-sibling::key = 
\"CFBundleIdentifier\"][1]", doc, XPathConstants.STRING);


    if (!v.equals(args[1])) {
    throw new AssertionError("Unexpected value of 
CFBundleIdentifier key: [" + v + "]. Expected value: [" + args[1] + "]");

    }
    }
}
---

Running the sample:
java sample.Sample 
jp_sandbox\jdk\open\src\jdk.jpackage\macosx\classes\jdk\jpackage\internal\resources\Info-lite.plist.template 
foo
Exception in thread "main" java.lang.AssertionError: Unexpected value 
of CFBundleIdentifier key: [DEPLOY_BUNDLE_IDENTIFIER]. Expected value: 
[foo]

    at sample.Sample.main(Sample.java:25)

java sample.Sample 
jp_sandbox\jdk\open\src\jdk.jpackage\macosx\classes\jdk\jpackage\internal\resources\Info-lite.plist.templateDEPLOY_BUNDLE_IDENTIFIER


- Alexey

On 6/6/2019 10:56 PM, Alexander Matveev wrote:

http://cr.openjdk.java.net/~almatvee/8224597/webrev.02/

Updated OS X tests to use XML APIs to parse Info.plist.

Thanks,
Alexander

On 6/6/2019 2:43 PM, Alexey Semenyuk wrote:

Any particular reason not to use xml api to read xml files?
The way to extract app attributes from xml files produced by 
jpackage looks fragile.


- Alexey

On 6/6/2019 5:37 PM, Alexander Matveev wrote:

Please review the jpackage fix for bug [1] at [2].

This is a fix for the JDK-8200758-branch branch of the open sandbox 
repository (jpackage).


- Added tests for --win-console, --mac-bundle-identifier and 
--mac-bundle-name.


[1] https://bugs.openjdk.java.net/browse/JDK-8224597
[2] http://cr.openjdk.java.net/~almatvee/8224597/webrev.00/

Thanks,
Alexander








Re: RFR: JDK-8224597: create automated tests for platform create-app-image options

2019-06-07 Thread Alexey Semenyuk
Not quite exactly what I meant by suggesting to use xml api. Sorry for 
not being specific. With DOM and Xpath this can be as simple as the 
following:

---
package sample;

import java.io.FileInputStream;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathFactory;

public class Sample {
    public static void main(String[] args) throws Exception {
    DocumentBuilder b = 
DocumentBuilderFactory.newDefaultInstance().newDocumentBuilder();

    org.w3c.dom.Document doc = b.parse(new FileInputStream(args[0]));

    XPath xPath = XPathFactory.newInstance().newXPath();
    // Query for the value of  element preceding  element
    // with value equal to CFBundleIdentifier
    String v = 
(String)xPath.evaluate("//string[preceding-sibling::key = 
\"CFBundleIdentifier\"][1]", doc, XPathConstants.STRING);


    if (!v.equals(args[1])) {
    throw new AssertionError("Unexpected value of 
CFBundleIdentifier key: [" + v + "]. Expected value: [" + args[1] + "]");

    }
    }
}
---

Running the sample:
java sample.Sample 
jp_sandbox\jdk\open\src\jdk.jpackage\macosx\classes\jdk\jpackage\internal\resources\Info-lite.plist.template 
foo
Exception in thread "main" java.lang.AssertionError: Unexpected value of 
CFBundleIdentifier key: [DEPLOY_BUNDLE_IDENTIFIER]. Expected value: [foo]

    at sample.Sample.main(Sample.java:25)

java sample.Sample 
jp_sandbox\jdk\open\src\jdk.jpackage\macosx\classes\jdk\jpackage\internal\resources\Info-lite.plist.templateDEPLOY_BUNDLE_IDENTIFIER


- Alexey

On 6/6/2019 10:56 PM, Alexander Matveev wrote:

http://cr.openjdk.java.net/~almatvee/8224597/webrev.02/

Updated OS X tests to use XML APIs to parse Info.plist.

Thanks,
Alexander

On 6/6/2019 2:43 PM, Alexey Semenyuk wrote:

Any particular reason not to use xml api to read xml files?
The way to extract app attributes from xml files produced by jpackage 
looks fragile.


- Alexey

On 6/6/2019 5:37 PM, Alexander Matveev wrote:

Please review the jpackage fix for bug [1] at [2].

This is a fix for the JDK-8200758-branch branch of the open sandbox 
repository (jpackage).


- Added tests for --win-console, --mac-bundle-identifier and 
--mac-bundle-name.


[1] https://bugs.openjdk.java.net/browse/JDK-8224597
[2] http://cr.openjdk.java.net/~almatvee/8224597/webrev.00/

Thanks,
Alexander








Re: RFR: JDK-8224597: create automated tests for platform create-app-image options

2019-06-06 Thread Alexander Matveev

http://cr.openjdk.java.net/~almatvee/8224597/webrev.02/

Updated OS X tests to use XML APIs to parse Info.plist.

Thanks,
Alexander

On 6/6/2019 2:43 PM, Alexey Semenyuk wrote:

Any particular reason not to use xml api to read xml files?
The way to extract app attributes from xml files produced by jpackage 
looks fragile.


- Alexey

On 6/6/2019 5:37 PM, Alexander Matveev wrote:

Please review the jpackage fix for bug [1] at [2].

This is a fix for the JDK-8200758-branch branch of the open sandbox 
repository (jpackage).


- Added tests for --win-console, --mac-bundle-identifier and 
--mac-bundle-name.


[1] https://bugs.openjdk.java.net/browse/JDK-8224597
[2] http://cr.openjdk.java.net/~almatvee/8224597/webrev.00/

Thanks,
Alexander






Re: RFR: JDK-8224597: create automated tests for platform create-app-image options

2019-06-06 Thread Andy Herrick

looks good to me.

/Andy


On 6/6/2019 5:37 PM, Alexander Matveev wrote:

Please review the jpackage fix for bug [1] at [2].

This is a fix for the JDK-8200758-branch branch of the open sandbox 
repository (jpackage).


- Added tests for --win-console, --mac-bundle-identifier and 
--mac-bundle-name.


[1] https://bugs.openjdk.java.net/browse/JDK-8224597
[2] http://cr.openjdk.java.net/~almatvee/8224597/webrev.00/

Thanks,
Alexander




Re: RFR: JDK-8224597: create automated tests for platform create-app-image options

2019-06-06 Thread Alexey Semenyuk

Any particular reason not to use xml api to read xml files?
The way to extract app attributes from xml files produced by jpackage 
looks fragile.


- Alexey

On 6/6/2019 5:37 PM, Alexander Matveev wrote:

Please review the jpackage fix for bug [1] at [2].

This is a fix for the JDK-8200758-branch branch of the open sandbox 
repository (jpackage).


- Added tests for --win-console, --mac-bundle-identifier and 
--mac-bundle-name.


[1] https://bugs.openjdk.java.net/browse/JDK-8224597
[2] http://cr.openjdk.java.net/~almatvee/8224597/webrev.00/

Thanks,
Alexander