[jira] [Commented] (CB-11926) File-transfer tests should be able to use local file server

2016-12-07 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-11926?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15730581#comment-15730581
 ] 

ASF subversion and git services commented on CB-11926:
--

Commit e68f766639602cd84f72f77d51384b4b20570169 in 
cordova-plugin-file-transfer's branch refs/heads/1.6.x from [~alsorokin]
[ 
https://git-wip-us.apache.org/repos/asf?p=cordova-plugin-file-transfer.git;h=e68f766
 ]

CB-11926 Tests can use local server


> File-transfer tests should be able to use local file server
> ---
>
> Key: CB-11926
> URL: https://issues.apache.org/jira/browse/CB-11926
> Project: Apache Cordova
>  Issue Type: Test
>  Components: Paramedic, Plugin File Transfer
>Reporter: Alexander Sorokin
>Assignee: Alexander Sorokin
>Priority: Minor
>  Labels: triaged
>
> File-transfer tests should be able to use locally running file server instead 
> of relying only on Apache infrastructure.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-11926) File-transfer tests should be able to use local file server

2016-10-04 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-11926?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15546447#comment-15546447
 ] 

ASF subversion and git services commented on CB-11926:
--

Commit bd04d5f532e30c0f7c3a773eff7944d705b9fb15 in cordova-paramedic's branch 
refs/heads/master from [~alsorokin]
[ https://git-wip-us.apache.org/repos/asf?p=cordova-paramedic.git;h=bd04d5f ]

CB-11926 Pass the file transfer server address to the tests via variable


> File-transfer tests should be able to use local file server
> ---
>
> Key: CB-11926
> URL: https://issues.apache.org/jira/browse/CB-11926
> Project: Apache Cordova
>  Issue Type: Test
>  Components: Paramedic, Plugin File Transfer
>Reporter: Alexander Sorokin
>Assignee: Alexander Sorokin
>Priority: Minor
>  Labels: triaged
>
> File-transfer tests should be able to use locally running file server instead 
> of relying only on Apache infrastructure.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-11926) File-transfer tests should be able to use local file server

2016-10-04 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-11926?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15546437#comment-15546437
 ] 

ASF GitHub Bot commented on CB-11926:
-

Github user asfgit closed the pull request at:

https://github.com/apache/cordova-plugin-file-transfer/pull/159


> File-transfer tests should be able to use local file server
> ---
>
> Key: CB-11926
> URL: https://issues.apache.org/jira/browse/CB-11926
> Project: Apache Cordova
>  Issue Type: Test
>  Components: Paramedic, Plugin File Transfer
>Reporter: Alexander Sorokin
>Assignee: Alexander Sorokin
>Priority: Minor
>  Labels: triaged
>
> File-transfer tests should be able to use locally running file server instead 
> of relying only on Apache infrastructure.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-11926) File-transfer tests should be able to use local file server

2016-10-04 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-11926?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15546434#comment-15546434
 ] 

ASF subversion and git services commented on CB-11926:
--

Commit e68f766639602cd84f72f77d51384b4b20570169 in 
cordova-plugin-file-transfer's branch refs/heads/master from [~alsorokin]
[ 
https://git-wip-us.apache.org/repos/asf?p=cordova-plugin-file-transfer.git;h=e68f766
 ]

CB-11926 Tests can use local server


> File-transfer tests should be able to use local file server
> ---
>
> Key: CB-11926
> URL: https://issues.apache.org/jira/browse/CB-11926
> Project: Apache Cordova
>  Issue Type: Test
>  Components: Paramedic, Plugin File Transfer
>Reporter: Alexander Sorokin
>Assignee: Alexander Sorokin
>Priority: Minor
>  Labels: triaged
>
> File-transfer tests should be able to use locally running file server instead 
> of relying only on Apache infrastructure.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-11926) File-transfer tests should be able to use local file server

2016-10-04 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-11926?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15544968#comment-15544968
 ] 

ASF GitHub Bot commented on CB-11926:
-

Github user vladimir-kotikov commented on a diff in the pull request:

https://github.com/apache/cordova-paramedic/pull/17#discussion_r81724529
  
