http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/67fa7ebb/lib/cordova-blackberry/bin/test/cordova/functional/debugtoken-helper.js ---------------------------------------------------------------------- diff --git a/lib/cordova-blackberry/bin/test/cordova/functional/debugtoken-helper.js b/lib/cordova-blackberry/bin/test/cordova/functional/debugtoken-helper.js deleted file mode 100644 index cbf28d9..0000000 --- a/lib/cordova-blackberry/bin/test/cordova/functional/debugtoken-helper.js +++ /dev/null @@ -1,377 +0,0 @@ -/** - 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 childProcess = require('child_process'), - debugTokenHelper = require("../../templates/project/cordova/lib/debugtoken-helper"), - wrench = require('wrench'), - fs = require('fs'), - properties, - flag; - -function testCreateDebugtoken(target) { - debugTokenHelper.createToken(properties, target, function (code) { - if (code === 0) { - console.log("Debug token is created successfully!"); - } else { - console.log("Debug token is not created successfully!"); - } - - flag = true; - }); -} - -function testDeployDebugtoken() { - debugTokenHelper.deployToken(properties, "", function () { - console.log("Deploy callback is invoked!"); - flag = true; - }); -} - -function testDeployDebugtokenAll() { - debugTokenHelper.deployToken(properties, "all", function () { - console.log("Deploy callback is invoked!"); - flag = true; - }); -} - -function testDeployDebugtokenSingle() { - debugTokenHelper.deployToken(properties, "d1", function () { - console.log("Deploy callback is invoked!"); - flag = true; - }); -} - -describe("cordova/lib/debugtoken-helper tests", function () { - beforeEach(function () { - flag = false; - }); - - it("should create a debugtoken for target all", function () { - testCreateDebugtoken("all"); - - beforeEach(function () { - properties = { - "barName": "cordova-BB10-app", - "keystorepass": "qaqa1234", - "defaultTarget": "d1", - "targets": { - "d1": { - "ip": "169.254.0.1", - "type": "device", - "pin": "2A54F454", - "password" : "qaqa123" - } - } - }; - - fs.unlinkSync("debugtoken.bar"); - }); - - waitsFor(function () { - return flag; - }); - - runs(function () { - expect(fs.existsSync("debugtoken.bar")); - }); - }); - - it("should create a debugtoken for single target", function () { - testCreateDebugtoken("d1"); - - beforeEach(function () { - properties = { - "barName": "cordova-BB10-app", - "keystorepass": "qaqa1234", - "defaultTarget": "d1", - "targets": { - "d1": { - "ip": "169.254.0.1", - "type": "device", - "pin": "2A54F454", - "password" : "qaqa123" - } - } - }; - - fs.unlinkSync("debugtoken.bar"); - }); - - waitsFor(function () { - return flag; - }); - - runs(function () { - expect(fs.existsSync("debugtoken.bar")); - }); - }); - - it("should create a debugtoken for default target", function () { - testCreateDebugtoken(""); - - beforeEach(function () { - properties = { - "barName": "cordova-BB10-app", - "keystorepass": "qaqa1234", - "defaultTarget": "d1", - "targets": { - "d1": { - "ip": "169.254.0.1", - "type": "device", - "pin": "2A54F454", - "password" : "qaqa123" - } - } - }; - - fs.unlinkSync("debugtoken.bar"); - }); - - waitsFor(function () { - return flag; - }); - - runs(function () { - expect(fs.existsSync("debugtoken.bar")); - }); - }); - - it("cannot create a debugtoken without keystorepass", function () { - testCreateDebugtoken("all"); - - beforeEach(function () { - properties = { - "barName": "cordova-BB10-app", - //"keystorepass": "qaqa1234", - "defaultTarget": "d1", - "targets": { - "d1": { - "ip": "169.254.0.1", - "type": "device", - "pin": "2A54F454", - "password" : "qaqa123" - } - } - }; - - fs.unlinkSync("debugtoken.bar"); - }); - - waitsFor(function () { - return flag; - }); - - runs(function () { - expect(!fs.existsSync("debugtoken.bar")); - }); - }); - - it("cannot create a debugtoken without any device PINs", function () { - testCreateDebugtoken("all"); - - beforeEach(function () { - properties = { - "barName": "cordova-BB10-app", - "keystorepass": "qaqa1234", - "defaultTarget": "d1", - "targets": { - "d1": { - "ip": "169.254.0.1", - "type": "device", - //"pin": "2A54F454", - "password" : "qaqa123" - } - } - }; - - fs.unlinkSync("debugtoken.bar"); - }); - - waitsFor(function () { - return flag; - }); - - runs(function () { - expect(!fs.existsSync("debugtoken.bar")); - }); - }); - - it("should deploy a debugtoken to default target", function () { - debugTokenHelper.createToken(properties, "", testDeployDebugtoken); - - beforeEach(function () { - properties = { - "barName": "cordova-BB10-app", - "keystorepass": "qaqa1234", - "defaultTarget": "d1", - "targets": { - "d1": { - "ip": "169.254.0.1", - "type": "device", - "pin": "2A54F454", - "password" : "qaqa123" - } - } - }; - - fs.unlinkSync("debugtoken.bar"); - - window.alert("Make sure you connect the device " + "2A54F454" + " to " + "169.254.0.1"); - }); - - waitsFor(function () { - return flag; - }); - - runs(function () { - var confirm = window.confirm("Was the debug token deployed to device?"); - expect(confirm).toEqual(true); - }); - }); - - it("should deploy a debugtoken to all targets", function () { - debugTokenHelper.createToken(properties, "all", testDeployDebugtokenAll); - - beforeEach(function () { - properties = { - "barName": "cordova-BB10-app", - "keystorepass": "qaqa1234", - "defaultTarget": "d1", - "targets": { - "d1": { - "ip": "169.254.0.1", - "type": "device", - "pin": "2A54F454", - "password" : "qaqa123" - } - } - }; - - fs.unlinkSync("debugtoken.bar"); - - window.alert("Make sure you connect the device " + "2A54F454" + " to " + "169.254.0.1"); - }); - - waitsFor(function () { - return flag; - }); - - runs(function () { - var confirm = window.confirm("Was the debug token deployed to device?"); - expect(confirm).toEqual(true); - }); - }); - - it("should deploy a debugtoken to a single target", function () { - debugTokenHelper.createToken(properties, "d1", testDeployDebugtokenSingle); - - beforeEach(function () { - properties = { - "barName": "cordova-BB10-app", - "keystorepass": "qaqa1234", - "defaultTarget": "d1", - "targets": { - "d1": { - "ip": "169.254.0.1", - "type": "device", - "pin": "2A54F454", - "password" : "qaqa123" - } - } - }; - - fs.unlinkSync("debugtoken.bar"); - - window.alert("Make sure you connect the device " + "2A54F454" + " to " + "169.254.0.1"); - }); - - waitsFor(function () { - return flag; - }); - - runs(function () { - var confirm = window.confirm("Was the debug token deployed to device?"); - expect(confirm).toEqual(true); - }); - }); - - it("cannot deploy a debugtoken when the target is not connected", function () { - debugTokenHelper.createToken(properties, "all", testDeployDebugtoken); - - beforeEach(function () { - properties = { - "barName": "cordova-BB10-app", - "keystorepass": "qaqa1234", - "defaultTarget": "d1", - "targets": { - "d1": { - "ip": "169.254.0.1", - "type": "device", - "pin": "2A54F454", - "password" : "qaqa123" - } - } - }; - - fs.unlinkSync("debugtoken.bar"); - - window.alert("Disconnect the target from 169.254.0.1"); - }); - - waitsFor(function () { - return flag; - }); - - runs(function () { - var confirm = window.confirm("Was the debug token deployed to device?"); - expect(confirm).toEqual(false); - }); - }); - - it("cannot deploy a debugtoken if no debugtoken", function () { - testDeployDebugtoken(); - - beforeEach(function () { - properties = { - "barName": "cordova-BB10-app", - "keystorepass": "qaqa1234", - "defaultTarget": "d1", - "targets": { - "d1": { - "ip": "169.254.0.1", - "type": "device", - "pin": "2A54F454", - "password" : "qaqa123" - } - } - }; - - fs.unlinkSync("debugtoken.bar"); - }); - - waitsFor(function () { - return flag; - }); - - runs(function () { - var confirm = window.confirm("Was the debug token deployed to device?"); - expect(confirm).toEqual(false); - }); - }); -});
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/67fa7ebb/lib/cordova-blackberry/bin/test/cordova/integration/create.js ---------------------------------------------------------------------- diff --git a/lib/cordova-blackberry/bin/test/cordova/integration/create.js b/lib/cordova-blackberry/bin/test/cordova/integration/create.js deleted file mode 100644 index 9879ef0..0000000 --- a/lib/cordova-blackberry/bin/test/cordova/integration/create.js +++ /dev/null @@ -1,158 +0,0 @@ -/** - 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 childProcess = require('child_process'), - tempFolder = '.tmp/', - appFolder = tempFolder + 'tempCordovaApp/', - projectFile = 'project.json', - wrench = require('wrench'), - fs = require('fs'), - flag = false, - _stdout = "", - _stderr = ""; - -function executeScript(shellCommand, shouldError) { - childProcess.exec(shellCommand, function (error, stdout, stderr) { - if (error && !shouldError) { - console.log("Error executing command: " + error); - } - _stdout = stdout.toString().trim(); - _stderr = stderr.toString().trim(); - flag = true; - }); -} - -describe("create tests", function () { - it("creates project", function () { - var project, - appIdRegExp = /id="default\.app\.id"/g; - executeScript("bin/create " + appFolder); - waitsFor(function () { - return flag; - }); - runs(function () { - flag = false; - project = JSON.parse(fs.readFileSync(appFolder + projectFile, "utf-8")); - expect(appIdRegExp.test(fs.readFileSync(appFolder + "www/config.xml", "utf-8"))).toEqual(true); - expect(fs.existsSync(appFolder)).toEqual(true); - expect(fs.existsSync(appFolder + "/plugins")).toEqual(true); - expect(fs.existsSync(appFolder + "/cordova")).toEqual(true); - expect(fs.existsSync(appFolder + "/cordova/node_modules")).toEqual(true); - expect(fs.existsSync(appFolder + "/cordova/lib")).toEqual(true); - expect(fs.existsSync(appFolder + "/cordova/third_party")).toEqual(true); - expect(fs.existsSync(appFolder + "/www")).toEqual(true); - expect(project.barName).toEqual("cordova-BB10-app"); - expect(project.keystorepass).toEqual("password"); - expect(project.defaultTarget).toEqual(""); - expect(project.targets).toEqual({}); - expect(fs.existsSync("./build")).toEqual(false); - expect(_stdout).toEqual(""); - expect(_stderr).toEqual(""); - }); - this.after(function () { - wrench.rmdirSyncRecursive(tempFolder); - }); - }); - - it("sets appId", function () { - var configEt, - appIdRegExp = /id="com\.example\.bb10app"/g; - executeScript("bin/create " + appFolder + " com.example.bb10app"); - waitsFor(function () { - return flag; - }); - runs(function () { - flag = false; - expect(appIdRegExp.test(fs.readFileSync(appFolder + "www/config.xml", "utf-8"))).toEqual(true); - expect(_stdout).toEqual(""); - expect(_stderr).toEqual(""); - }); - this.after(function () { - wrench.rmdirSyncRecursive(tempFolder); - }); - }); - - it("sets appId and barName", function () { - var project, - appIdRegExp = /id="com\.example\.bb10app"/g; - executeScript("bin/create " + appFolder + " com.example.bb10app bb10appV1"); - waitsFor(function () { - return flag; - }); - runs(function () { - flag = false; - project = JSON.parse(fs.readFileSync(appFolder + projectFile, "utf-8")); - expect(appIdRegExp.test(fs.readFileSync(appFolder + "www/config.xml", "utf-8"))).toEqual(true); - expect(project.barName).toEqual("bb10appV1"); - expect(_stdout).toEqual(""); - expect(_stderr).toEqual(""); - }); - this.after(function () { - wrench.rmdirSyncRecursive(tempFolder); - }); - }); - - it("No args", function () { - executeScript("bin/create", true); - waitsFor(function () { - return flag; - }); - runs(function () { - flag = false; - expect(_stdout).toEqual("Project creation failed!\nError: You must give a project PATH"); - expect(_stderr).toEqual(""); - }); - }); - - it("Empty dir error", function () { - executeScript("bin/create ./", true); - waitsFor(function () { - return flag; - }); - runs(function () { - flag = false; - expect(_stdout).toEqual("Project creation failed!\nError: The project path must be an empty directory"); - expect(_stderr).toEqual(""); - }); - }); - - it("Invalid appId error", function () { - executeScript("bin/create " + appFolder + " 23.21#$", true); - waitsFor(function () { - return flag; - }); - runs(function () { - flag = false; - expect(_stdout).toEqual("Project creation failed!\nError: App ID must be sequence of alpha-numeric (optionally seperated by '.') characters, no longer than 50 characters"); - expect(_stderr).toEqual(""); - }); - }); - - it("Invalid barName error", function () { - executeScript("bin/create " + appFolder + " com.example.app %bad@bar^name", true); - waitsFor(function () { - return flag; - }); - runs(function () { - flag = false; - expect(_stdout).toEqual("Project creation failed!\nError: BAR filename can only contain alpha-numeric, '.', '-' and '_' characters"); - expect(_stderr).toEqual(""); - }); - }); -}); http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/67fa7ebb/lib/cordova-blackberry/bin/test/cordova/integration/target.js ---------------------------------------------------------------------- diff --git a/lib/cordova-blackberry/bin/test/cordova/integration/target.js b/lib/cordova-blackberry/bin/test/cordova/integration/target.js deleted file mode 100644 index e948a87..0000000 --- a/lib/cordova-blackberry/bin/test/cordova/integration/target.js +++ /dev/null @@ -1,237 +0,0 @@ -/** - 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 childProcess = require('child_process'), - tempFolder = '.tmp/', - appFolder = tempFolder + 'tempCordovaApp/', - projectFile = 'project.json', - wrench = require('wrench'), - fs = require('fs'), - flag = false, - _stdout = "", - _stderr = ""; - -function executeScript(shellCommand) { - childProcess.exec(shellCommand, function (error, stdout, stderr) { - if (error) { - console.log("Error executing command: " + error); - } - _stdout = stdout.toString().trim(); - _stderr = stderr.toString().trim(); - flag = true; - }); -} - -describe("cordova/target tests", function () { - beforeEach(function () { - executeScript("bin/create " + appFolder); - waitsFor(function () { - return flag; - }); - runs(function () { - flag = false; - }); - }); - - afterEach(function () { - wrench.rmdirSyncRecursive(tempFolder); - }); - - it("should add a target", function () { - var project, - target; - executeScript(appFolder + "cordova/target add z10 169.254.0.1 device -p pass --pin DEADBEEF"); - waitsFor(function () { - return flag; - }); - runs(function () { - flag = false; - project = JSON.parse(fs.readFileSync(appFolder + projectFile, 'utf-8')); - expect(project.defaultTarget).toEqual("z10"); - expect(Object.keys(project.targets).length).toEqual(1); - target = project.targets.z10; - expect(target.ip).toEqual("169.254.0.1"); - expect(target.type).toEqual("device"); - expect(target.password).toEqual("pass"); - expect(target.pin).toEqual("DEADBEEF"); - expect(_stdout).toEqual(""); - expect(_stderr).toEqual(""); - }); - }); - - it("should remove a target", function () { - var project; - executeScript(appFolder + "cordova/target add z10 169.254.0.1 device -p pass --pin DEADBEEF"); - waitsFor(function () { - return flag; - }); - runs(function () { - flag = false; - executeScript(appFolder + "cordova/target remove z10"); - waitsFor(function () { - return flag; - }); - runs(function () { - flag = false; - project = JSON.parse(fs.readFileSync(appFolder + projectFile, 'utf-8')); - expect(project.defaultTarget).toEqual(""); - expect(Object.keys(project.targets).length).toEqual(0); - expect(_stdout).toEqual("Deleting default target, please set a new default target"); - expect(_stderr).toEqual(""); - }); - }); - }); - - it("should set default target", function () { - var project; - executeScript(appFolder + "cordova/target add z10 169.254.0.1 device -p pass --pin DEADBEEF"); - waitsFor(function () { - return flag; - }); - runs(function () { - flag = false; - executeScript(appFolder + "cordova/target add q10 169.254.0.2 device -p p455w02D --pin FACEFACE"); - waitsFor(function () { - return flag; - }); - runs(function () { - flag = false; - executeScript(appFolder + "cordova/target default q10"); - waitsFor(function () { - return flag; - }); - runs(function () { - flag = false; - project = JSON.parse(fs.readFileSync(appFolder + projectFile, 'utf-8')); - expect(project.defaultTarget).toEqual("q10"); - }); - }); - }); - }); - - it("should list targets", function () { - executeScript(appFolder + "cordova/target add z10 169.254.0.1 device -p pass --pin DEADBEEF"); - waitsFor(function () { - return flag; - }); - runs(function () { - flag = false; - executeScript(appFolder + "cordova/target add q10 169.254.0.2 device -p p455w02D --pin FACEFACE"); - waitsFor(function () { - return flag; - }); - runs(function () { - flag = false; - executeScript(appFolder + "cordova/target"); - waitsFor(function () { - return flag; - }); - runs(function () { - flag = false; - expect(_stdout).toEqual("* z10\n q10"); - expect(_stderr).toEqual(""); - }); - }); - }); - }); - - it("should require name for add/remove", function () { - executeScript(appFolder + "cordova/target add"); - waitsFor(function () { - return flag; - }); - runs(function () { - flag = false; - expect(_stdout).toEqual("Target details not specified"); - expect(_stderr).toEqual(""); - }); - }); - - it("should require ip for add", function () { - executeScript(appFolder + "cordova/target add z10"); - waitsFor(function () { - return flag; - }); - runs(function () { - flag = false; - expect(_stdout).toEqual("IP is required"); - expect(_stderr).toEqual(""); - }); - }); - - it("should require type for add ", function () { - executeScript(appFolder + "cordova/target add z10 169.254.0.1"); - waitsFor(function () { - return flag; - }); - runs(function () { - flag = false; - expect(_stdout).toEqual("target type is required"); - expect(_stderr).toEqual(""); - }); - }); - - it("should warn unregonized command", function () { - executeScript(appFolder + "cordova/target bleh"); - waitsFor(function () { - return flag; - }); - runs(function () { - flag = false; - expect(_stdout).toEqual("Unrecognized command"); - expect(_stderr).toEqual(""); - }); - }); - - it("should warn invalid ip", function () { - executeScript(appFolder + "cordova/target add z10 256.254.0.1"); - waitsFor(function () { - return flag; - }); - runs(function () { - flag = false; - expect(_stdout).toEqual("Invalid IP: 256.254.0.1"); - expect(_stderr).toEqual(""); - }); - }); - - it("should warn invalid type", function () { - executeScript(appFolder + "cordova/target add z10 169.254.0.1 bleh"); - waitsFor(function () { - return flag; - }); - runs(function () { - flag = false; - expect(_stdout).toEqual("Invalid target type: bleh"); - expect(_stderr).toEqual(""); - }); - }); - - it("should warn invalid pin", function () { - executeScript(appFolder + "cordova/target add z10 169.254.0.1 device --pin NOTAPIN!"); - waitsFor(function () { - return flag; - }); - runs(function () { - flag = false; - expect(_stdout).toEqual("Invalid PIN: NOTAPIN!"); - expect(_stderr).toEqual(""); - }); - }); -}); http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/67fa7ebb/lib/cordova-blackberry/bin/test/cordova/unit/config-bare-minimum.xml ---------------------------------------------------------------------- diff --git a/lib/cordova-blackberry/bin/test/cordova/unit/config-bare-minimum.xml b/lib/cordova-blackberry/bin/test/cordova/unit/config-bare-minimum.xml deleted file mode 100644 index 90572f4..0000000 --- a/lib/cordova-blackberry/bin/test/cordova/unit/config-bare-minimum.xml +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<widget xmlns=" http://www.w3.org/ns/widgets" - xmlns:rim="http://www.blackberry.com/ns/widgets" - version="1.0.0" - id="myID"> - <name>Demo</name> - <content src="local:///startPage.html"/> - <author>Research In Motion Ltd.</author> - <license href="http://www.apache.org/licenses/LICENSE-2.0"> - Licensed 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. - </license> -</widget> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/67fa7ebb/lib/cordova-blackberry/bin/test/cordova/unit/config-license.xml ---------------------------------------------------------------------- diff --git a/lib/cordova-blackberry/bin/test/cordova/unit/config-license.xml b/lib/cordova-blackberry/bin/test/cordova/unit/config-license.xml deleted file mode 100644 index ac4ffe9..0000000 --- a/lib/cordova-blackberry/bin/test/cordova/unit/config-license.xml +++ /dev/null @@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<widget xmlns=" http://www.w3.org/ns/widgets" - xmlns:rim="http://www.blackberry.com/ns/widgets" - version="1.0.0" - id="myID"> - <name>Demo</name> - <content src="local:///startPage.html"/> - <author>Research In Motion Ltd.</author> - <license href="http://www.apache.org/licenses/LICENSE-2.0"></license> -</widget> http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/67fa7ebb/lib/cordova-blackberry/bin/test/cordova/unit/config.xml ---------------------------------------------------------------------- diff --git a/lib/cordova-blackberry/bin/test/cordova/unit/config.xml b/lib/cordova-blackberry/bin/test/cordova/unit/config.xml deleted file mode 100644 index 8650a90..0000000 --- a/lib/cordova-blackberry/bin/test/cordova/unit/config.xml +++ /dev/null @@ -1,53 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<widget xmlns=" http://www.w3.org/ns/widgets" - xmlns:rim="http://www.blackberry.com/ns/widgets" - version="1.0.0" - id="My WidgetId" - rim:header="RIM-Widget:rim/widget" - rim:userAgent="A Test-User-Agent/(Blackberry-Agent)"> - <name>Demo</name> - <content src="local:///startPage.html"/> - <author rim:copyright="No Copyright" - href="http://www.rim.com/" - email = "[email protected]">Research In Motion Ltd.</author> - <description>This app does everything.</description> - <license href="http://www.apache.org/licenses/LICENSE-2.0">My License</license> - <icon src="test.png" /> - <rim:permissions> - <rim:permit>access_shared</rim:permit> - <rim:permit>read_geolocation</rim:permit> - <rim:permit>use_camera</rim:permit> - </rim:permissions> - <feature id="blackberry.app.orientation"> - <param name="mode" value="portrait" /> - <param name="other" value="portrait" /> - </feature> - <feature id="blackberry.app" required="true" version="1.0.0.0"> - <param name="childBrowser" value="disable" /> - <param name="websecurity" value="disable" /> - <param name="popupBlocker" value="enable" /> - </feature> - <feature id="blackberry.system" required="true" version="1.0.0.3"/> - <access uri="http://www.somedomain1.com" subdomains="true"> - <feature id="blackberry.app" required="true" version="1.0.0.0"/> - <feature id="blackberry.app.event" required="false" version="2.0.0.0"/> - </access> - <rim:invoke-target id="com.domain.subdomain.appname.app1"> - <type>APPLICATION</type> - <require-source-permissions>invoke_accross_perimeters,access_shared</require-source-permissions> - <filter> - <action>bb.action.OPEN</action> - <action>bb.action.SET</action> - <action>bb.action.VIEW</action> - <mime-type>image/*</mime-type> - <mime-type>text/*</mime-type> - <property var="uris" value="ftp://" /> - <property var="uris" value="http://" /> - <property var="uris" value="https://" /> - <property var="exts" value="jpg" /> - <property var="exts" value="png" /> - <property var="exts" value="txt" /> - <property var="exts" value="doc" /> - </filter> - </rim:invoke-target> -</widget> http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/67fa7ebb/lib/cordova-blackberry/bin/test/cordova/unit/data/ascii_text.txt ---------------------------------------------------------------------- diff --git a/lib/cordova-blackberry/bin/test/cordova/unit/data/ascii_text.txt b/lib/cordova-blackberry/bin/test/cordova/unit/data/ascii_text.txt deleted file mode 100644 index 5e1c309..0000000 --- a/lib/cordova-blackberry/bin/test/cordova/unit/data/ascii_text.txt +++ /dev/null @@ -1 +0,0 @@ -Hello World \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/67fa7ebb/lib/cordova-blackberry/bin/test/cordova/unit/data/ucs2be_text.txt ---------------------------------------------------------------------- diff --git a/lib/cordova-blackberry/bin/test/cordova/unit/data/ucs2be_text.txt b/lib/cordova-blackberry/bin/test/cordova/unit/data/ucs2be_text.txt deleted file mode 100644 index f999e5f..0000000 Binary files a/lib/cordova-blackberry/bin/test/cordova/unit/data/ucs2be_text.txt and /dev/null differ http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/67fa7ebb/lib/cordova-blackberry/bin/test/cordova/unit/data/ucs2le_text.txt ---------------------------------------------------------------------- diff --git a/lib/cordova-blackberry/bin/test/cordova/unit/data/ucs2le_text.txt b/lib/cordova-blackberry/bin/test/cordova/unit/data/ucs2le_text.txt deleted file mode 100644 index 088fa80..0000000 Binary files a/lib/cordova-blackberry/bin/test/cordova/unit/data/ucs2le_text.txt and /dev/null differ http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/67fa7ebb/lib/cordova-blackberry/bin/test/cordova/unit/data/utf8_text.txt ---------------------------------------------------------------------- diff --git a/lib/cordova-blackberry/bin/test/cordova/unit/data/utf8_text.txt b/lib/cordova-blackberry/bin/test/cordova/unit/data/utf8_text.txt deleted file mode 100644 index 05eac02..0000000 --- a/lib/cordova-blackberry/bin/test/cordova/unit/data/utf8_text.txt +++ /dev/null @@ -1 +0,0 @@ -Hello World \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/67fa7ebb/lib/cordova-blackberry/bin/test/cordova/unit/params-bad.json ---------------------------------------------------------------------- diff --git a/lib/cordova-blackberry/bin/test/cordova/unit/params-bad.json b/lib/cordova-blackberry/bin/test/cordova/unit/params-bad.json deleted file mode 100644 index 16c75eb..0000000 --- a/lib/cordova-blackberry/bin/test/cordova/unit/params-bad.json +++ /dev/null @@ -1,10 +0,0 @@ -{ -EVIL! - "blackberry-signer": { - "-proxyhost": "abc.com", - "-proxyport": "80" - }, - "blackberry-nativepackager": { - - } -} http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/67fa7ebb/lib/cordova-blackberry/bin/test/cordova/unit/params.json ---------------------------------------------------------------------- diff --git a/lib/cordova-blackberry/bin/test/cordova/unit/params.json b/lib/cordova-blackberry/bin/test/cordova/unit/params.json deleted file mode 100644 index 6a3506f..0000000 --- a/lib/cordova-blackberry/bin/test/cordova/unit/params.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "blackberry-signer": { - "-proxyhost": "abc.com", - "-proxyport": "80" - }, - "blackberry-nativepackager": { - - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/67fa7ebb/lib/cordova-blackberry/bin/test/cordova/unit/spec/lib/bar-builder.js ---------------------------------------------------------------------- diff --git a/lib/cordova-blackberry/bin/test/cordova/unit/spec/lib/bar-builder.js b/lib/cordova-blackberry/bin/test/cordova/unit/spec/lib/bar-builder.js deleted file mode 100644 index 02440cc..0000000 --- a/lib/cordova-blackberry/bin/test/cordova/unit/spec/lib/bar-builder.js +++ /dev/null @@ -1,34 +0,0 @@ -var srcPath = __dirname + "/../../../../../templates/project/cordova/lib/", - path = require("path"), - wrench = require("wrench"), - barBuilder = require(srcPath + "bar-builder"), - fileMgr = require(srcPath + "file-manager"), - nativePkgr = require(srcPath + "native-packager"), - logger = require(srcPath + "logger"), - testData = require("./test-data"), - extManager = null; - -describe("BAR builder", function () { - it("build() create BAR for specified session", function () { - var callback = jasmine.createSpy(), - session = testData.session, - config = testData.config, - target = session.targets[0]; - - wrench.mkdirSyncRecursive(path.join(session.sourcePaths.LIB, "config")); - - spyOn(wrench, "mkdirSyncRecursive"); - spyOn(fileMgr, "copyWebworks"); - spyOn(fileMgr, "generateFrameworkModulesJS"); - spyOn(nativePkgr, "exec").andCallFake(function (session, target, config, callback) { - callback(0); - }); - - barBuilder.build(session, testData.config, callback); - - expect(wrench.mkdirSyncRecursive).toHaveBeenCalledWith(session.outputDir + "/" + target); - expect(fileMgr.generateFrameworkModulesJS).toHaveBeenCalledWith(session); - expect(nativePkgr.exec).toHaveBeenCalledWith(session, target, config, jasmine.any(Function)); - expect(callback).toHaveBeenCalledWith(0); - }); -}); http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/67fa7ebb/lib/cordova-blackberry/bin/test/cordova/unit/spec/lib/bbwpignore.js ---------------------------------------------------------------------- diff --git a/lib/cordova-blackberry/bin/test/cordova/unit/spec/lib/bbwpignore.js b/lib/cordova-blackberry/bin/test/cordova/unit/spec/lib/bbwpignore.js deleted file mode 100644 index 7c68ee9..0000000 --- a/lib/cordova-blackberry/bin/test/cordova/unit/spec/lib/bbwpignore.js +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright 2012 Research In Motion Limited. - * - * Licensed 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 srcPath = __dirname + "/../../../../../templates/project/cordova/lib/", - BBWPignore = require(srcPath + "bbwpignore"), - fs = require('fs'); - -describe("bbwpignore can match", function () { - it("a basic file set", function () { - var bbwpignore; - spyOn(fs, "readFileSync").andReturn("abc.js\n" + - "x/y/def.js"); - bbwpignore = new BBWPignore("FileNameIgnoreForTests", - ["d/e/abc.js", "abc.js", "ted.js", ".DS_Store", - "x/y/def.js", "x/def.js", "a/b/x/y/def.js"]); - expect(bbwpignore.matchedFiles.length).toBe(4); - expect(bbwpignore.matchedFiles.indexOf("d/e/abc.js")).not.toBe(-1); - expect(bbwpignore.matchedFiles.indexOf("abc.js")).not.toBe(-1); - expect(bbwpignore.matchedFiles.indexOf("x/y/def.js")).not.toBe(-1); - expect(bbwpignore.matchedFiles.indexOf("a/b/x/y/def.js")).not.toBe(-1); - }); - - it("a basic file set with directories", function () { - var bbwpignore; - spyOn(fs, "readFileSync").andReturn("abc.js\n" + - "x/y/"); - bbwpignore = new BBWPignore("FileNameIgnoreForTests", - ["d/e/abc.js", "abc.js", "ted.js", ".DS_Store", - "x/y/def.js", "x/def.js", "a/b/x/y/def.js"]); - - expect(bbwpignore.matchedFiles.length).toBe(4); - expect(bbwpignore.matchedFiles.indexOf("d/e/abc.js")).not.toBe(-1); - expect(bbwpignore.matchedFiles.indexOf("abc.js")).not.toBe(-1); - expect(bbwpignore.matchedFiles.indexOf("x/y/def.js")).not.toBe(-1); - expect(bbwpignore.matchedFiles.indexOf("a/b/x/y/def.js")).not.toBe(-1); - }); - - it("a basic file set with directories that being with slash", function () { - var bbwpignore; - spyOn(fs, "readFileSync").andReturn("abc.js\n" + - "/x/y/"); - bbwpignore = new BBWPignore("FileNameIgnoreForTests", - ["d/e/abc.js", "abc.js", "ted.js", ".DS_Store", - "x/y/def.js", "x/def.js", "a/b/x/y/def.js"]); - expect(bbwpignore.matchedFiles.length).toBe(4); - expect(bbwpignore.matchedFiles.indexOf("d/e/abc.js")).not.toBe(-1); - expect(bbwpignore.matchedFiles.indexOf("abc.js")).not.toBe(-1); - expect(bbwpignore.matchedFiles.indexOf("/x/y")).not.toBe(-1); - expect(bbwpignore.matchedFiles.indexOf("x/y/def.js")).not.toBe(-1); - - }); - - it("a basic file set that begin with a slash on the directory", function () { - var bbwpignore; - spyOn(fs, "readFileSync").andReturn("abc.js\n" + - "/x/y/def.js"); - bbwpignore = new BBWPignore("FileNameIgnoreForTests", - ["d/e/abc.js", "abc.js", "ted.js", ".DS_Store", - "x/y/def.js", "x/def.js", "a/b/x/y/def.js"]); - - expect(bbwpignore.matchedFiles.length).toBe(3); - expect(bbwpignore.matchedFiles.indexOf("d/e/abc.js")).not.toBe(-1); - expect(bbwpignore.matchedFiles.indexOf("abc.js")).not.toBe(-1); - expect(bbwpignore.matchedFiles.indexOf("x/y/def.js")).not.toBe(-1); - - }); - - it("a basic file set that begin with a slash", function () { - var bbwpignore; - spyOn(fs, "readFileSync").andReturn("abc.js\n" + - "/def.js"); - bbwpignore = new BBWPignore("FileNameIgnoreForTests", - ["d/e/abc.js", "abc.js", "ted.js", ".DS_Store", - "x/y/def.js", "x/def.js", "a/b/x/y/def.js"]); - - expect(bbwpignore.matchedFiles.length).toBe(2); - expect(bbwpignore.matchedFiles.indexOf("d/e/abc.js")).not.toBe(-1); - expect(bbwpignore.matchedFiles.indexOf("abc.js")).not.toBe(-1); - - }); - - it("a basic file set that begin with a slash and has a wildcard", function () { - var bbwpignore; - spyOn(fs, "readFileSync").andReturn("abcd.js\n" + - "/*.js"); - bbwpignore = new BBWPignore("FileNameIgnoreForTests", - ["d/e/abc.js", "abc.js", "ted.js", ".DS_Store", - "x/y/def.js", "x/def.js", "a/b/x/y/def.js"]); - - expect(bbwpignore.matchedFiles.length).toBe(2); - expect(bbwpignore.matchedFiles.indexOf("abc.js")).not.toBe(-1); - expect(bbwpignore.matchedFiles.indexOf("ted.js")).not.toBe(-1); - - }); - - it("a basic file set that begin with a slash and has a wildcard", function () { - var bbwpignore; - spyOn(fs, "readFileSync").andReturn("abcd.js\n" + - "a*.js"); - bbwpignore = new BBWPignore("FileNameIgnoreForTests", - ["d/e/abc.js", "abc.js", "ted.js", ".DS_Store", - "x/y/def.js", "x/def.js", "a/b/x/y/def.js"]); - - expect(bbwpignore.matchedFiles.length).toBe(2); - expect(bbwpignore.matchedFiles.indexOf("d/e/abc.js")).not.toBe(-1); - expect(bbwpignore.matchedFiles.indexOf("abc.js")).not.toBe(-1); - - }); - - it("a basic directory set that begin with a slash", function () { - var bbwpignore; - spyOn(fs, "readFileSync").andReturn("/simulator/\n" + - "banana.js"); - bbwpignore = new BBWPignore("FileNameIgnoreForTests", - ["simulator/a.js"]); - - expect(bbwpignore.matchedFiles.length).toBe(2); - expect(bbwpignore.matchedFiles.indexOf("/simulator")).not.toBe(-1); - expect(bbwpignore.matchedFiles.indexOf("simulator/a.js")).not.toBe(-1); - - }); -}); http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/67fa7ebb/lib/cordova-blackberry/bin/test/cordova/unit/spec/lib/cmdline.js ---------------------------------------------------------------------- diff --git a/lib/cordova-blackberry/bin/test/cordova/unit/spec/lib/cmdline.js b/lib/cordova-blackberry/bin/test/cordova/unit/spec/lib/cmdline.js deleted file mode 100644 index 03eda58..0000000 --- a/lib/cordova-blackberry/bin/test/cordova/unit/spec/lib/cmdline.js +++ /dev/null @@ -1,77 +0,0 @@ -var srcPath = __dirname + "/../../../../../templates/project/cordova/lib/", - localize = require(srcPath + "localize"), - cmdline = require(srcPath + "cmdline"), - cmd; - -describe("Command line", function () { - beforeEach(function () { - cmd = cmdline - .parse(process.argv) - .commander; - }); - - it("accepts -o with argument", function () { - cmd.parseOptions(["-o", "outdir"]); - expect(cmd.output).toEqual("outdir"); - }); - - it("arg following -o is required", function () { - spyOn(process, "exit"); - spyOn(console, "error"); - cmd.parseOptions(["-o"]); - expect(console.error).toHaveBeenCalled(); - expect(process.exit).toHaveBeenCalled(); - }); - - it("accepts -s without argument", function () { - cmd.parseOptions(["-s"]); - expect(cmd.source).toBeTruthy(); - }); - - it("accepts -s with argument", function () { - cmd.parseOptions(["-s", "mySourceDir"]); - expect(cmd.source).toEqual("mySourceDir"); - }); - - it("accepts -d", function () { - cmd.parseOptions(["-d"]); - expect(cmd.debug).toBeTruthy(); - }); - - it("accepts --loglevel with argument", function () { - cmd.parseOptions(["--loglevel", "warn"]); - expect(cmd.loglevel).toBe("warn"); - }); - - it("accepts -ll", function () { - cmd.parseOptions(["-ll", "error"]); - expect(cmd.loglevel).toBe("error"); - }); - - it("accepts -g with argument", function () { - cmd.parseOptions(["-g", "myPassword"]); - expect(cmd.password).toEqual("myPassword"); - }); - - it("accepts --buildId with argument", function () { - cmd.parseOptions(["--buildId", "100"]); - expect(cmd.buildId).toEqual("100"); - }); - - it("accepts -buildId with argument", function () { - cmd.parseOptions(["-buildId", "100"]); - expect(cmd.buildId).toEqual("100"); - }); - - it("accepts --appdesc with argument", function () { - cmd.parseOptions(["--appdesc", "bardescriptor"]); - expect(cmd.appdesc).toEqual("bardescriptor"); - }); - - it("throws an error for invalid multi-word arguments", function () { - expect(function () { - require(srcPath + "cmdline").parse(["--src"]); - }).toThrow(localize.translate("EXCEPTION_CMDLINE_ARG_INVALID", "--src")); - }); - -});
