You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2017/06/07 05:00:07 UTC
[48/51] [partial] cordova-lib git commit: CB-11980: removed fetch,
common and serve into their own repos
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/fc72293c/cordova-common/spec/FileUpdater.spec.js
----------------------------------------------------------------------
diff --git a/cordova-common/spec/FileUpdater.spec.js b/cordova-common/spec/FileUpdater.spec.js
deleted file mode 100644
index 21659d3..0000000
--- a/cordova-common/spec/FileUpdater.spec.js
+++ /dev/null
@@ -1,765 +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 path = require('path');
-var rewire = require('rewire');
-var FileUpdater = rewire('../src/FileUpdater');
-
-// Normally these are internal to the module; these lines use rewire to expose them for testing.
-FileUpdater.mapDirectory = FileUpdater.__get__('mapDirectory');
-FileUpdater.mergePathMaps = FileUpdater.__get__('mergePathMaps');
-FileUpdater.updatePathWithStats = FileUpdater.__get__('updatePathWithStats');
-
-// Intercept calls to the internal updatePathWithStats function,
-// so calling methods can be tested in isolation.
-FileUpdater.updatePathWithStatsCalls = [];
-FileUpdater.updatePathWithStatsResult = true;
-FileUpdater.__set__('updatePathWithStats', function () {
- FileUpdater.updatePathWithStatsCalls.push(arguments);
- return FileUpdater.updatePathWithStatsResult;
-});
-
-// Create mock fs.Stats to simulate file or directory attributes.
-function mockFileStats(modified) {
- return {
- isFile: function () { return true; },
- isDirectory: function () { return false; },
- ctime: modified,
- mtime: modified,
- };
-}
-function mockDirStats() {
- return {
- isFile: function () { return false; },
- isDirectory: function () { return true; },
- ctime: null,
- mtime: null,
- };
-}
-
-// Create a mock to replace the fs and shelljs modules used by the FileUpdater,
-// so the tests don't have to actually touch the filesystem.
-var mockFs = {
- mkdirPaths: [],
- cpPaths: [],
- rmPaths: [],
- dirMap: {},
- statMap: {},
-
- reset: function () {
- this.mkdirPaths = [];
- this.cpPaths = [];
- this.rmPaths = [];
- this.dirMap = {};
- this.statMap = {};
- },
-
- existsSync: function (fileOrDirPath) {
- return typeof(this.statMap[fileOrDirPath]) !== 'undefined';
- },
-
- readdirSync: function(dirPath) {
- var result = this.dirMap[dirPath];
- if (!result) throw new Error('Directory path not found: ' + dirPath);
- return result;
- },
-
- statSync: function (fileOrDirPath) {
- var result = this.statMap[fileOrDirPath];
- if (!result) throw new Error('File or directory path not found: ' + fileOrDirPath);
- return result;
- },
-
- mkdir: function (flags, path) {
- this.mkdirPaths.push(path);
- },
-
- cp: function (flags, sourcePath, targetPath) {
- this.cpPaths.push([sourcePath, targetPath]);
- },
-
- rm: function(flags, path) {
- this.rmPaths.push(path);
- },
-};
-FileUpdater.__set__('fs', mockFs);
-FileUpdater.__set__('shell', mockFs);
-
-// Define some constants used in the test cases.
-var testRootDir = 'testRootDir';
-var testSourceDir = 'testSourceDir';
-var testSourceDir2 = 'testSourceDir2';
-var testSourceDir3 = 'testSourceDir3';
-var testTargetDir = 'testTargetDir';
-var testSourceFile = 'testSourceFile';
-var testSourceFile2 = 'testSourceFile2';
-var testTargetFile = 'testTargetFile';
-var testTargetFile2 = 'testTargetFile2';
-var testSubDir = 'testSubDir';
-var now = new Date();
-var oneHourAgo = new Date(now.getTime() - 1*60*60*1000);
-var testDirStats = mockDirStats();
-var testFileStats = mockFileStats(now);
-var testFileStats2 = mockFileStats(now);
-var testFileStats3 = mockFileStats(now);
-var nullLogger = function (message) {};
-
-describe('FileUpdater class', function() {
-
- beforeEach(function () {
- FileUpdater.updatePathWithStatsCalls = [];
- FileUpdater.updatePathWithStatsResult = true;
- mockFs.reset();
- });
-
- describe('updatePathWithStats method', function () {
- it('Test 001 : should do nothing when a directory exists at source and target', function () {
- var updated = FileUpdater.updatePathWithStats(
- testSourceDir, mockDirStats(), testTargetDir, mockDirStats(),
- null, nullLogger);
- expect(updated).toBe(false);
- expect(mockFs.mkdirPaths.length).toBe(0);
- expect(mockFs.rmPaths.length).toBe(0);
- });
- it('Test 002 : should create a directory that exists at source and not at target', function () {
- var updated = FileUpdater.updatePathWithStats(
- testSourceDir, mockDirStats(), testTargetDir, null,
- null, nullLogger);
- expect(updated).toBe(true);
- expect(mockFs.mkdirPaths.length).toBe(1);
- expect(mockFs.rmPaths.length).toBe(0);
- expect(mockFs.mkdirPaths[0]).toBe(testTargetDir);
- });
- it('Test 003 : should remove a directory that exists at target and not at source', function () {
- var updated = FileUpdater.updatePathWithStats(
- testSourceDir, null, testTargetDir, mockDirStats(),
- null, nullLogger);
- expect(updated).toBe(true);
- expect(mockFs.mkdirPaths.length).toBe(0);
- expect(mockFs.rmPaths.length).toBe(1);
- expect(mockFs.rmPaths[0]).toBe(testTargetDir);
- });
-
- it('Test 004 : should copy when a file exists at source and target and times are the same',
- function () {
- var updated = FileUpdater.updatePathWithStats(
- testSourceFile, mockFileStats(now), testTargetFile, mockFileStats(now),
- null, nullLogger);
- expect(updated).toBe(true);
- expect(mockFs.cpPaths.length).toBe(1);
- expect(mockFs.rmPaths.length).toBe(0);
- expect(mockFs.cpPaths[0]).toEqual([testSourceFile, testTargetFile]);
- });
- it('Test 005 : should copy when a file exists at source and target and target is older',
- function () {
- var updated = FileUpdater.updatePathWithStats(
- testSourceFile, mockFileStats(now), testTargetFile, mockFileStats(oneHourAgo),
- null, nullLogger);
- expect(updated).toBe(true);
- expect(mockFs.cpPaths.length).toBe(1);
- expect(mockFs.rmPaths.length).toBe(0);
- expect(mockFs.cpPaths[0]).toEqual([testSourceFile, testTargetFile]);
- });
- it('Test 006 : should do nothing when a file exists at source and target and target is newer',
- function () {
- var updated = FileUpdater.updatePathWithStats(
- testSourceFile, mockFileStats(oneHourAgo), testTargetFile, mockFileStats(now),
- null, nullLogger);
- expect(updated).toBe(false);
- expect(mockFs.cpPaths.length).toBe(0);
- expect(mockFs.rmPaths.length).toBe(0);
- });
- it('Test 007 : should copy when a file exists at source and target and forcing update', function () {
- var updated = FileUpdater.updatePathWithStats(
- testSourceFile, mockFileStats(now), testTargetFile, mockFileStats(now),
- { all: true }, nullLogger);
- expect(updated).toBe(true);
- expect(mockFs.cpPaths.length).toBe(1);
- expect(mockFs.rmPaths.length).toBe(0);
- expect(mockFs.cpPaths[0]).toEqual([testSourceFile, testTargetFile]);
- });
- it('Test 008 : should copy when a file exists at source and target and target is newer ' +
- 'and forcing update', function () {
- var updated = FileUpdater.updatePathWithStats(
- testSourceFile, mockFileStats(oneHourAgo), testTargetFile, mockFileStats(now),
- { all: true }, nullLogger);
- expect(updated).toBe(true);
- expect(mockFs.cpPaths.length).toBe(1);
- expect(mockFs.rmPaths.length).toBe(0);
- expect(mockFs.cpPaths[0]).toEqual([testSourceFile, testTargetFile]);
- });
- it('Test 009 : should copy when a file exists at source and target and source is newer', function () {
- var updated = FileUpdater.updatePathWithStats(
- testSourceFile, mockFileStats(now), testTargetFile, mockFileStats(oneHourAgo),
- null, nullLogger);
- expect(updated).toBe(true);
- expect(mockFs.cpPaths.length).toBe(1);
- expect(mockFs.rmPaths.length).toBe(0);
- expect(mockFs.cpPaths[0]).toEqual([testSourceFile, testTargetFile]);
- });
- it('Test 010 : should copy when a file exists at source and not at target', function () {
- var updated = FileUpdater.updatePathWithStats(
- testSourceFile, mockFileStats(now), testTargetFile, null,
- null, nullLogger);
- expect(updated).toBe(true);
- expect(mockFs.cpPaths.length).toBe(1);
- expect(mockFs.rmPaths.length).toBe(0);
- expect(mockFs.cpPaths[0]).toEqual([testSourceFile, testTargetFile]);
- });
- it('Test 011 : should remove when a file exists at target and not at source', function () {
- var updated = FileUpdater.updatePathWithStats(
- testSourceFile, null, testTargetFile, mockFileStats(now),
- null, nullLogger);
- expect(updated).toBe(true);
- expect(mockFs.cpPaths.length).toBe(0);
- expect(mockFs.rmPaths.length).toBe(1);
- expect(mockFs.rmPaths[0]).toBe(testTargetFile);
- });
-
- it('Test 012 : should remove and mkdir when source is a directory and target is a file', function () {
- var updated = FileUpdater.updatePathWithStats(
- testSourceDir, mockDirStats(), testTargetDir, mockFileStats(now),
- null, nullLogger);
- expect(updated).toBe(true);
- expect(mockFs.cpPaths.length).toBe(0);
- expect(mockFs.rmPaths.length).toBe(1);
- expect(mockFs.mkdirPaths.length).toBe(1);
- expect(mockFs.rmPaths[0]).toBe(testTargetDir);
- expect(mockFs.mkdirPaths[0]).toBe(testTargetDir);
- });
- it('Test 013 : should remove and copy when source is a file and target is a directory', function () {
- var updated = FileUpdater.updatePathWithStats(
- testSourceFile, mockFileStats(now), testTargetFile, mockDirStats(),
- null, nullLogger);
- expect(updated).toBe(true);
- expect(mockFs.rmPaths.length).toBe(1);
- expect(mockFs.cpPaths.length).toBe(1);
- expect(mockFs.mkdirPaths.length).toBe(0);
- expect(mockFs.rmPaths[0]).toBe(testTargetFile);
- expect(mockFs.cpPaths[0]).toEqual([testSourceFile, testTargetFile]);
- });
-
- it('Test 014 : should join the paths when a rootDir is specified', function () {
- FileUpdater.updatePathWithStats(
- testSourceFile, mockFileStats(now), testTargetFile, null,
- { rootDir: testRootDir }, nullLogger);
- expect(mockFs.cpPaths.length).toBe(1);
- expect(mockFs.rmPaths.length).toBe(0);
- expect(mockFs.cpPaths[0]).toEqual(
- [path.join(testRootDir, testSourceFile), path.join(testRootDir, testTargetFile)]);
- });
-
- it('Test 015 : should log dir creation', function () {
- var loggedSource = 0;
- var loggedTarget = 0;
- var loggedRoot = 0;
- FileUpdater.updatePathWithStats(
- testSourceDir, mockDirStats(now), testTargetDir, null, { rootDir: testRootDir },
- function (message) {
- loggedSource += new RegExp(testSourceDir).test(message) ? 1 : 0;
- loggedTarget += new RegExp(testTargetDir).test(message) ? 1 : 0;
- loggedRoot += new RegExp(testRootDir).test(message) ? 1 : 0;
- });
- expect(loggedSource).toBe(0);
- expect(loggedTarget).toBe(1);
- expect(loggedRoot).toBe(0);
- });
- it('Test 016 : should log dir removal', function () {
- var loggedSource = 0;
- var loggedTarget = 0;
- var loggedRoot = 0;
- FileUpdater.updatePathWithStats(
- testSourceDir, null, testTargetDir, mockDirStats(now), { rootDir: testRootDir },
- function (message) {
- loggedSource += new RegExp(testSourceDir).test(message) ? 1 : 0;
- loggedTarget += new RegExp(testTargetDir).test(message) ? 1 : 0;
- loggedRoot += new RegExp(testRootDir).test(message) ? 1 : 0;
- });
- expect(loggedSource).toBe(0);
- expect(loggedTarget).toBe(1);
- expect(loggedRoot).toBe(0);
- });
- it('Test 017 : should log file copy', function () {
- var loggedSource = 0;
- var loggedTarget = 0;
- var loggedRoot = 0;
- FileUpdater.updatePathWithStats(
- testSourceFile, mockFileStats(now), testTargetFile, null, { rootDir: testRootDir },
- function (message) {
- loggedSource += new RegExp(testSourceFile).test(message) ? 1 : 0;
- loggedTarget += new RegExp(testTargetFile).test(message) ? 1 : 0;
- loggedRoot += new RegExp(testRootDir).test(message) ? 1 : 0;
- });
- expect(loggedSource).toBe(1);
- expect(loggedTarget).toBe(1);
- expect(loggedRoot).toBe(0);
- });
- it('Test 018: should log file removal', function () {
- var loggedSource = 0;
- var loggedTarget = 0;
- var loggedRoot = 0;
- var messages = [];
- FileUpdater.updatePathWithStats(
- testSourceFile, null, testTargetFile, mockFileStats(now), { rootDir: testRootDir },
- function (message) {
- loggedSource += new RegExp(testSourceFile).test(message) ? 1 : 0;
- loggedTarget += new RegExp(testTargetFile).test(message) ? 1 : 0;
- loggedRoot += new RegExp(testRootDir).test(message) ? 1 : 0;
- });
- expect(messages).toEqual([]);
- expect(loggedSource).toBe(0);
- expect(loggedTarget).toBe(1);
- expect(loggedRoot).toBe(0);
- });
- });
-
- describe('mapDirectory method', function () {
- it('Test 019 : should map an empty directory', function () {
- mockFs.statMap[path.join(testRootDir, testSourceDir)] = testDirStats;
- mockFs.dirMap[path.join(testRootDir, testSourceDir)] = [];
- var dirMap = FileUpdater.mapDirectory(testRootDir, testSourceDir, ['**'], []);
- expect(Object.keys(dirMap)).toEqual(['']);
- expect(dirMap[''].subDir).toBe(testSourceDir);
- expect(dirMap[''].stats).toBe(testDirStats);
- });
- it('Test 020 : should map a directory with a file', function () {
- mockFs.statMap[path.join(testRootDir, testSourceDir)] = testDirStats;
- mockFs.dirMap[path.join(testRootDir, testSourceDir)] = [testSourceFile];
- mockFs.statMap[path.join(testRootDir, testSourceDir, testSourceFile)] = testFileStats;
- var dirMap = FileUpdater.mapDirectory(testRootDir, testSourceDir, ['**'], []);
- expect(Object.keys(dirMap).sort()).toEqual(['', testSourceFile]);
- expect(dirMap[''].subDir).toBe(testSourceDir);
- expect(dirMap[''].stats).toBe(testDirStats);
- expect(dirMap[testSourceFile].subDir).toBe(testSourceDir);
- expect(dirMap[testSourceFile].stats).toBe(testFileStats);
- });
- it('Test 021 : should map a directory with a subdirectory', function () {
- mockFs.statMap[testSourceDir] = testDirStats;
- mockFs.dirMap[testSourceDir] = [testSubDir];
- mockFs.statMap[path.join(testSourceDir, testSubDir)] = testDirStats;
- mockFs.dirMap[path.join(testSourceDir, testSubDir)] = [];
- var dirMap = FileUpdater.mapDirectory('', testSourceDir, ['**'], []);
- expect(Object.keys(dirMap).sort()).toEqual(['', testSubDir]);
- expect(dirMap[''].subDir).toBe(testSourceDir);
- expect(dirMap[''].stats).toBe(testDirStats);
- expect(dirMap[testSubDir].subDir).toBe(testSourceDir);
- expect(dirMap[testSubDir].stats).toBe(testDirStats);
- });
- it('Test 022 : should map a directory with a file in a nested subdirectory', function () {
- mockFs.statMap[testSourceDir] = testDirStats;
- mockFs.dirMap[testSourceDir] = [testSubDir];
- mockFs.statMap[path.join(testSourceDir, testSubDir)] = testDirStats;
- mockFs.dirMap[path.join(testSourceDir, testSubDir)] = [testSubDir];
- mockFs.statMap[path.join(testSourceDir, testSubDir, testSubDir)] = testDirStats;
- mockFs.dirMap[path.join(testSourceDir, testSubDir, testSubDir)] = [testSourceFile];
- mockFs.statMap[path.join(testSourceDir, testSubDir, testSubDir, testSourceFile)] =
- testFileStats;
- var dirMap = FileUpdater.mapDirectory('', testSourceDir, ['**'], []);
- expect(Object.keys(dirMap).sort()).toEqual([
- '',
- testSubDir,
- path.join(testSubDir, testSubDir),
- path.join(testSubDir, testSubDir, testSourceFile)]);
- expect(dirMap[''].subDir).toBe(testSourceDir);
- expect(dirMap[''].stats).toBe(testDirStats);
- expect(dirMap[testSubDir].subDir).toBe(testSourceDir);
- expect(dirMap[testSubDir].stats).toBe(testDirStats);
- expect(dirMap[path.join(testSubDir, testSubDir)].subDir).toBe(testSourceDir);
- expect(dirMap[path.join(testSubDir, testSubDir)].stats).toBe(testDirStats);
- expect(dirMap[path.join(testSubDir, testSubDir, testSourceFile)].subDir).toBe(
- testSourceDir);
- expect(dirMap[path.join(testSubDir, testSubDir, testSourceFile)].stats).toBe(
- testFileStats);
- });
-
- it('Test 023 : should include files that match include globs', function () {
- mockFs.statMap[testSourceDir] = testDirStats;
- mockFs.dirMap[testSourceDir] = [testSourceFile, testSourceFile2];
- mockFs.statMap[path.join(testSourceDir, testSourceFile)] = testFileStats;
- mockFs.statMap[path.join(testSourceDir, testSourceFile2)] = testFileStats;
- var dirMap = FileUpdater.mapDirectory('', testSourceDir, [testSourceFile], []);
- expect(Object.keys(dirMap).sort()).toEqual(['', testSourceFile]);
- expect(dirMap[''].subDir).toBe(testSourceDir);
- expect(dirMap[''].stats).toBe(testDirStats);
- expect(dirMap[testSourceFile].subDir).toBe(testSourceDir);
- expect(dirMap[testSourceFile].stats).toBe(testFileStats);
- });
- it('Test 024 : should include files in a subdirectory that match include globs', function () {
- mockFs.statMap[testSourceDir] = testDirStats;
- mockFs.dirMap[testSourceDir] = [testSubDir];
- mockFs.statMap[path.join(testSourceDir, testSubDir)] = testDirStats;
- mockFs.dirMap[path.join(testSourceDir, testSubDir)] =
- [testSourceFile, testSourceFile2];
- mockFs.statMap[path.join(testSourceDir, testSubDir, testSourceFile)] = testFileStats;
- mockFs.statMap[path.join(testSourceDir, testSubDir, testSourceFile2)] = testFileStats;
- var dirMap = FileUpdater.mapDirectory('', testSourceDir, ['**/' + testSourceFile], []);
- expect(Object.keys(dirMap).sort()).toEqual([
- '',
- testSubDir,
- path.join(testSubDir, testSourceFile)]);
- expect(dirMap[''].subDir).toBe(testSourceDir);
- expect(dirMap[''].stats).toBe(testDirStats);
- expect(dirMap[path.join(testSubDir, testSourceFile)].subDir).toBe(testSourceDir);
- expect(dirMap[path.join(testSubDir, testSourceFile)].stats).toBe(testFileStats);
- });
- it('Test 025 : should exclude paths that match exclude globs', function () {
- mockFs.statMap[testSourceDir] = testDirStats;
- mockFs.dirMap[testSourceDir] = [testSourceFile, testSourceFile2];
- mockFs.statMap[path.join(testSourceDir, testSourceFile)] = testFileStats;
- mockFs.statMap[path.join(testSourceDir, testSourceFile2)] = testFileStats;
- var dirMap = FileUpdater.mapDirectory('', testSourceDir, ['**'], [testSourceFile2]);
- expect(Object.keys(dirMap).sort()).toEqual(['', testSourceFile]);
- expect(dirMap[''].subDir).toBe(testSourceDir);
- expect(dirMap[''].stats).toBe(testDirStats);
- expect(dirMap[testSourceFile].subDir).toBe(testSourceDir);
- expect(dirMap[testSourceFile].stats).toBe(testFileStats);
- });
- it('Test 026 : should exclude paths that match both exclude and include globs', function () {
- mockFs.statMap[testSourceDir] = testDirStats;
- mockFs.dirMap[testSourceDir] = [testSubDir];
- mockFs.statMap[path.join(testSourceDir, testSubDir)] = testDirStats;
- mockFs.dirMap[path.join(testSourceDir, testSubDir)] =
- [testSourceFile, testSourceFile2];
- mockFs.statMap[path.join(testSourceDir, testSubDir, testSourceFile)] = testFileStats;
- mockFs.statMap[path.join(testSourceDir, testSubDir, testSourceFile2)] = testFileStats;
- var dirMap = FileUpdater.mapDirectory(
- '', testSourceDir, ['**/' + testSourceFile], [testSubDir]);
- expect(Object.keys(dirMap).sort()).toEqual(['']);
- expect(dirMap[''].subDir).toBe(testSourceDir);
- expect(dirMap[''].stats).toBe(testDirStats);
- });
- });
-
- describe('mergePathMaps method', function () {
- var testTargetFileStats = mockFileStats(oneHourAgo);
- var testSourceFileStats = mockFileStats(now);
- var testSourceFileStats2 = mockFileStats(now);
- var testSourceFileStats3 = mockFileStats(now);
- it('Test 027 : should prepend the target directory on target paths', function () {
- var mergedPathMap = FileUpdater.mergePathMaps(
- [{
- '': { subDir: testSourceDir, stats: testDirStats },
- testTargetFile: { subDir: testSourceDir, stats: testSourceFileStats },
- }],
- {
- '': { subDir: testTargetDir, stats: testDirStats },
- testTargetFile: { subDir: testTargetDir, stats: testTargetFileStats },
- },
- testTargetDir);
- expect(Object.keys(mergedPathMap).sort()).toEqual(['', testTargetFile]);
- expect(mergedPathMap[''].targetPath).toBe(testTargetDir);
- expect(mergedPathMap[''].targetStats).toBe(testDirStats);
- expect(mergedPathMap[''].sourcePath).toBe(testSourceDir);
- expect(mergedPathMap[''].sourceStats).toBe(testDirStats);
- expect(mergedPathMap[testTargetFile].targetPath).toBe(
- path.join(testTargetDir, testTargetFile));
- expect(mergedPathMap[testTargetFile].targetStats).toBe(testTargetFileStats);
- expect(mergedPathMap[testTargetFile].sourcePath).toBe(
- path.join(testSourceDir, testTargetFile));
- expect(mergedPathMap[testTargetFile].sourceStats).toBe(testSourceFileStats);
- });
- it('Test 028 : should handle missing source files', function () {
- var mergedPathMap = FileUpdater.mergePathMaps(
- [{}],
- {
- testTargetFile: { subDir: testTargetDir, stats: testTargetFileStats },
- },
- testTargetDir);
- expect(Object.keys(mergedPathMap).sort()).toEqual([testTargetFile]);
- expect(mergedPathMap[testTargetFile].targetPath).toBe(
- path.join(testTargetDir, testTargetFile));
- expect(mergedPathMap[testTargetFile].targetStats).toBe(testTargetFileStats);
- expect(mergedPathMap[testTargetFile].sourcePath).toBeNull();
- expect(mergedPathMap[testTargetFile].sourceStats).toBeNull();
- });
- it('Tets 029 : should handle missing target files', function () {
- var mergedPathMap = FileUpdater.mergePathMaps(
- [{
- testTargetFile: { subDir: testSourceDir, stats: testSourceFileStats },
- }],
- {},
- testTargetDir);
- expect(Object.keys(mergedPathMap).sort()).toEqual([testTargetFile]);
- expect(mergedPathMap[testTargetFile].targetPath).toBe(
- path.join(testTargetDir, testTargetFile));
- expect(mergedPathMap[testTargetFile].targetStats).toBeNull();
- expect(mergedPathMap[testTargetFile].sourcePath).toBe(
- path.join(testSourceDir, testTargetFile));
- expect(mergedPathMap[testTargetFile].sourceStats).toBe(testSourceFileStats);
- });
- it('Test 030 : should merge three source maps', function () {
- var mergedPathMap = FileUpdater.mergePathMaps(
- [
- {
- '': { subDir: testSourceDir, stats: testDirStats },
- testTargetFile: { subDir: testSourceDir, stats: testSourceFileStats },
- },
- {
- '': { subDir: testSourceDir2, stats: testDirStats },
- testTargetFile: { subDir: testSourceDir2, stats: testSourceFileStats2 },
- testTargetFile2: { subDir: testSourceDir2, stats: testSourceFileStats2 },
- },
- {
- '': { subDir: testSourceDir3, stats: testDirStats },
- testTargetFile2: { subDir: testSourceDir3, stats: testSourceFileStats3 },
- },
- ],
- {
- '': { subDir: testTargetDir, stats: testDirStats },
- testTargetFile: { subDir: testTargetDir, stats: testTargetFileStats },
- },
- testTargetDir);
- expect(Object.keys(mergedPathMap).sort()).toEqual(
- ['', testTargetFile, testTargetFile2]);
- expect(mergedPathMap[''].targetPath).toBe(testTargetDir);
- expect(mergedPathMap[''].targetStats).toBe(testDirStats);
- expect(mergedPathMap[''].sourcePath).toBe(testSourceDir3);
- expect(mergedPathMap[''].sourceStats).toBe(testDirStats);
- expect(mergedPathMap[testTargetFile].targetPath).toBe(
- path.join(testTargetDir, testTargetFile));
- expect(mergedPathMap[testTargetFile].targetStats).toBe(testTargetFileStats);
- expect(mergedPathMap[testTargetFile].sourcePath).toBe(
- path.join(testSourceDir2, testTargetFile));
- expect(mergedPathMap[testTargetFile].sourceStats).toBe(testSourceFileStats2);
- expect(mergedPathMap[testTargetFile2].targetPath).toBe(
- path.join(testTargetDir, testTargetFile2));
- expect(mergedPathMap[testTargetFile2].targetStats).toBeNull();
- expect(mergedPathMap[testTargetFile2].sourcePath).toBe(
- path.join(testSourceDir3, testTargetFile2));
- expect(mergedPathMap[testTargetFile2].sourceStats).toBe(testSourceFileStats3);
- });
- });
-
- describe('updatePath method', function () {
- it('Test 031 : should update a path', function () {
- mockFs.statMap[testRootDir] = testDirStats;
- mockFs.statMap[path.join(testRootDir, testTargetFile)] = testFileStats;
- mockFs.statMap[path.join(testRootDir, testSourceFile)] = testFileStats2;
- var updated = FileUpdater.updatePath(
- testSourceFile, testTargetFile, { rootDir: testRootDir, all: true });
- expect(updated).toBe(true);
- expect(FileUpdater.updatePathWithStatsCalls.length).toBe(1);
- expect(FileUpdater.updatePathWithStatsCalls[0][0]).toBe(testSourceFile);
- expect(FileUpdater.updatePathWithStatsCalls[0][1]).toEqual(testFileStats2);
- expect(FileUpdater.updatePathWithStatsCalls[0][2]).toBe(testTargetFile);
- expect(FileUpdater.updatePathWithStatsCalls[0][3]).toEqual(testFileStats);
- expect(FileUpdater.updatePathWithStatsCalls[0][4]).toEqual(
- {rootDir: testRootDir, all: true });
- });
- it('Test 032 : should update a path without a separate root directory', function () {
- mockFs.statMap[testTargetFile] = testFileStats;
- mockFs.statMap[testSourceFile] = testFileStats2;
- FileUpdater.updatePathWithStatsResult = false;
- var updated = FileUpdater.updatePath(testSourceFile, testTargetFile);
- expect(updated).toBe(false);
- expect(FileUpdater.updatePathWithStatsCalls.length).toBe(1);
- expect(FileUpdater.updatePathWithStatsCalls[0][0]).toBe(testSourceFile);
- expect(FileUpdater.updatePathWithStatsCalls[0][1]).toEqual(testFileStats2);
- expect(FileUpdater.updatePathWithStatsCalls[0][2]).toBe(testTargetFile);
- expect(FileUpdater.updatePathWithStatsCalls[0][3]).toEqual(testFileStats);
- expect(FileUpdater.updatePathWithStatsCalls[0][4]).toBeUndefined();
- });
- it('Test 033 : should update a path when the source doesn\'t exist', function () {
- mockFs.statMap[testTargetFile] = testFileStats;
- var updated = FileUpdater.updatePath(null, testTargetFile);
- expect(updated).toBe(true);
- expect(FileUpdater.updatePathWithStatsCalls.length).toBe(1);
- expect(FileUpdater.updatePathWithStatsCalls[0][0]).toBeNull();
- expect(FileUpdater.updatePathWithStatsCalls[0][1]).toBeNull();
- expect(FileUpdater.updatePathWithStatsCalls[0][2]).toBe(testTargetFile);
- expect(FileUpdater.updatePathWithStatsCalls[0][3]).toEqual(testFileStats);
- expect(FileUpdater.updatePathWithStatsCalls[0][4]).toBeUndefined();
- });
- it('Test 034 : should update a path when the target doesn\'t exist', function () {
- mockFs.statMap[testSourceFile] = testFileStats2;
- var updated = FileUpdater.updatePath(testSourceFile, testTargetFile);
- expect(updated).toBe(true);
- expect(FileUpdater.updatePathWithStatsCalls.length).toBe(1);
- expect(FileUpdater.updatePathWithStatsCalls[0][0]).toBe(testSourceFile);
- expect(FileUpdater.updatePathWithStatsCalls[0][1]).toEqual(testFileStats2);
- expect(FileUpdater.updatePathWithStatsCalls[0][2]).toBe(testTargetFile);
- expect(FileUpdater.updatePathWithStatsCalls[0][3]).toBeNull();
- expect(FileUpdater.updatePathWithStatsCalls[0][4]).toBeUndefined();
- });
- it('Test 035 : should create the target\'s parent directory if it doesn\'t exist',
- function () {
- mockFs.statMap[path.join(testRootDir, testSourceFile)] = testFileStats2;
- var updated = FileUpdater.updatePath(
- testSourceFile, testTargetFile, { rootDir: testRootDir });
- expect(updated).toBe(true);
- expect(FileUpdater.updatePathWithStatsCalls.length).toBe(1);
- expect(FileUpdater.updatePathWithStatsCalls[0][0]).toBe(testSourceFile);
- expect(FileUpdater.updatePathWithStatsCalls[0][1]).toEqual(testFileStats2);
- expect(FileUpdater.updatePathWithStatsCalls[0][2]).toBe(testTargetFile);
- expect(FileUpdater.updatePathWithStatsCalls[0][3]).toBeNull();
- expect(FileUpdater.updatePathWithStatsCalls[0][4]).toEqual({rootDir: testRootDir });
- expect(mockFs.mkdirPaths.length).toBe(1);
- expect(mockFs.mkdirPaths[0]).toBe(testRootDir);
- });
- });
-
- describe('mergeAndUpdateDir method', function () {
- it('Test 036 : should update files from merged source directories', function () {
- mockFs.statMap[testTargetDir] = testDirStats;
- mockFs.dirMap[testTargetDir] = [testSubDir];
- mockFs.statMap[path.join(testTargetDir, testSubDir)] = testDirStats;
- mockFs.dirMap[path.join(testTargetDir, testSubDir)] = [testSourceFile];
- mockFs.statMap[path.join(testTargetDir, testSubDir, testSourceFile)] =
- testFileStats;
-
- mockFs.statMap[testSourceDir] = testDirStats;
- mockFs.dirMap[testSourceDir] = [testSubDir];
- mockFs.statMap[path.join(testSourceDir, testSubDir)] = testDirStats;
- mockFs.dirMap[path.join(testSourceDir, testSubDir)] = [testSourceFile];
- mockFs.statMap[path.join(testSourceDir, testSubDir, testSourceFile)] =
- testFileStats2;
-
- mockFs.statMap[testSourceDir2] = testDirStats;
- mockFs.dirMap[testSourceDir2] = [testSubDir];
- mockFs.statMap[path.join(testSourceDir2, testSubDir)] = testDirStats;
- mockFs.dirMap[path.join(testSourceDir2, testSubDir)] = [testSourceFile2];
- mockFs.statMap[path.join(testSourceDir2, testSubDir, testSourceFile2)] =
- testFileStats3;
-
- var updated = FileUpdater.mergeAndUpdateDir(
- [testSourceDir, testSourceDir2], testTargetDir);
- expect(updated).toBe(true);
- expect(FileUpdater.updatePathWithStatsCalls.length).toBe(4);
-
- function validateUpdatePathWithStatsCall(
- index, subPath, sourceDir, sourceStats, targetDir, targetStats) {
- var args = FileUpdater.updatePathWithStatsCalls[index];
- expect(args[0]).toBe(path.join(sourceDir, subPath));
- expect(args[1]).toEqual(sourceStats);
- expect(args[2]).toBe(path.join(targetDir, subPath));
- expect(args[3]).toEqual(targetStats);
- expect(args[4]).toBeUndefined();
- }
-
- // Update the root directory.
- validateUpdatePathWithStatsCall(
- 0,
- '',
- testSourceDir2,
- testDirStats,
- testTargetDir,
- testDirStats);
- // Update the subdirectory.
- validateUpdatePathWithStatsCall(
- 1,
- testSubDir,
- testSourceDir2,
- testDirStats,
- testTargetDir,
- testDirStats);
- // Update the first file, from the first source.
- validateUpdatePathWithStatsCall(
- 2,
- path.join(testSubDir, testSourceFile),
- testSourceDir,
- testFileStats2,
- testTargetDir,
- testFileStats);
- // Update the second file, from the second source.
- validateUpdatePathWithStatsCall(
- 3,
- path.join(testSubDir, testSourceFile2),
- testSourceDir2,
- testFileStats3,
- testTargetDir,
- null);
- });
-
- it('Test 037 : should update files from merged source directories - with a rootDir', function () {
- var rootDir = path.join('Users', 'me');
- mockFs.statMap[rootDir] = testDirStats;
- mockFs.dirMap[rootDir] = [testSourceDir, testSourceDir2, testTargetDir];
-
- mockFs.statMap[path.join(rootDir, testTargetDir)] = testDirStats;
- mockFs.dirMap[path.join(rootDir, testTargetDir)] = [testSubDir];
- mockFs.statMap[path.join(rootDir, testTargetDir, testSubDir)] = testDirStats;
- mockFs.dirMap[path.join(rootDir, testTargetDir, testSubDir)] = [testSourceFile];
- mockFs.statMap[path.join(rootDir, testTargetDir, testSubDir, testSourceFile)] =
- testFileStats;
-
- mockFs.statMap[path.join(rootDir, testSourceDir)] = testDirStats;
- mockFs.dirMap[path.join(rootDir, testSourceDir)] = [testSubDir];
- mockFs.statMap[path.join(rootDir, testSourceDir, testSubDir)] = testDirStats;
- mockFs.dirMap[path.join(rootDir, testSourceDir, testSubDir)] = [testSourceFile];
- mockFs.statMap[path.join(rootDir, testSourceDir, testSubDir, testSourceFile)] =
- testFileStats2;
-
- mockFs.statMap[path.join(rootDir, testSourceDir2)] = testDirStats;
- mockFs.dirMap[path.join(rootDir, testSourceDir2)] = [testSubDir];
- mockFs.statMap[path.join(rootDir, testSourceDir2, testSubDir)] = testDirStats;
- mockFs.dirMap[path.join(rootDir, testSourceDir2, testSubDir)] = [testSourceFile2];
- mockFs.statMap[path.join(rootDir, testSourceDir2, testSubDir, testSourceFile2)] =
- testFileStats3;
-
- var updated = FileUpdater.mergeAndUpdateDir(
- [testSourceDir, testSourceDir2], testTargetDir, { rootDir: rootDir });
- expect(updated).toBe(true);
- expect(FileUpdater.updatePathWithStatsCalls.length).toBe(4);
-
- function validateUpdatePathWithStatsCall(
- index, subPath, sourceDir, sourceStats, targetDir, targetStats) {
- var args = FileUpdater.updatePathWithStatsCalls[index];
- expect(args[0]).toBe(path.join(sourceDir, subPath));
- expect(args[1]).toEqual(sourceStats);
- expect(args[2]).toBe(path.join(targetDir, subPath));
- expect(args[3]).toEqual(targetStats);
- expect(args[4]).toBeDefined(); // rootDir is defined
- }
-
- // Update the root directory.
- validateUpdatePathWithStatsCall(
- 0,
- '',
- testSourceDir2,
- testDirStats,
- testTargetDir,
- testDirStats);
- // Update the subdirectory.
- validateUpdatePathWithStatsCall(
- 1,
- testSubDir,
- testSourceDir2,
- testDirStats,
- testTargetDir,
- testDirStats);
- // Update the first file, from the first source.
- validateUpdatePathWithStatsCall(
- 2,
- path.join(testSubDir, testSourceFile),
- testSourceDir,
- testFileStats2,
- testTargetDir,
- testFileStats);
- // Update the second file, from the second source.
- validateUpdatePathWithStatsCall(
- 3,
- path.join(testSubDir, testSourceFile2),
- testSourceDir2,
- testFileStats3,
- testTargetDir,
- null);
- });
-
- });
-});
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/fc72293c/cordova-common/spec/PlatformJson.spec.js
----------------------------------------------------------------------
diff --git a/cordova-common/spec/PlatformJson.spec.js b/cordova-common/spec/PlatformJson.spec.js
deleted file mode 100644
index f3ce22b..0000000
--- a/cordova-common/spec/PlatformJson.spec.js
+++ /dev/null
@@ -1,160 +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 rewire = require('rewire');
-var PlatformJson = rewire('../src/PlatformJson');
-var ModuleMetadata = PlatformJson.__get__('ModuleMetadata');
-
-var FAKE_MODULE = {
- name: 'fakeModule',
- src: 'www/fakeModule.js',
- clobbers: [{target: 'window.fakeClobber'}],
- merges: [{target: 'window.fakeMerge'}],
- runs: true
-};
-
-describe('PlatformJson class', function() {
- it('Test 001 : should be constructable', function () {
- expect(new PlatformJson()).toEqual(jasmine.any(PlatformJson));
- });
-
- describe('instance', function () {
- var platformJson;
- var fakePlugin;
-
- beforeEach(function () {
- platformJson = new PlatformJson('/fake/path', 'android');
- fakePlugin = jasmine.createSpyObj('fakePlugin', ['getJsModules']);
- fakePlugin.id = 'fakeId';
- fakePlugin.version = '1.0.0';
- fakePlugin.getJsModules.and.returnValue([FAKE_MODULE]);
- });
-
- describe('addPluginMetadata method', function () {
- it('Test 002 : should not throw if root "modules" property is missing', function () {
- expect(function () {
- platformJson.addPluginMetadata(fakePlugin);
- }).not.toThrow();
- });
-
- it('Test 003 : should add each module to "root.modules" array', function () {
- platformJson.addPluginMetadata(fakePlugin);
- expect(platformJson.root.modules.length).toBe(1);
- expect(platformJson.root.modules[0]).toEqual(jasmine.any(ModuleMetadata));
- });
-
- it('Test 004 : shouldn\'t add module if there is already module with the same file added', function () {
- platformJson.root.modules = [{
- name: 'fakePlugin2',
- file: 'plugins/fakeId/www/fakeModule.js'
- }];
-
- platformJson.addPluginMetadata(fakePlugin);
- expect(platformJson.root.modules.length).toBe(1);
- expect(platformJson.root.modules[0].name).toBe('fakePlugin2');
- });
-
- it('Test 005 : should add entry to plugin_metadata with corresponding version', function () {
- platformJson.addPluginMetadata(fakePlugin);
- expect(platformJson.root.plugin_metadata[fakePlugin.id]).toBe(fakePlugin.version);
- });
- });
-
- describe('removePluginMetadata method', function () {
- it('Test 006 : should not throw if root "modules" property is missing', function () {
- expect(function () {
- platformJson.removePluginMetadata(fakePlugin);
- }).not.toThrow();
- });
-
- it('Test 007 : should remove plugin modules from "root.modules" array based on file path', function () {
-
- var pluginPaths = [
- 'plugins/fakeId/www/fakeModule.js',
- 'plugins/otherPlugin/www/module1.js',
- 'plugins/otherPlugin/www/module1.js'
- ];
-
- platformJson.root.modules = pluginPaths.map(function (p) { return {file: p}; });
- platformJson.removePluginMetadata(fakePlugin);
- var resultantPaths = platformJson.root.modules
- .map(function (p) { return p.file; })
- .filter(function (f) { return /fakeModule\.js$/.test(f); });
-
- expect(resultantPaths.length).toBe(0);
- });
-
- it('Test 008 : should remove entry from plugin_metadata with corresponding version', function () {
- platformJson.root.plugin_metadata = {};
- platformJson.root.plugin_metadata[fakePlugin.id] = fakePlugin.version;
- platformJson.removePluginMetadata(fakePlugin);
- expect(platformJson.root.plugin_metadata[fakePlugin.id]).not.toBeDefined();
- });
- });
-
- describe('generateMetadata method', function () {
- it('Test 009 : should generate text metadata containing list of installed modules', function () {
- var meta = platformJson.addPluginMetadata(fakePlugin).generateMetadata();
- expect(typeof meta).toBe('string');
- expect(meta.indexOf(JSON.stringify(platformJson.root.modules, null, 2))).toBeGreaterThan(0);
- // expect(meta).toMatch(JSON.stringify(platformJson.root.modules, null, 2));
- expect(meta).toMatch(JSON.stringify(platformJson.root.plugin_metadata, null, 2));
- });
- });
- });
-});
-
-describe('ModuleMetadata class', function () {
- it('Test 010 : should be constructable', function () {
- var meta;
- expect(function name(params) {
- meta = new ModuleMetadata('fakePlugin', {src: 'www/fakeModule.js'});
- }).not.toThrow();
- expect(meta instanceof ModuleMetadata).toBeTruthy();
- });
-
- it('Test 011 : should throw if either pluginId or jsModule argument isn\'t specified', function () {
- expect(ModuleMetadata).toThrow();
- expect(function () { new ModuleMetadata('fakePlugin', {}); }).toThrow();
- });
-
- it('Test 012 : should guess module id either from name property of from module src', function () {
- expect(new ModuleMetadata('fakePlugin', {name: 'fakeModule'}).id).toMatch(/fakeModule$/);
- expect(new ModuleMetadata('fakePlugin', {src: 'www/fakeModule.js'}).id).toMatch(/fakeModule$/);
- });
-
- it('Test 013 : should read "clobbers" property from module', function () {
- expect(new ModuleMetadata('fakePlugin', {name: 'fakeModule'}).clobbers).not.toBeDefined();
- var metadata = new ModuleMetadata('fakePlugin', FAKE_MODULE);
- expect(metadata.clobbers).toEqual(jasmine.any(Array));
- expect(metadata.clobbers[0]).toBe(FAKE_MODULE.clobbers[0].target);
- });
-
- it('Test 014 : should read "merges" property from module', function () {
- expect(new ModuleMetadata('fakePlugin', {name: 'fakeModule'}).merges).not.toBeDefined();
- var metadata = new ModuleMetadata('fakePlugin', FAKE_MODULE);
- expect(metadata.merges).toEqual(jasmine.any(Array));
- expect(metadata.merges[0]).toBe(FAKE_MODULE.merges[0].target);
- });
-
- it('Test 015 : should read "runs" property from module', function () {
- expect(new ModuleMetadata('fakePlugin', {name: 'fakeModule'}).runs).not.toBeDefined();
- expect(new ModuleMetadata('fakePlugin', FAKE_MODULE).runs).toBe(true);
- });
-});
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/fc72293c/cordova-common/spec/PluginInfo/PluginInfo.spec.js
----------------------------------------------------------------------
diff --git a/cordova-common/spec/PluginInfo/PluginInfo.spec.js b/cordova-common/spec/PluginInfo/PluginInfo.spec.js
deleted file mode 100644
index e509913..0000000
--- a/cordova-common/spec/PluginInfo/PluginInfo.spec.js
+++ /dev/null
@@ -1,50 +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 PluginInfo = require('../../src/PluginInfo/PluginInfo'),
- path = require('path');
-
-var pluginsDir = path.join(__dirname, '../fixtures/plugins');
-
-describe('PluginInfo', function () {
- it('Test 001 : should read a plugin.xml file', function () {
- var p, prefs, assets, deps, configFiles, infos, srcFiles;
- var headerFiles, libFiles, resourceFiles;
- expect(function () {
- p = new PluginInfo(path.join(pluginsDir, 'ChildBrowser'));
- prefs = p.getPreferences('android');
- assets = p.getAssets('android');
- deps = p.getDependencies('android');
- configFiles = p.getConfigFiles('android');
- infos = p.getInfo('android');
- srcFiles = p.getSourceFiles('android');
- headerFiles = p.getHeaderFiles('android');
- libFiles = p.getLibFiles('android');
- resourceFiles = p.getResourceFiles('android');
- }).not.toThrow();
- expect(p).toBeDefined();
- expect(p.name).toEqual('Child Browser');
- // TODO: Add some expectations for results of getSomething.
- });
- it('Test 002 : should throw when there is no plugin.xml file', function () {
- expect(function () {
- new PluginInfo('/non/existent/dir');
- }).toThrow();
- });
-});
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/fc72293c/cordova-common/spec/PluginInfo/PluginInfoProvider.spec.js
----------------------------------------------------------------------
diff --git a/cordova-common/spec/PluginInfo/PluginInfoProvider.spec.js b/cordova-common/spec/PluginInfo/PluginInfoProvider.spec.js
deleted file mode 100644
index 9c86501..0000000
--- a/cordova-common/spec/PluginInfo/PluginInfoProvider.spec.js
+++ /dev/null
@@ -1,33 +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 PluginInfoProvider = require('../../src/PluginInfo/PluginInfoProvider'),
- path = require('path');
-
-var pluginsDir = path.join(__dirname, '../fixtures/plugins');
-
-describe('PluginInfoProvider', function () {
- describe('getAllWithinSearchPath', function () {
- it('Test 001 : should load all plugins in a dir', function () {
- var pluginInfoProvider = new PluginInfoProvider();
- var plugins = pluginInfoProvider.getAllWithinSearchPath(pluginsDir);
- expect(plugins.length).not.toBe(0);
- });
- });
-});
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/fc72293c/cordova-common/spec/PluginManager.spec.js
----------------------------------------------------------------------
diff --git a/cordova-common/spec/PluginManager.spec.js b/cordova-common/spec/PluginManager.spec.js
deleted file mode 100644
index 7f6d7e8..0000000
--- a/cordova-common/spec/PluginManager.spec.js
+++ /dev/null
@@ -1,137 +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.
-*/
-
-// Promise-matchers do not work with jasmine 2.0.
-//require('promise-matchers');
-
-var Q = require('q');
-var fs = require('fs');
-var path = require('path');
-var shell = require('shelljs');
-var rewire = require('rewire');
-var PluginManager = rewire('../src/PluginManager');
-var PluginInfo = require('../src/PluginInfo/PluginInfo');
-var ConfigChanges = require('../src/ConfigChanges/ConfigChanges');
-
-var DUMMY_PLUGIN = path.join(__dirname, 'fixtures/plugins/org.test.plugins.dummyplugin');
-var FAKE_PLATFORM = 'cordova-atari';
-var FAKE_LOCATIONS = {
- root: '/some/fake/path',
- platformWww: '/some/fake/path/platform_www',
- www: '/some/www/dir'
-};
-
-describe('PluginManager class', function() {
-
- beforeEach(function () {
- spyOn(ConfigChanges, 'PlatformMunger');
- spyOn(fs, 'writeFileSync');
- spyOn(shell, 'mkdir');
- });
-
- it('Test 001 : should be constructable', function () {
- expect(new PluginManager(FAKE_PLATFORM, FAKE_LOCATIONS)).toEqual(jasmine.any(PluginManager));
- });
-
- it('Test 002 : should return new instance for every PluginManager.get call', function () {
- expect(PluginManager.get(FAKE_PLATFORM, FAKE_LOCATIONS)).toEqual(jasmine.any(PluginManager));
- expect(PluginManager.get(FAKE_PLATFORM, FAKE_LOCATIONS))
- .not.toBe(PluginManager.get(FAKE_PLATFORM, FAKE_LOCATIONS));
- });
-
- describe('instance', function () {
- var actions, manager;
- var FAKE_PROJECT;
- var fail = jasmine.createSpy('fail');
- var ActionStackOrig = PluginManager.__get__('ActionStack');
-
- beforeEach(function () {
- FAKE_PROJECT = jasmine.createSpyObj('project', ['getInstaller', 'getUninstaller', 'write']);
- manager = new PluginManager('windows', FAKE_LOCATIONS, FAKE_PROJECT);
- actions = jasmine.createSpyObj('actions', ['createAction', 'push', 'process']);
- actions.process.and.returnValue(Q.resolve());
- PluginManager.__set__('ActionStack', function () { return actions; });
- });
-
- afterEach(function () {
- PluginManager.__set__('ActionStack', ActionStackOrig);
- });
-
- describe('addPlugin method', function () {
- it('should return a promise', function () {
- expect(Q.isPromise(manager.addPlugin(null, {}))).toBe(true);
- });
- // Promise-matchers do not work with jasmine 2.0.
- xit('Test 003 : should reject if "plugin" parameter is not specified or not a PluginInfo instance', function (done) {
- expect(manager.addPlugin(null, {})).toHaveBeenRejected(done);
- expect(manager.addPlugin({}, {})).toHaveBeenRejected(done);
- expect(manager.addPlugin(new PluginInfo(DUMMY_PLUGIN), {})).not.toHaveBeenRejected(done);
- });
-
- it('Test 004 : should iterate through all plugin\'s files and frameworks', function (done) {
- manager.addPlugin(new PluginInfo(DUMMY_PLUGIN), {})
- .then(function () {
- expect(FAKE_PROJECT.getInstaller.calls.count()).toBe(16);
- expect(FAKE_PROJECT.getUninstaller.calls.count()).toBe(16);
-
- expect(actions.push.calls.count()).toBe(16);
- expect(actions.process).toHaveBeenCalled();
- expect(FAKE_PROJECT.write).toHaveBeenCalled();
- })
- .fail(fail)
- .done(function () {
- expect(fail).not.toHaveBeenCalled();
- done();
- });
- });
-
- it('Test 005 : should save plugin metadata to www directory', function (done) {
- var metadataPath = path.join(manager.locations.www, 'cordova_plugins.js');
- var platformWwwMetadataPath = path.join(manager.locations.platformWww, 'cordova_plugins.js');
-
- manager.addPlugin(new PluginInfo(DUMMY_PLUGIN), {})
- .then(function () {
- expect(fs.writeFileSync).toHaveBeenCalledWith(metadataPath, jasmine.any(String), 'utf-8');
- expect(fs.writeFileSync).not.toHaveBeenCalledWith(platformWwwMetadataPath, jasmine.any(String), 'utf-8');
- })
- .fail(fail)
- .done(function () {
- expect(fail).not.toHaveBeenCalled();
- done();
- });
- });
-
- it('Test 006 : should save plugin metadata to both www ans platform_www directories when options.usePlatformWww is specified', function (done) {
- var metadataPath = path.join(manager.locations.www, 'cordova_plugins.js');
- var platformWwwMetadataPath = path.join(manager.locations.platformWww, 'cordova_plugins.js');
-
- manager.addPlugin(new PluginInfo(DUMMY_PLUGIN), {usePlatformWww: true})
- .then(function () {
- expect(fs.writeFileSync).toHaveBeenCalledWith(metadataPath, jasmine.any(String), 'utf-8');
- expect(fs.writeFileSync).toHaveBeenCalledWith(platformWwwMetadataPath, jasmine.any(String), 'utf-8');
- })
- .fail(fail)
- .done(function () {
- expect(fail).not.toHaveBeenCalled();
- done();
- });
- });
- });
- });
-});
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/fc72293c/cordova-common/spec/events.spec.js
----------------------------------------------------------------------
diff --git a/cordova-common/spec/events.spec.js b/cordova-common/spec/events.spec.js
deleted file mode 100644
index 863664c..0000000
--- a/cordova-common/spec/events.spec.js
+++ /dev/null
@@ -1,48 +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 events = require('../src/events');
-
-describe('forwardEventsTo method', function () {
- afterEach(function() {
- events.forwardEventsTo(null);
- });
- it('Test 001 : should not go to infinite loop when trying to forward to self', function () {
- expect(function() {
- events.forwardEventsTo(events);
- events.emit('log', 'test message');
- }).not.toThrow();
- });
- it('Test 002 : should reset forwarding after trying to forward to self', function () {
- var EventEmitter = require('events').EventEmitter;
- var anotherEventEmitter = new EventEmitter();
- var logSpy = jasmine.createSpy('logSpy');
- anotherEventEmitter.on('log', logSpy);
-
- events.forwardEventsTo(anotherEventEmitter);
- events.emit('log', 'test message #1');
- expect(logSpy).toHaveBeenCalled();
-
- logSpy.calls.reset();
-
- events.forwardEventsTo(events);
- events.emit('log', 'test message #2');
- expect(logSpy).not.toHaveBeenCalled();
- });
-});
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/fc72293c/cordova-common/spec/fixtures/plugins/ChildBrowser/plugin.xml
----------------------------------------------------------------------
diff --git a/cordova-common/spec/fixtures/plugins/ChildBrowser/plugin.xml b/cordova-common/spec/fixtures/plugins/ChildBrowser/plugin.xml
deleted file mode 100644
index 700ef7c..0000000
--- a/cordova-common/spec/fixtures/plugins/ChildBrowser/plugin.xml
+++ /dev/null
@@ -1,126 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-
-<plugin xmlns="http://cordova.apache.org/ns/plugins/1.0"
- xmlns:android="http://schemas.android.com/apk/res/android"
- id="com.phonegap.plugins.childbrowser"
- version="0.6.0">
-
- <name>Child Browser</name>
-
- <asset src="www/childbrowser" target="childbrowser" />
- <asset src="www/childbrowser_file.html" target="childbrowser_file.html" />
-
- <js-module src="www/childbrowser.js" name="ChildBrowser">
- <clobbers target="childbrowser" />
- </js-module>
-
- <config-file target="config.xml" parent="/*">
- <access origin="build.phonegap.com" />
- <access origin="s3.amazonaws.com" />
- </config-file>
-
- <info>No matter what platform you are installing to, this notice is very important.</info>
-
- <!-- android -->
- <platform name="android">
- <config-file target="AndroidManifest.xml" parent="/manifest/application">
- <activity android:name="com.phonegap.plugins.childBrowser.ChildBrowser"
- android:label="@string/app_name">
- <intent-filter>
- </intent-filter>
- </activity>
- </config-file>
-
- <!-- CDV < 2.0 -->
- <config-file target="res/xml/plugins.xml" parent="/plugins">
- <plugin name="ChildBrowser"
- value="com.phonegap.plugins.childBrowser.ChildBrowser"/>
- </config-file>
-
- <!-- CDV 2.0+ (for now) -->
- <config-file target="res/xml/config.xml" parent="/cordova/plugins">
- <plugin name="ChildBrowser"
- value="com.phonegap.plugins.childBrowser.ChildBrowser"/>
- </config-file>
-
- <source-file src="src/android/ChildBrowser.java"
- target-dir="src/com/phonegap/plugins/childBrowser" />
- <info>Please make sure you read this because it is very important to complete the installation of your plugin.</info>
- </platform>
-
- <!-- ios -->
- <platform name="ios">
- <plugins-plist key="com.phonegap.plugins.childbrowser"
- string="ChildBrowserCommand" />
-
- <config-file target="config.xml" parent="/widget/plugins">
- <plugin name="ChildBrowser"
- value="ChildBrowserCommand" />
- </config-file>
-
- <resource-file src="src/ios/ChildBrowser.bundle" />
- <resource-file src="src/ios/ChildBrowserViewController.xib" />
-
- <config-file target="*-Info.plist" parent="AppId">
- <string>$APP_ID</string>
- </config-file>
-
- <config-file target="*-Info.plist" parent="CFBundleURLTypes">
- <array>
- <dict>
- <key>PackageName</key>
- <string>$PACKAGE_NAME</string>
- </dict>
- </array>
- </config-file>
-
- <header-file src="src/ios/ChildBrowserCommand.h" />
- <header-file src="src/ios/ChildBrowserViewController.h" />
- <header-file src="src/ios/TargetDirTest.h" target-dir="targetDir"/>
-
- <source-file src="src/ios/ChildBrowserCommand.m" />
- <source-file src="src/ios/ChildBrowserViewController.m" />
- <source-file src="src/ios/preserveDirs/PreserveDirsTest.m" preserve-dirs="true" />
- <header-file src="src/ios/TargetDirTest.m" target-dir="targetDir"/>
-
- <!-- framework for testing (not actual dependency of ChildBrowser -->
- <framework src="libsqlite3.dylib" />
- <framework src="social.framework" weak="true" />
- <framework src="music.framework" weak="rabbit" />
- </platform>
-
- <!-- wp8 -->
- <platform name="wp8">
- <resource-file src="src\wp7\Images\appbar.back.rest.png" />
- <config-file target="config.xml" parent="/widget/plugins">
- <plugin name="ChildBrowser"
- value="ChildBrowser"/>
- </config-file>
-
- <source-file src="src\wp7\ChildBrowserCommand.cs"
- target-dir="Plugins\" />
-
- <!-- modify the project file to include the added files -->
- <config-file target=".csproj" parent=".">
- </config-file>
-
- </platform>
-</plugin>
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/fc72293c/cordova-common/spec/fixtures/plugins/ChildBrowser/src/android/ChildBrowser.java
----------------------------------------------------------------------
diff --git a/cordova-common/spec/fixtures/plugins/ChildBrowser/src/android/ChildBrowser.java b/cordova-common/spec/fixtures/plugins/ChildBrowser/src/android/ChildBrowser.java
deleted file mode 100644
index 36113b6..0000000
--- a/cordova-common/spec/fixtures/plugins/ChildBrowser/src/android/ChildBrowser.java
+++ /dev/null
@@ -1,17 +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.
-*/
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/fc72293c/cordova-common/spec/fixtures/plugins/ChildBrowser/www/childbrowser.js
----------------------------------------------------------------------
diff --git a/cordova-common/spec/fixtures/plugins/ChildBrowser/www/childbrowser.js b/cordova-common/spec/fixtures/plugins/ChildBrowser/www/childbrowser.js
deleted file mode 100644
index 207fbff..0000000
--- a/cordova-common/spec/fixtures/plugins/ChildBrowser/www/childbrowser.js
+++ /dev/null
@@ -1,18 +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.
-*/
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/fc72293c/cordova-common/spec/fixtures/plugins/ChildBrowser/www/childbrowser/image.jpg
----------------------------------------------------------------------
diff --git a/cordova-common/spec/fixtures/plugins/ChildBrowser/www/childbrowser/image.jpg b/cordova-common/spec/fixtures/plugins/ChildBrowser/www/childbrowser/image.jpg
deleted file mode 100644
index 257cc56..0000000
--- a/cordova-common/spec/fixtures/plugins/ChildBrowser/www/childbrowser/image.jpg
+++ /dev/null
@@ -1 +0,0 @@
-foo
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/fc72293c/cordova-common/spec/fixtures/plugins/ChildBrowser/www/childbrowser_file.html
----------------------------------------------------------------------
diff --git a/cordova-common/spec/fixtures/plugins/ChildBrowser/www/childbrowser_file.html b/cordova-common/spec/fixtures/plugins/ChildBrowser/www/childbrowser_file.html
deleted file mode 100644
index 6de7b8c..0000000
--- a/cordova-common/spec/fixtures/plugins/ChildBrowser/www/childbrowser_file.html
+++ /dev/null
@@ -1 +0,0 @@
-This is a test file.
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/fc72293c/cordova-common/spec/fixtures/plugins/com.adobe.vars/plugin.xml
----------------------------------------------------------------------
diff --git a/cordova-common/spec/fixtures/plugins/com.adobe.vars/plugin.xml b/cordova-common/spec/fixtures/plugins/com.adobe.vars/plugin.xml
deleted file mode 100644
index d1e1bff..0000000
--- a/cordova-common/spec/fixtures/plugins/com.adobe.vars/plugin.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-
-<plugin xmlns="http://cordova.apache.org/ns/plugins/1.0"
- xmlns:android="http://schemas.android.com/apk/res/android"
- id="com.adobe.vars"
- version="3.0.0">
-
- <name>Use Variables</name>
-
- <preference name="API_KEY" />
-
- <info>Remember that your api key is $API_KEY!</info>
- <!-- android -->
- <platform name="android">
- <config-file target="AndroidManifest.xml" parent="/manifest">
- <poop name="GoogleMapsApiKey" value="$API_KEY" />
- <package>$PACKAGE_NAME</package>
- </config-file>
-
- </platform>
-
- <!-- amazon fireos -->
- <platform name="amazon-fireos">
- <config-file target="AndroidManifest.xml" parent="/manifest">
- <poop name="GoogleMapsApiKey" value="$API_KEY" />
- <package>$PACKAGE_NAME</package>
- </config-file>
-
- </platform>
-
- <!-- ios -->
- <platform name="ios">
- <config-file target="config.xml" parent="/widget">
- <awesome value="$API_KEY" />
- <cfbundleid>$PACKAGE_NAME</cfbundleid>
- </config-file>
- <config-file target="*-Info.plist" parent="APluginNode">
- <string></string>
- </config-file>
- </platform>
-</plugin>
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/fc72293c/cordova-common/spec/fixtures/plugins/org.apache.plist/plugin.xml
----------------------------------------------------------------------
diff --git a/cordova-common/spec/fixtures/plugins/org.apache.plist/plugin.xml b/cordova-common/spec/fixtures/plugins/org.apache.plist/plugin.xml
deleted file mode 100644
index 8b4ba71..0000000
--- a/cordova-common/spec/fixtures/plugins/org.apache.plist/plugin.xml
+++ /dev/null
@@ -1,54 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-
-<plugin xmlns="http://cordova.apache.org/ns/plugins/1.0"
- xmlns:android="http://schemas.android.com/apk/res/android"
- id="org.apache.plist"
- version="3.0.0">
-
- <name>PList updates</name>
-
- <!-- ios -->
- <platform name="ios">
- <config-file target="*-Info.plist" parent="CFBundleIcons">
- <dict>
- <key>UINewsstandIcon</key>
- <dict>
- <key>CFBundleIconFiles</key>
- <array>
- <string>Newsstand-Cover-Icon.png</string>
- <string>Newsstand-Cover-Icon@2x.png</string>
- </array>
- <key>UINewsstandBindingType</key>
- <string>UINewsstandBindingTypeMagazine</string>
- <key>UINewsstandBindingEdge</key>
- <string>UINewsstandBindingEdgeLeft</string>
- </dict>
- </dict>
- </config-file>
-
- <config-file target="*-Info.plist" parent="CFValidSchemas">
- <array>
- <string>schema-a</string>
- <string>schema-b</string>
- </array>
- </config-file>
- </platform>
-</plugin>
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/fc72293c/cordova-common/spec/fixtures/plugins/org.test.configtest/plugin.xml
----------------------------------------------------------------------
diff --git a/cordova-common/spec/fixtures/plugins/org.test.configtest/plugin.xml b/cordova-common/spec/fixtures/plugins/org.test.configtest/plugin.xml
deleted file mode 100644
index 49b8739..0000000
--- a/cordova-common/spec/fixtures/plugins/org.test.configtest/plugin.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-
-<plugin xmlns="http://cordova.apache.org/ns/plugins/1.0"
- xmlns:android="http://schemas.android.com/apk/res/android"
- id="org.test.configtest"
- version="3.0.0">
-
- <name>Does Code Fil Write Even Work? Hopefully the Tests Will Tell Us</name>
-
- <!-- android -->
- <platform name="android">
- <config-file target="res/xml/config.xml" parent="/widget">
- <poop/>
- </config-file>
- <config-file target="res/xml/config.xml" parent="/widget">
- <poop/>
- </config-file>
- </platform>
-
- <platform name="windows">
- <config-file target="package.appxmanifest" parent="/Parent/Capabilities">
- <Capability Note="should-exist-for-all-appxmanifest-target-files" />
- </config-file>
- <config-file target="package.appxmanifest" parent="/Parent/Capabilities" versions="=8.1.0">
- <Capability Note="should-exist-for-win81-win-and-phone" />
- </config-file>
- <config-file target="package.appxmanifest" parent="/Parent/Capabilities" versions="=8.1.0" device-target="windows">
- <Capability Note="should-exist-for-win81-win-only" />
- </config-file>
- <config-file target="package.appxmanifest" parent="/Parent/Capabilities" versions="=8.1.0" device-target="phone">
- <Capability Note="should-exist-for-win81-phone-only" />
- </config-file>
- <config-file target="package.appxmanifest" parent="/Parent/Capabilities" versions="=8.1.0" device-target="all">
- <Capability Note="should-exist-for-win81-win-and-phone" />
- </config-file>
- <config-file target="package.appxmanifest" parent="/Parent/Capabilities" versions="<=10.0.0" device-target="all">
- <Capability Note="should-exist-for-win10-and-win81-win-and-phone" />
- </config-file>
- <config-file target="package.appxmanifest" parent="/Parent/Capabilities" versions=">=10.0.0">
- <Capability Note="should-exist-in-win10-only" />
- </config-file>
- </platform>
-</plugin>
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/fc72293c/cordova-common/spec/fixtures/plugins/org.test.editconfigtest/plugin.xml
----------------------------------------------------------------------
diff --git a/cordova-common/spec/fixtures/plugins/org.test.editconfigtest/plugin.xml b/cordova-common/spec/fixtures/plugins/org.test.editconfigtest/plugin.xml
deleted file mode 100644
index ab15c44..0000000
--- a/cordova-common/spec/fixtures/plugins/org.test.editconfigtest/plugin.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-
-<plugin xmlns="http://cordova.apache.org/ns/plugins/1.0"
- xmlns:android="http://schemas.android.com/apk/res/android"
- id="org.test.editconfigtest"
- version="3.0.0">
-
- <name>Test edit-config</name>
-
- <!-- android -->
- <platform name="android">
- <edit-config file="AndroidManifest.xml" target="/manifest/application/activity[@android:name='org.test.DroidGap']" mode="merge">
- <activity android:enabled="true" android:configChanges="keyboardHidden" />
- </edit-config>
- <edit-config file="AndroidManifest.xml" target="/manifest/application/activity" mode="overwrite">
- <activity android:name="ChildApp" android:label="@string/app_name" android:enabled="true" />
- </edit-config>
- </platform>
-</plugin>
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/fc72293c/cordova-common/spec/fixtures/plugins/org.test.editconfigtest_two/plugin.xml
----------------------------------------------------------------------
diff --git a/cordova-common/spec/fixtures/plugins/org.test.editconfigtest_two/plugin.xml b/cordova-common/spec/fixtures/plugins/org.test.editconfigtest_two/plugin.xml
deleted file mode 100644
index 789e607..0000000
--- a/cordova-common/spec/fixtures/plugins/org.test.editconfigtest_two/plugin.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-
-<plugin xmlns="http://cordova.apache.org/ns/plugins/1.0"
- xmlns:android="http://schemas.android.com/apk/res/android"
- id="org.test.editconfigtest_two"
- version="3.0.0">
-
- <name>Test edit-config with conflicts</name>
-
- <!-- android -->
- <platform name="android">
- <edit-config file="AndroidManifest.xml" target="/manifest/application/activity[@android:name='org.test.DroidGap']" mode="merge">
- <activity android:enabled="true" android:configChanges="orientation|keyboardHidden" />
- </edit-config>
- <edit-config file="AndroidManifest.xml" target="/manifest/application/activity[@android:name='ChildApp']" mode="overwrite">
- <activity android:name="ChildApp" android:label="@string/app_name" android:enabled="false" />
- </edit-config>
- <edit-config file="AndroidManifest.xml" target="/manifest/uses-sdk" mode="merge">
- <uses-sdk android:maxSdkVersion="24" android:targetSdkVersion="23" />
- </edit-config>
- </platform>
-</plugin>
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/fc72293c/cordova-common/spec/fixtures/plugins/org.test.multiple-children/plugin.xml
----------------------------------------------------------------------
diff --git a/cordova-common/spec/fixtures/plugins/org.test.multiple-children/plugin.xml b/cordova-common/spec/fixtures/plugins/org.test.multiple-children/plugin.xml
deleted file mode 100644
index 1e30814..0000000
--- a/cordova-common/spec/fixtures/plugins/org.test.multiple-children/plugin.xml
+++ /dev/null
@@ -1,108 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-
-<plugin xmlns="http://cordova.apache.org/ns/plugins/1.0"
- xmlns:android="http://schemas.android.com/apk/res/android"
- id="org.test.org.test.multiple-children"
- version="3.0.0">
-
- <name>Pushwoosh</name>
-
- <!-- android -->
- <platform name="android">
- <config-file target="AndroidManifest.xml" parent="/manifest">
- <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
-
- <!--library-->
- <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
-
- <!-- GCM connects to Google Services. -->
- <uses-permission android:name="android.permission.INTERNET"/>
-
- <!-- GCM requires a Google account. -->
- <uses-permission android:name="android.permission.GET_ACCOUNTS"/>
-
- <!-- Keeps the processor from sleeping when a message is received. -->
- <uses-permission android:name="android.permission.WAKE_LOCK"/>
-
- <!--
- Creates a custom permission so only this app can receive its messages.
-
- NOTE: the permission *must* be called PACKAGE.permission.C2D_MESSAGE,
- where PACKAGE is the application's package name.
- -->
- <permission
- android:name="$PACKAGE_NAME.permission.C2D_MESSAGE"
- android:protectionLevel="signature"/>
- <uses-permission
- android:name="$PACKAGE_NAME.permission.C2D_MESSAGE"/>
-
- <!-- This app has permission to register and receive data message. -->
- <uses-permission
- android:name="com.google.android.c2dm.permission.RECEIVE"/>
- </config-file>
-
- <config-file target="AndroidManifest.xml" parent="/manifest/application/activity">
- <intent-filter>
- <action android:name="$PACKAGE_NAME.MESSAGE"/>
- <category android:name="android.intent.category.DEFAULT"/>
- </intent-filter>
- </config-file>
-
- <config-file target="AndroidManifest.xml" parent="/manifest/application">
- <activity android:name="com.arellomobile.android.push.PushWebview"/>
-
- <activity android:name="com.arellomobile.android.push.MessageActivity"/>
-
- <activity android:name="com.arellomobile.android.push.PushHandlerActivity"/>
-
- <!--
- BroadcastReceiver that will receive intents from GCM
- services and handle them to the custom IntentService.
-
- The com.google.android.c2dm.permission.SEND permission is necessary
- so only GCM services can send data messages for the app.
- -->
- <receiver
- android:name="com.google.android.gcm.GCMBroadcastReceiver"
- android:permission="com.google.android.c2dm.permission.SEND">
- <intent-filter>
- <!-- Receives the actual messages. -->
- <action android:name="com.google.android.c2dm.intent.RECEIVE"/>
- <!-- Receives the registration id. -->
- <action android:name="com.google.android.c2dm.intent.REGISTRATION"/>
- <category android:name="$PACKAGE_NAME"/>
- </intent-filter>
- </receiver>
-
- <!--
- Application-specific subclass of PushGCMIntentService that will
- handle received messages.
- -->
- <service android:name="com.arellomobile.android.push.PushGCMIntentService"/>
-
- </config-file>
-
- <config-file target="res/xml/plugins.xml" parent="/plugins">
- <plugin name="PushNotification"
- value="com.pushwoosh.test.plugin.pushnotifications.PushNotifications" onload="true"/>
- </config-file>
- </platform>
-</plugin>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org