--- Diff: lib/PluginsManager.js ---
@@ -41,16 +43,31 @@ PluginsManager.prototype.installTestsForExistingPlugins 
= function () {
 installedPlugins.forEach(function(plugin) {
 // there is test plugin available
 if (fs.existsSync(path.join(plugin.dir, 'tests', 'plugin.xml'))) {
-me.installSinglePlugin(path.join(plugin.dir, 'tests'));
+var additionalArgs = '';
+if (plugin.id.indexOf('cordova-plugin-file-transfer') >= 0) {
+var fileServerUrl = 
Server.prototype.getConnectionAddress.bind({
+externalServerUrl: me.config.getExternalServerUrl()
+}, me.config.getPlatformId())() + ':5000';
+additionalArgs += ' --variable 
FILETRANSFER_SERVER_ADDRESS=' + fileServerUrl;
+}
+me.installSinglePlugin(path.join(plugin.dir, 'tests') + 
additionalArgs);
 }
 });
 // this will list installed plugins and their versions
 this.showPluginsVersions();
 };
 
 PluginsManager.prototype.installSinglePlugin = function (plugin) {
-if (fs.existsSync(path.resolve(this.storedCWD, plugin))) {
-plugin = path.resolve(this.storedCWD, plugin);
+var pluginPath = plugin;
+var args = '';
+// separate plugin name from args
+var argsIndex = plugin.indexOf(' --');
--- End diff --

Ah, I see. I think you can leave it here but it's worth documenting. Also 
please add a note to 'paramedic.js', clarifying that we now support passing 
args to `cordova plugin add`


> File-transfer tests should be able to use local file server
> ---
>
> Key: CB-11926
> URL: https://issues.apache.org/jira/browse/CB-11926
> Project: Apache Cordova
>  Issue Type: Test
>  Components: Paramedic, Plugin File Transfer
>Reporter: Alexander Sorokin
>Assignee: Alexander Sorokin
>Priority: Minor
>  Labels: triaged
>
> File-transfer tests should be able to use locally running file server instead 
> of relying only on Apache infrastructure.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-11926) File-transfer tests should be able to use local file server

2016-10-04 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-11926?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15544939#comment-15544939
 ] 

ASF GitHub Bot commented on CB-11926:
-

Github user vladimir-kotikov commented on a diff in the pull request:


https://github.com/apache/cordova-plugin-file-transfer/pull/159#discussion_r81722419
  
