You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@edgent.apache.org by dlaboss <gi...@git.apache.org> on 2016/03/21 23:30:28 UTC

[GitHub] incubator-quarks pull request: [QUARKS-52] fix test keystore path ...

GitHub user dlaboss opened a pull request:

    https://github.com/apache/incubator-quarks/pull/33

    [QUARKS-52] fix test keystore path formation on windows

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/dlaboss/incubator-quarks quarks-52-websocketclienttest

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-quarks/pull/33.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #33
    
----
commit a6fb910926cc78de102d1742789f8a8d3d627e63
Author: Dale LaBossiere <dl...@us.ibm.com>
Date:   2016-03-21T22:28:07Z

    [QUARKS-52] fix test keystore path formation on windows

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-quarks pull request: [QUARKS-52] fix test keystore path ...

Posted by ddebrunner <gi...@git.apache.org>.
Github user ddebrunner commented on a diff in the pull request:

    https://github.com/apache/incubator-quarks/pull/33#discussion_r56983931
  
    --- Diff: connectors/wsclient-javax.websocket/src/test/java/quarks/tests/connectors/wsclient/javax/websocket/KeystorePath.java ---
    @@ -5,22 +5,25 @@
     package quarks.tests.connectors.wsclient.javax.websocket;
     
     import java.io.File;
    +import java.nio.file.Path;
     
     public class KeystorePath {
         
         public static String getStorePath(String storeLeaf) {
    -        String path = System.getProperty("user.dir");
    +        String pathStr = System.getProperty("user.dir");
             // Under eclipse/junit: path to project in repo: <repo>/connectors
             // Under ant/junit: <repo>/connectors/<project>/unittests/testrunxxxxxxx
    -        if (!path.endsWith("/connectors")) {
    -            int indx = path.indexOf("/connectors/");
    -            indx += "/connectors/".length() - 1;
    -            path = path.substring(0, indx);
    -        }
    -        path += "/wsclient-javax.websocket/src/test/keystores/" + storeLeaf;
    -        if (!new File(path).exists())
    +        // Get the path to the <repo>/connectors
    +        Path path = new File(pathStr).toPath();
    +        do {
    +            if (path.endsWith("connectors"))
    +                break;
    +            path = path.getParent();
    +        } while (path.getNameCount() > 0);
    +        path = path.resolve("wsclient-javax.websocket/src/test/keystores/" + storeLeaf);
    --- End diff --
    
    Still, portable Java code should not assume '/' will work as a file separator. File.separatorChar.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-quarks pull request: [QUARKS-52] fix test keystore path ...

Posted by dlaboss <gi...@git.apache.org>.
Github user dlaboss commented on a diff in the pull request:

    https://github.com/apache/incubator-quarks/pull/33#discussion_r56978111
  
    --- Diff: connectors/wsclient-javax.websocket/src/test/java/quarks/tests/connectors/wsclient/javax/websocket/KeystorePath.java ---
    @@ -5,22 +5,25 @@
     package quarks.tests.connectors.wsclient.javax.websocket;
     
     import java.io.File;
    +import java.nio.file.Path;
     
     public class KeystorePath {
         
         public static String getStorePath(String storeLeaf) {
    -        String path = System.getProperty("user.dir");
    +        String pathStr = System.getProperty("user.dir");
             // Under eclipse/junit: path to project in repo: <repo>/connectors
             // Under ant/junit: <repo>/connectors/<project>/unittests/testrunxxxxxxx
    -        if (!path.endsWith("/connectors")) {
    -            int indx = path.indexOf("/connectors/");
    -            indx += "/connectors/".length() - 1;
    -            path = path.substring(0, indx);
    -        }
    -        path += "/wsclient-javax.websocket/src/test/keystores/" + storeLeaf;
    -        if (!new File(path).exists())
    +        // Get the path to the <repo>/connectors
    +        Path path = new File(pathStr).toPath();
    +        do {
    +            if (path.endsWith("connectors"))
    +                break;
    +            path = path.getParent();
    +        } while (path.getNameCount() > 0);
    +        path = path.resolve("wsclient-javax.websocket/src/test/keystores/" + storeLeaf);
    --- End diff --
    
    All is well as @kmarsden verified in https://issues.apache.org/jira/browse/QUARKS-52.  Windows is typically generous accepting both forms of separators.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-quarks pull request: [QUARKS-52] fix test keystore path ...

Posted by ddebrunner <gi...@git.apache.org>.
Github user ddebrunner commented on a diff in the pull request:

    https://github.com/apache/incubator-quarks/pull/33#discussion_r56913433
  
    --- Diff: connectors/wsclient-javax.websocket/src/test/java/quarks/tests/connectors/wsclient/javax/websocket/KeystorePath.java ---
    @@ -5,22 +5,25 @@
     package quarks.tests.connectors.wsclient.javax.websocket;
     
     import java.io.File;
    +import java.nio.file.Path;
     
     public class KeystorePath {
         
         public static String getStorePath(String storeLeaf) {
    -        String path = System.getProperty("user.dir");
    +        String pathStr = System.getProperty("user.dir");
             // Under eclipse/junit: path to project in repo: <repo>/connectors
             // Under ant/junit: <repo>/connectors/<project>/unittests/testrunxxxxxxx
    -        if (!path.endsWith("/connectors")) {
    -            int indx = path.indexOf("/connectors/");
    -            indx += "/connectors/".length() - 1;
    -            path = path.substring(0, indx);
    -        }
    -        path += "/wsclient-javax.websocket/src/test/keystores/" + storeLeaf;
    -        if (!new File(path).exists())
    +        // Get the path to the <repo>/connectors
    +        Path path = new File(pathStr).toPath();
    +        do {
    +            if (path.endsWith("connectors"))
    +                break;
    +            path = path.getParent();
    +        } while (path.getNameCount() > 0);
    +        path = path.resolve("wsclient-javax.websocket/src/test/keystores/" + storeLeaf);
    --- End diff --
    
    This will still be broken under Windows I think because the path separator is hard-coded for linux.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-quarks pull request: [QUARKS-52] fix test keystore path ...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/incubator-quarks/pull/33


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---