--- Diff: tests/hooks/after_prepare.js ---
@@ -0,0 +1,71 @@
+#!/usr/bin/env node
+
+/*
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*   http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied.  See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*
+*/
+
+var path = require('path');
+var fs = require('fs');
+
+module.exports = function(context) {
+function main() {
+// get the file transfer server address from the specified 
variables
+var defaultFileTransferServerAddress = 
getDefaultFileTransferServerAddress(context);
+var fileTransferServerAddress = 
getFileTransferServerAddress(context) || defaultFileTransferServerAddress;
+console.log('Tests will use the following file transfer server 
address: ' + fileTransferServerAddress);
+
+// pass it to the tests
+writeFileTransferOptions(fileTransferServerAddress, context);
+}
+
+function getDefaultFileTransferServerAddress(context) {
--- End diff --

This is odd, because after running this: `cordova plugin add 
https://github.com/alsorokin/cordova-plugin-file-transfer#ca293bd3f29dc74f628721a552ff91593380d81e:tests`
 _(notice that i didn't specify any variables)_, i can see these lines in 
`platforms/windows/windows.json`:
```json
"cordova-plugin-file-transfer-tests": {
"FILETRANSFER_SERVER_ADDRESS": 
"http://cordova-vm.apache.org:5000;,
"PACKAGE_NAME": "HelloCordova"
}
```

Could you please double-check


> File-transfer tests should be able to use local file server
> ---
>
> Key: CB-11926
> URL: https://issues.apache.org/jira/browse/CB-11926
> Project: Apache Cordova
>  Issue Type: Test
>  Components: Paramedic, Plugin File Transfer
>Reporter: Alexander Sorokin
>Assignee: Alexander Sorokin
>Priority: Minor
>  Labels: triaged
>
> File-transfer tests should be able to use locally running file server instead 
> of relying only on Apache infrastructure.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-11926) File-transfer tests should be able to use local file server

2016-10-04 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-11926?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15544940#comment-15544940
 ] 

ASF GitHub Bot commented on CB-11926:
-

Github user alsorokin commented on a diff in the pull request:


https://github.com/apache/cordova-plugin-file-transfer/pull/159#discussion_r81722427
  
--- Diff: tests/hooks/after_prepare.js ---
@@ -0,0 +1,71 @@
+#!/usr/bin/env node
+
+/*
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*   http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied.  See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*
+*/
+
+var path = require('path');
+var fs = require('fs');
+
+module.exports = function(context) {
+function main() {
+// get the file transfer server address from the specified 
variables
+var defaultFileTransferServerAddress = 
getDefaultFileTransferServerAddress(context);
+var fileTransferServerAddress = 
getFileTransferServerAddress(context) || defaultFileTransferServerAddress;
+console.log('Tests will use the following file transfer server 
address: ' + fileTransferServerAddress);
+
+// pass it to the tests
+writeFileTransferOptions(fileTransferServerAddress, context);
+}
+
+function getDefaultFileTransferServerAddress(context) {
+var address = null;
+var configNodes = 
context.opts.plugin.pluginInfo._et._root._children;
+
+for (var node in configNodes) {
+if (configNodes[node].attrib.name == 
'FILETRANSFER_SERVER_ADDRESS') {
+address = configNodes[node].attrib.default;
+}
+}
+
+return address;
+}
+
+function getFileTransferServerAddress(context) {
+var platformJsonFile = path.join(context.opts.projectRoot, 
'plugins', context.opts.platforms[0] + '.json');
--- End diff --

Well, I don't see a way to get the path to it from the context.
Here's what I got:
https://gist.github.com/alsorokin/45f16a4c098a21082ee457157407ac8a


> File-transfer tests should be able to use local file server
> ---
>
> Key: CB-11926
> URL: https://issues.apache.org/jira/browse/CB-11926
> Project: Apache Cordova
>  Issue Type: Test
>  Components: Paramedic, Plugin File Transfer
>Reporter: Alexander Sorokin
>Assignee: Alexander Sorokin
>Priority: Minor
>  Labels: triaged
>
> File-transfer tests should be able to use locally running file server instead 
> of relying only on Apache infrastructure.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-11926) File-transfer tests should be able to use local file server

2016-10-04 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-11926?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15544911#comment-15544911
 ] 

ASF GitHub Bot commented on CB-11926:
-

Github user alsorokin commented on a diff in the pull request:

https://github.com/apache/cordova-paramedic/pull/17#discussion_r81720400
  
--- Diff: lib/PluginsManager.js ---
@@ -41,16 +43,31 @@ PluginsManager.prototype.installTestsForExistingPlugins 
= function () {
 installedPlugins.forEach(function(plugin) {
 // there is test plugin available
 if (fs.existsSync(path.join(plugin.dir, 'tests', 'plugin.xml'))) {
-me.installSinglePlugin(path.join(plugin.dir, 'tests'));
+var additionalArgs = '';
+if (plugin.id.indexOf('cordova-plugin-file-transfer') >= 0) {
+var fileServerUrl = 
Server.prototype.getConnectionAddress.bind({
+externalServerUrl: me.config.getExternalServerUrl()
+}, me.config.getPlatformId())() + ':5000';
+additionalArgs += ' --variable 
FILETRANSFER_SERVER_ADDRESS=' + fileServerUrl;
+}
+me.installSinglePlugin(path.join(plugin.dir, 'tests') + 
additionalArgs);
 }
 });
 // this will list installed plugins and their versions
 this.showPluginsVersions();
 };
 
 PluginsManager.prototype.installSinglePlugin = function (plugin) {
-if (fs.existsSync(path.resolve(this.storedCWD, plugin))) {
-plugin = path.resolve(this.storedCWD, plugin);
+var pluginPath = plugin;
+var args = '';
+// separate plugin name from args
+var argsIndex = plugin.indexOf(' --');
--- End diff --

So basically this logic is still needed but can be moved out of this 
function to `paramedic.js`
Which option is preferable?


> File-transfer tests should be able to use local file server
> ---
>
> Key: CB-11926
> URL: https://issues.apache.org/jira/browse/CB-11926
> Project: Apache Cordova
>  Issue Type: Test
>  Components: Paramedic, Plugin File Transfer
>Reporter: Alexander Sorokin
>Assignee: Alexander Sorokin
>Priority: Minor
>  Labels: triaged
>
> File-transfer tests should be able to use locally running file server instead 
> of relying only on Apache infrastructure.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-11926) File-transfer tests should be able to use local file server

2016-10-04 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-11926?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15544889#comment-15544889
 ] 

ASF GitHub Bot commented on CB-11926:
-

Github user alsorokin commented on a diff in the pull request:

https://github.com/apache/cordova-paramedic/pull/17#discussion_r81718373
  
--- Diff: lib/PluginsManager.js ---
@@ -41,16 +43,31 @@ PluginsManager.prototype.installTestsForExistingPlugins 
= function () {
 installedPlugins.forEach(function(plugin) {
 // there is test plugin available
 if (fs.existsSync(path.join(plugin.dir, 'tests', 'plugin.xml'))) {
-me.installSinglePlugin(path.join(plugin.dir, 'tests'));
+var additionalArgs = '';
+if (plugin.id.indexOf('cordova-plugin-file-transfer') >= 0) {
+var fileServerUrl = 
Server.prototype.getConnectionAddress.bind({
+externalServerUrl: me.config.getExternalServerUrl()
+}, me.config.getPlatformId())() + ':5000';
+additionalArgs += ' --variable 
FILETRANSFER_SERVER_ADDRESS=' + fileServerUrl;
+}
+me.installSinglePlugin(path.join(plugin.dir, 'tests') + 
additionalArgs);
 }
 });
 // this will list installed plugins and their versions
 this.showPluginsVersions();
 };
 
 PluginsManager.prototype.installSinglePlugin = function (plugin) {
-if (fs.existsSync(path.resolve(this.storedCWD, plugin))) {
-plugin = path.resolve(this.storedCWD, plugin);
+var pluginPath = plugin;
+var args = '';
+// separate plugin name from args
+var argsIndex = plugin.indexOf(' --');
--- End diff --

Paramedic doesn't have the functionality to specify arguments to pass with 
`plugin add`, so this is done to support a scenario when the user specifies a 
plugin name with variables.


> File-transfer tests should be able to use local file server
> ---
>
> Key: CB-11926
> URL: https://issues.apache.org/jira/browse/CB-11926
> Project: Apache Cordova
>  Issue Type: Test
>  Components: Paramedic, Plugin File Transfer
>Reporter: Alexander Sorokin
>Assignee: Alexander Sorokin
>Priority: Minor
>  Labels: triaged
>
> File-transfer tests should be able to use locally running file server instead 
> of relying only on Apache infrastructure.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-11926) File-transfer tests should be able to use local file server

2016-10-04 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-11926?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15544859#comment-15544859
 ] 

ASF GitHub Bot commented on CB-11926:
-

Github user alsorokin commented on a diff in the pull request:


https://github.com/apache/cordova-plugin-file-transfer/pull/159#discussion_r81716605
  
--- Diff: tests/hooks/after_prepare.js ---
@@ -0,0 +1,71 @@
+#!/usr/bin/env node
+
+/*
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*   http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied.  See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*
+*/
+
+var path = require('path');
+var fs = require('fs');
+
+module.exports = function(context) {
+function main() {
+// get the file transfer server address from the specified 
variables
+var defaultFileTransferServerAddress = 
getDefaultFileTransferServerAddress(context);
+var fileTransferServerAddress = 
getFileTransferServerAddress(context) || defaultFileTransferServerAddress;
+console.log('Tests will use the following file transfer server 
address: ' + fileTransferServerAddress);
+
+// pass it to the tests
+writeFileTransferOptions(fileTransferServerAddress, context);
+}
+
+function getDefaultFileTransferServerAddress(context) {
--- End diff --

No it isn't


> File-transfer tests should be able to use local file server
> ---
>
> Key: CB-11926
> URL: https://issues.apache.org/jira/browse/CB-11926
> Project: Apache Cordova
>  Issue Type: Test
>  Components: Paramedic, Plugin File Transfer
>Reporter: Alexander Sorokin
>Assignee: Alexander Sorokin
>Priority: Minor
>  Labels: triaged
>
> File-transfer tests should be able to use locally running file server instead 
> of relying only on Apache infrastructure.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-11926) File-transfer tests should be able to use local file server

2016-10-04 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-11926?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15544618#comment-15544618
 ] 

ASF GitHub Bot commented on CB-11926:
-

Github user vladimir-kotikov commented on a diff in the pull request:


https://github.com/apache/cordova-plugin-file-transfer/pull/159#discussion_r81698327
  
--- Diff: tests/hooks/after_prepare.js ---
@@ -0,0 +1,71 @@
+#!/usr/bin/env node
+
+/*
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*   http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied.  See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*
+*/
+
+var path = require('path');
+var fs = require('fs');
+
+module.exports = function(context) {
+function main() {
+// get the file transfer server address from the specified 
variables
+var defaultFileTransferServerAddress = 
getDefaultFileTransferServerAddress(context);
+var fileTransferServerAddress = 
getFileTransferServerAddress(context) || defaultFileTransferServerAddress;
+console.log('Tests will use the following file transfer server 
address: ' + fileTransferServerAddress);
+
+// pass it to the tests
+writeFileTransferOptions(fileTransferServerAddress, context);
+}
+
+function getDefaultFileTransferServerAddress(context) {
+var address = null;
+var configNodes = 
context.opts.plugin.pluginInfo._et._root._children;
+
+for (var node in configNodes) {
+if (configNodes[node].attrib.name == 
'FILETRANSFER_SERVER_ADDRESS') {
+address = configNodes[node].attrib.default;
+}
+}
+
+return address;
+}
+
+function getFileTransferServerAddress(context) {
+var platformJsonFile = path.join(context.opts.projectRoot, 
'plugins', context.opts.platforms[0] + '.json');
--- End diff --

I think you need to use `//.json` rather 
than one in the 'plugins' folder


> File-transfer tests should be able to use local file server
> ---
>
> Key: CB-11926
> URL: https://issues.apache.org/jira/browse/CB-11926
> Project: Apache Cordova
>  Issue Type: Test
>  Components: Paramedic, Plugin File Transfer
>Reporter: Alexander Sorokin
>Assignee: Alexander Sorokin
>Priority: Minor
>  Labels: triaged
>
> File-transfer tests should be able to use locally running file server instead 
> of relying only on Apache infrastructure.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-11926) File-transfer tests should be able to use local file server

2016-10-04 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-11926?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15544615#comment-15544615
 ] 

ASF GitHub Bot commented on CB-11926:
-

Github user vladimir-kotikov commented on a diff in the pull request:


https://github.com/apache/cordova-plugin-file-transfer/pull/159#discussion_r81697958
  
--- Diff: tests/hooks/after_prepare.js ---
@@ -0,0 +1,71 @@
+#!/usr/bin/env node
+
+/*
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*   http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied.  See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*
+*/
+
+var path = require('path');
+var fs = require('fs');
+
+module.exports = function(context) {
+function main() {
+// get the file transfer server address from the specified 
variables
+var defaultFileTransferServerAddress = 
getDefaultFileTransferServerAddress(context);
+var fileTransferServerAddress = 
getFileTransferServerAddress(context) || defaultFileTransferServerAddress;
+console.log('Tests will use the following file transfer server 
address: ' + fileTransferServerAddress);
+
+// pass it to the tests
+writeFileTransferOptions(fileTransferServerAddress, context);
+}
+
+function getDefaultFileTransferServerAddress(context) {
--- End diff --

I'm curious whether this function is needed. If there is a default value 
for variable and user didn't override it via CLI parameter, isn't the default 
value being written to `.json` file?


> File-transfer tests should be able to use local file server
> ---
>
> Key: CB-11926
> URL: https://issues.apache.org/jira/browse/CB-11926
> Project: Apache Cordova
>  Issue Type: Test
>  Components: Paramedic, Plugin File Transfer
>Reporter: Alexander Sorokin
>Assignee: Alexander Sorokin
>Priority: Minor
>  Labels: triaged
>
> File-transfer tests should be able to use locally running file server instead 
> of relying only on Apache infrastructure.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-11926) File-transfer tests should be able to use local file server

2016-10-04 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-11926?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15544617#comment-15544617
 ] 

ASF GitHub Bot commented on CB-11926:
-

Github user vladimir-kotikov commented on a diff in the pull request:


https://github.com/apache/cordova-plugin-file-transfer/pull/159#discussion_r81697360
  
--- Diff: tests/hooks/after_prepare.js ---
@@ -0,0 +1,71 @@
+#!/usr/bin/env node
+
+/*
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*   http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied.  See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*
+*/
+
+var path = require('path');
+var fs = require('fs');
+
+module.exports = function(context) {
+function main() {
+// get the file transfer server address from the specified 
variables
+var defaultFileTransferServerAddress = 
getDefaultFileTransferServerAddress(context);
--- End diff --

I think you can optimize this a bit by calling 
`getDefaultFileTransferServerAddress()` only when server address is not set 
explicitly:

```js
var fileTransferServerAddress = getFileTransferServerAddress(context) ||

getDefaultFileTransferServerAddress(context);
```


> File-transfer tests should be able to use local file server
> ---
>
> Key: CB-11926
> URL: https://issues.apache.org/jira/browse/CB-11926
> Project: Apache Cordova
>  Issue Type: Test
>  Components: Paramedic, Plugin File Transfer
>Reporter: Alexander Sorokin
>Assignee: Alexander Sorokin
>Priority: Minor
>  Labels: triaged
>
> File-transfer tests should be able to use locally running file server instead 
> of relying only on Apache infrastructure.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-11926) File-transfer tests should be able to use local file server

2016-10-04 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-11926?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15544570#comment-15544570
 ] 

ASF GitHub Bot commented on CB-11926:
-

Github user vladimir-kotikov commented on a diff in the pull request:

https://github.com/apache/cordova-paramedic/pull/17#discussion_r81695102
  
--- Diff: lib/PluginsManager.js ---
@@ -41,16 +43,31 @@ PluginsManager.prototype.installTestsForExistingPlugins 
= function () {
 installedPlugins.forEach(function(plugin) {
 // there is test plugin available
 if (fs.existsSync(path.join(plugin.dir, 'tests', 'plugin.xml'))) {
-me.installSinglePlugin(path.join(plugin.dir, 'tests'));
+var additionalArgs = '';
+if (plugin.id.indexOf('cordova-plugin-file-transfer') >= 0) {
+var fileServerUrl = 
Server.prototype.getConnectionAddress.bind({
--- End diff --

Can we just create a new `Server()` and call `getConnectionAddress` on the 
instance instead? IMO this seems to be more intuitive than using `bind`


> File-transfer tests should be able to use local file server
> ---
>
> Key: CB-11926
> URL: https://issues.apache.org/jira/browse/CB-11926
> Project: Apache Cordova
>  Issue Type: Test
>  Components: Paramedic, Plugin File Transfer
>Reporter: Alexander Sorokin
>Assignee: Alexander Sorokin
>Priority: Minor
>  Labels: triaged
>
> File-transfer tests should be able to use locally running file server instead 
> of relying only on Apache infrastructure.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-11926) File-transfer tests should be able to use local file server

2016-10-04 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-11926?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15544571#comment-15544571
 ] 

ASF GitHub Bot commented on CB-11926:
-

Github user vladimir-kotikov commented on a diff in the pull request:

https://github.com/apache/cordova-paramedic/pull/17#discussion_r81695543
  
--- Diff: lib/PluginsManager.js ---
@@ -41,16 +43,31 @@ PluginsManager.prototype.installTestsForExistingPlugins 
= function () {
 installedPlugins.forEach(function(plugin) {
 // there is test plugin available
 if (fs.existsSync(path.join(plugin.dir, 'tests', 'plugin.xml'))) {
-me.installSinglePlugin(path.join(plugin.dir, 'tests'));
+var additionalArgs = '';
+if (plugin.id.indexOf('cordova-plugin-file-transfer') >= 0) {
+var fileServerUrl = 
Server.prototype.getConnectionAddress.bind({
+externalServerUrl: me.config.getExternalServerUrl()
+}, me.config.getPlatformId())() + ':5000';
+additionalArgs += ' --variable 
FILETRANSFER_SERVER_ADDRESS=' + fileServerUrl;
+}
+me.installSinglePlugin(path.join(plugin.dir, 'tests') + 
additionalArgs);
 }
 });
 // this will list installed plugins and their versions
 this.showPluginsVersions();
 };
 
 PluginsManager.prototype.installSinglePlugin = function (plugin) {
-if (fs.existsSync(path.resolve(this.storedCWD, plugin))) {
-plugin = path.resolve(this.storedCWD, plugin);
+var pluginPath = plugin;
+var args = '';
+// separate plugin name from args
+var argsIndex = plugin.indexOf(' --');
--- End diff --

So you're building a string in `installTestsForExistingPlugins` and then 
splitting it back to `(plugin, arguments)` tuple? I don't think this is an 
efficient way to pass additional arguments to the function. Can we just add an 
optional argument to be able to specify any flags to `cordova plugin add`?


> File-transfer tests should be able to use local file server
> ---
>
> Key: CB-11926
> URL: https://issues.apache.org/jira/browse/CB-11926
> Project: Apache Cordova
>  Issue Type: Test
>  Components: Paramedic, Plugin File Transfer
>Reporter: Alexander Sorokin
>Assignee: Alexander Sorokin
>Priority: Minor
>  Labels: triaged
>
> File-transfer tests should be able to use locally running file server instead 
> of relying only on Apache infrastructure.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-11926) File-transfer tests should be able to use local file server

2016-10-03 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-11926?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15542898#comment-15542898
 ] 

ASF GitHub Bot commented on CB-11926:
-

GitHub user alsorokin opened a pull request:

https://github.com/apache/cordova-plugin-file-transfer/pull/159

CB-11926 Tests can use local server



### Platforms affected
All

### What does this PR do?
Allows tests to use a locally deployed server. You can specify its address 
via `--variable FILETRANSFER_SERVER_ADDRESS=http://your.address.here:5000` upon 
plugin installation.
The server itself can be found at:
https://github.com/apache/cordova-labs/tree/cordova-filetransfer
However, it's easier to just use paramedic, which can deploy this server 
and patch the tests to use it automatically:
https://github.com/apache/cordova-paramedic/pull/17

### What testing has been done on this change?
Tested w/ and w/o paramedic on Android and Windows platforms.

### Checklist
- [x] [ICLA](http://www.apache.org/licenses/icla.txt) has been signed and 
submitted to secret...@apache.org.
- [x] [Reported an issue](http://cordova.apache.org/contribute/issues.html) 
in the JIRA database
- [x] Commit message follows the format: "CB-3232: (android) Fix bug with 
resolving file paths", where CB- is the JIRA ID & "android" is the platform 
affected.
- [x] Added automated test coverage as appropriate for this change.



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

$ git pull https://github.com/alsorokin/cordova-plugin-file-transfer 
local-server

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

https://github.com/apache/cordova-plugin-file-transfer/pull/159.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 #159


commit ca293bd3f29dc74f628721a552ff91593380d81e
Author: Alexander Sorokin 
Date:   2016-09-30T16:20:41Z

CB-11926 Tests can use local server




> File-transfer tests should be able to use local file server
> ---
>
> Key: CB-11926
> URL: https://issues.apache.org/jira/browse/CB-11926
> Project: Apache Cordova
>  Issue Type: Test
>  Components: Paramedic, Plugin File Transfer
>Reporter: Alexander Sorokin
>Assignee: Alexander Sorokin
>Priority: Minor
>  Labels: triaged
>
> File-transfer tests should be able to use locally running file server instead 
> of relying only on Apache infrastructure.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Commented] (CB-11926) File-transfer tests should be able to use local file server

2016-09-29 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-11926?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15533172#comment-15533172
 ] 

ASF subversion and git services commented on CB-11926:
--

Commit 3315570a458d58ee5a33c683cc8a5964533fd124 in cordova-paramedic's branch 
refs/heads/master from [~alsorokin]
[ https://git-wip-us.apache.org/repos/asf?p=cordova-paramedic.git;h=3315570 ]

CB-11926 Start a server for file-transfer tests locally


> File-transfer tests should be able to use local file server
> ---
>
> Key: CB-11926
> URL: https://issues.apache.org/jira/browse/CB-11926
> Project: Apache Cordova
>  Issue Type: Test
>  Components: Paramedic, Plugin File Transfer
>Reporter: Alexander Sorokin
>Assignee: Alexander Sorokin
>Priority: Minor
>  Labels: triaged
>
> File-transfer tests should be able to use locally running file server instead 
> of relying only on Apache infrastructure.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org