http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/18b073a9/brooklyn-ui/src/test/javascript/specs/view/application-tree-spec.js ---------------------------------------------------------------------- diff --git a/brooklyn-ui/src/test/javascript/specs/view/application-tree-spec.js b/brooklyn-ui/src/test/javascript/specs/view/application-tree-spec.js deleted file mode 100644 index 410f6d4..0000000 --- a/brooklyn-ui/src/test/javascript/specs/view/application-tree-spec.js +++ /dev/null @@ -1,75 +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. -*/ -define([ - "underscore", "jquery", "model/app-tree", "view/application-tree", - "model/entity-summary", "model/application" -], function (_, $, AppTree, ApplicationTreeView, EntitySummary, Application) { - - // TODO json content must be updated to reflect new "batch" style result - // now used by the tree - -// var apps = new AppTree.Collection -// apps.url = 'fixtures/application-tree.json' -// apps.fetch({async:true}) -// -// describe('view/application-tree renders the list of applications as a tree', function () { -// var view, entityFetch, applicationFetch, defer; -// -// beforeEach(function () { -// // ApplicationTree makes fetch requests to EntitySummary and Application models -// // with hard-coded URLs, causing long stacktraces in mvn output. This workaround -// // turns their fetch methods into empty functions. -// entityFetch = EntitySummary.Model.prototype.fetch; -// applicationFetch = Application.Model.prototype.fetch; -// defer = _.defer; -// _.defer = EntitySummary.Model.prototype.fetch = Application.Model.prototype.fetch = function() {}; -// -// // Append a #details div for not found test -// $("body").append('<div id="details"></div>'); -// -// view = new ApplicationTreeView({ -// collection:apps -// }).render() -// }) -// -// // Restore EntitySummary and Application fetch. -// afterEach(function() { -// EntitySummary.Model.prototype.fetch = entityFetch; -// Application.Model.prototype.fetch = applicationFetch; -// _.defer = defer; -// $("#details").remove(); -// }); -// -// it("builds the entity tree for each application", function () { -// expect(view.$("#riBZUjMq").length).toBe(1) -// expect(view.$("#fXyyQ7Ap").length).toBe(1) -// expect(view.$("#child-02").length).toBe(1) -// expect(view.$("#child-03").length).toBe(1) -// expect(view.$("#child-04").length).toBe(1) -// -// expect(view.$("#child-nonesuch").length).toBe(0) -// }) -// -// it("shows a 'not found' error for unknown entities", function() { -// view.displayEntityId("nonexistant"); -// expect($("#details").text().toLowerCase()).toContain("failed to load entity nonexistant"); -// }); -// }) - -}) \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/18b073a9/brooklyn-ui/src/test/javascript/specs/view/effector-invoke-spec.js ---------------------------------------------------------------------- diff --git a/brooklyn-ui/src/test/javascript/specs/view/effector-invoke-spec.js b/brooklyn-ui/src/test/javascript/specs/view/effector-invoke-spec.js deleted file mode 100644 index a2685bc..0000000 --- a/brooklyn-ui/src/test/javascript/specs/view/effector-invoke-spec.js +++ /dev/null @@ -1,82 +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. -*/ -define([ - "underscore", "view/effector-invoke", "model/effector-summary", "model/entity", "model/location" -], function (_, EffectorInvokeView, EffectorSummary, Entity, Location) { - - var collection = new EffectorSummary.Collection() - collection.url = "fixtures/effector-summary-list.json" - collection.fetch() - - var entityFixture = new Entity.Collection - entityFixture.url = 'fixtures/entity.json' - entityFixture.fetch() - - var locationsFixture = new Location.Collection - locationsFixture.url = 'fixtures/location-list.json' - locationsFixture.fetch() - - const effector = collection.at(0); - - var modalView = new EffectorInvokeView({ - tagName:"div", - className:"modal", - model: effector, - entity:entityFixture.at(0), - locations: locationsFixture - }) - - describe("view/effector-invoke", function () { - // render and keep the reference to the view - modalView.render() - - it("must render a bootstrap modal", function () { - expect(modalView.$(".modal-header").length).toBe(1) - expect(modalView.$(".modal-body").length).toBe(1) - expect(modalView.$(".modal-footer").length).toBe(1) - }) - - it("must have effector name, entity name, and effector description in header", function () { - expect(modalView.$(".modal-header h3").html()).toContain("start") - expect(modalView.$(".modal-header h3").html()).toContain("Vanilla") - expect(modalView.$(".modal-header p").html()).toBe("Start the process/service represented by an entity") - }) - - it("must have the list of parameters in body", function () { - expect(modalView.$(".modal-body table").length).toBe(1); - // +1 because one <tr> from table head - expect(modalView.$(".modal-body tr").length).toBe(effector.get("parameters").length + 1) - }); - - it("must properly extract parameters from table", function () { - // Select the third item in the option list rather than the "None" and - // horizontal bar placeholders. - window.m = modalView; - modalView.$(".select-location option:eq(2)").attr("selected", "selected"); - - var params = modalView.extractParamsFromTable(); - console.log(params); - expect(params["locations"]).toBe("123") - expect(params).toEqual({ - "locations": "123", - "booleanValue": "true" - }); - }); - }) -}) \ No newline at end of file http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/18b073a9/brooklyn-ui/src/test/javascript/specs/view/entity-activities-spec.js ---------------------------------------------------------------------- diff --git a/brooklyn-ui/src/test/javascript/specs/view/entity-activities-spec.js b/brooklyn-ui/src/test/javascript/specs/view/entity-activities-spec.js deleted file mode 100644 index 310eb11..0000000 --- a/brooklyn-ui/src/test/javascript/specs/view/entity-activities-spec.js +++ /dev/null @@ -1,34 +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. -*/ -define([ - "model/task-summary", "view/entity-activities" -], function (TaskSummary, ActivityView) { - - describe("view/entity-activity", function () { - var entity, view - - beforeEach(function () { - entity = new Entity() - entity.url = "fixtures/entity-summary.json" - entity.fetch({async:false}) - view = new ActivityView({ model:entity}) - }) - }) - -}) \ No newline at end of file http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/18b073a9/brooklyn-ui/src/test/javascript/specs/view/entity-details-spec.js ---------------------------------------------------------------------- diff --git a/brooklyn-ui/src/test/javascript/specs/view/entity-details-spec.js b/brooklyn-ui/src/test/javascript/specs/view/entity-details-spec.js deleted file mode 100644 index 3ca76ef..0000000 --- a/brooklyn-ui/src/test/javascript/specs/view/entity-details-spec.js +++ /dev/null @@ -1,120 +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. -*/ -define([ - "underscore", "jquery", "backbone", "model/entity-summary", "view/entity-details", "view/entity-summary", - "view/entity-sensors", "model/application" -], function (_, $, Backbone, EntitySummary, EntityDetailsView, EntitySummaryView, EntitySensorsView, Application) { - - EntitySummary.Model.prototype.getSensorUpdateUrl = function () { - return "fixtures/sensor-current-state.json"; - }; - - // TODO test complains about various things; $.get in entity-config gives weird errors; - // previously complains about 'url' needing to be set - // but i can't figure out where 'url' is missing - // (may get sorted out if state is stored centrally) -// describe('view/entity-details-spec EntityDetailsView', function () { -// var entity, view, app -// -// beforeEach(function () { -// entity = new EntitySummary.Model -// entity.url = 'fixtures/entity-summary.json' -// entity.fetch({async:false}) -// app = new Application.Model -// app.url = "fixtures/application.json" -// app.fetch({async:false}) -// -// // entity-summary calls $.ajax on a sensor url that doesn't exist in tests. -// // make $.ajax a black hole for the creation of the view. Note it's important -// // that this is done _after_ the fetches above! -//// jqueryGet = $.get; -//// $.get = function() { -//// return { -//// fail: function() {} -//// }; -//// }; -// -// view = new EntityDetailsView({ -// model:entity, -// application:app -// }); -// view.render(); -// }); -// -// // -// // Restore $.ajax -//// afterEach(function() { -//// $.get = jqueryGet; -//// }); -// -// it('renders to a bootstrap tabbable', function () { -// expect(view.$('#summary').length).toBe(1) -// expect(view.$('#sensors').length).toBe(1) -// expect(view.$('#effectors').length).toBe(1) -// }) -// }) - - describe('view/entity-details-spec/Summary', function () { - var view=null; - - beforeEach(function () { - var entity, app; - entity = new EntitySummary.Model; - entity.url = 'fixtures/entity-summary.json'; - entity.fetch({async:false}); - app = new Application.Model; - app.url = "fixtures/application.json"; - app.fetch({async:false}); - - view = new EntitySummaryView({ - model:entity, - application:app - }); - view.render(); - }); - - }); - - // TODO complains about instanceof on a non-object in underscore; probably because we are now doing $.get - // rather than collections.fetch -// describe('view/entity-details-spec/Summary', function () { -// var sampleEntity, view -// -// beforeEach(function () { -// sampleEntity = new EntitySummary.Model -// sampleEntity.url = 'fixtures/entity-summary.json' -// sampleEntity.fetch({async:false}) -// view = new EntitySensorsView({ model:sampleEntity}).render() -// view.toggleFilterEmpty() -// }) -// -// it('must render as a table with sensor data', function () { -// expect(view.$('table#sensors-table').length).toBe(1) -// expect(view.$('th').length).toBe(3) -// var $body -// $body = view.$('tbody') -// -// expect($body.find('tr:first .sensor-name').html()).toBe('jmx.context') -// expect($body.find('tr:first .sensor-name').attr('data-original-title')).toMatch("JMX context path") -// expect($body.find('tr:last .sensor-name').attr('data-original-title')).toMatch("Suggested shutdown port") -// expect($body.find("tr:last .sensor-name").attr("rel")).toBe("tooltip") -// }) -// }) - -}); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/18b073a9/brooklyn-ui/src/test/javascript/specs/view/entity-effector-view-spec.js ---------------------------------------------------------------------- diff --git a/brooklyn-ui/src/test/javascript/specs/view/entity-effector-view-spec.js b/brooklyn-ui/src/test/javascript/specs/view/entity-effector-view-spec.js deleted file mode 100644 index eae2101..0000000 --- a/brooklyn-ui/src/test/javascript/specs/view/entity-effector-view-spec.js +++ /dev/null @@ -1,49 +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. -*/ -define([ - "underscore", "jquery", "backbone", "view/entity-effectors", "model/entity-summary" -], function (_, $, Backbone, EntityEffectorsView, EntitySummary) { - - var entitySummary = new EntitySummary.Model - entitySummary.url = "fixtures/entity-summary.json" - - entitySummary.fetch({success:function () { - - var $ROOT = $("<div/>"), - entityEffectorsView = new EntityEffectorsView({ - el:$ROOT, - model:entitySummary - }) - - describe("view/entity-effectors", function () { - - it("has table#effectors-table after initialization", function () { - expect($ROOT.find('table#effectors-table').length).toBe(1) - }) - - it("renders 3 effectors in the table", function () { - entityEffectorsView.render() - var $table = $ROOT.find("tbody") - expect($table.find("tr").length).toBe(3) - expect($table.find("tr:first .effector-name").html()).toBe("start") - expect($table.find("tr:last .effector-name").html()).toBe("stop") - }) - }) - }}) -}) \ No newline at end of file http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/18b073a9/brooklyn-ui/src/test/javascript/specs/view/entity-sensors-spec.js ---------------------------------------------------------------------- diff --git a/brooklyn-ui/src/test/javascript/specs/view/entity-sensors-spec.js b/brooklyn-ui/src/test/javascript/specs/view/entity-sensors-spec.js deleted file mode 100644 index d2bea28..0000000 --- a/brooklyn-ui/src/test/javascript/specs/view/entity-sensors-spec.js +++ /dev/null @@ -1,43 +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. -*/ -define([ - "underscore", "view/entity-sensors", - "text!tpl/apps/sensor-name.html" -], function (_, EntitySensorsView, SensorNameHtml) { - - function contains(string, value) { - return string.indexOf(value) != -1; - } - - describe("template/sensor-name", function () { - var sensorNameHtml = _.template(SensorNameHtml); - var context = {name: "name", description: "description", type: "type"}; - - it("should not create an anchor tag in name", function() { - var templated = sensorNameHtml(_.extend(context, {href: "href"})); - expect(contains(templated, "<a href=\"href\"")).toBe(false); - }); - - it("should not fail if context.href is undefined", function() { - var templated = sensorNameHtml(_.extend(context, {href: undefined})); - expect(contains(templated, "<a href=")).toBe(false); - }); - }) - -}) \ No newline at end of file http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/18b073a9/brooklyn-ui/src/test/license/DISCLAIMER ---------------------------------------------------------------------- diff --git a/brooklyn-ui/src/test/license/DISCLAIMER b/brooklyn-ui/src/test/license/DISCLAIMER deleted file mode 100644 index 9e6119b..0000000 --- a/brooklyn-ui/src/test/license/DISCLAIMER +++ /dev/null @@ -1,8 +0,0 @@ - -Apache Brooklyn is an effort undergoing incubation at The Apache Software Foundation (ASF), -sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until -a further review indicates that the infrastructure, communications, and decision making process -have stabilized in a manner consistent with other successful ASF projects. While incubation -status is not necessarily a reflection of the completeness or stability of the code, it does -indicate that the project has yet to be fully endorsed by the ASF. - http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/18b073a9/brooklyn-ui/src/test/license/LICENSE ---------------------------------------------------------------------- diff --git a/brooklyn-ui/src/test/license/LICENSE b/brooklyn-ui/src/test/license/LICENSE deleted file mode 100644 index 67db858..0000000 --- a/brooklyn-ui/src/test/license/LICENSE +++ /dev/null @@ -1,175 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/18b073a9/brooklyn-ui/src/test/license/NOTICE ---------------------------------------------------------------------- diff --git a/brooklyn-ui/src/test/license/NOTICE b/brooklyn-ui/src/test/license/NOTICE deleted file mode 100644 index f790f13..0000000 --- a/brooklyn-ui/src/test/license/NOTICE +++ /dev/null @@ -1,5 +0,0 @@ -Apache Brooklyn -Copyright 2014-2015 The Apache Software Foundation - -This product includes software developed at -The Apache Software Foundation (http://www.apache.org/). http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/18b073a9/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..3c5acf0 --- /dev/null +++ b/pom.xml @@ -0,0 +1,440 @@ +<?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. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache</groupId> + <artifactId>apache</artifactId> + <version>17</version> + <relativePath></relativePath> <!-- prevent loading of ../pom.xml as the "parent" --> + </parent> + + <groupId>org.apache.brooklyn</groupId> + <artifactId>brooklyn-jsgui</artifactId> + <version>0.9.0-SNAPSHOT</version> <!-- BROOKLYN_VERSION --> + <packaging>war</packaging> + + <name>Brooklyn REST JavaScript Web GUI</name> + + <description> + JavaScript+HTML GUI for interacting with Brooklyn, using the REST API + </description> + + <properties> + <project.build.webapp> + ${project.build.directory}/${project.build.finalName} + </project.build.webapp> + <nodejs.path>${project.basedir}/target/nodejs/node</nodejs.path> + <jasmine-maven-plugin.version>1.3.1.5</jasmine-maven-plugin.version> + <maven-dependency-plugin.version>2.8</maven-dependency-plugin.version> + <nodejs-maven-plugin.version>1.0.3</nodejs-maven-plugin.version> + <maven-war-plugin.version>2.4</maven-war-plugin.version> + <nodejs-maven-binaries.version>0.10.25</nodejs-maven-binaries.version> + <requirejs-maven-plugin.version>2.0.0</requirejs-maven-plugin.version> + <maven-replacer-plugin.version>1.5.2</maven-replacer-plugin.version> + <maven-resources-plugin.version>2.7</maven-resources-plugin.version> + </properties> + + <build> + <resources> + <resource> + <directory>${project.basedir}/src/test/resources/fixtures</directory> + <targetPath>${project.build.directory}/jasmine/fixtures</targetPath> + </resource> + </resources> + <!-- Insert special LICENSE/NOTICE into the <test-jar>/META-INF folder --> + <testResources> + <testResource> + <directory>${project.basedir}/src/test/resources</directory> + </testResource> + <testResource> + <targetPath>META-INF</targetPath> + <directory>${basedir}/src/test/license/files</directory> + </testResource> + </testResources> + <plugins> + <!-- + run js tests with: $ mvn clean process-test-resources jasmine:test + run tests in the browser with: $ mvn jasmine:bdd + --> + <plugin> + <artifactId>maven-resources-plugin</artifactId> + <version>${maven-resources-plugin.version}</version> + <executions> + <execution> + <id>copy-fixtures</id> + <phase>process-test-resources</phase> + <goals> + <goal>copy-resources</goal> + </goals> + <configuration> + <outputDirectory>${project.build.directory}/jasmine/fixtures</outputDirectory> + <resources> + <resource> + <!-- copy rest-api fixtures from brooklyn-server submodule repo --> + <directory>${project.basedir}/../brooklyn-server/rest/rest-api/src/test/resources/fixtures</directory> + </resource> + </resources> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>com.github.searls</groupId> + <artifactId>jasmine-maven-plugin</artifactId> + <version>${jasmine-maven-plugin.version}</version> + <executions> + <execution> + <goals> + <goal>test</goal> + </goals> + </execution> + </executions> + <configuration> + <!--Uses the require.js test spec--> + <specRunnerTemplate>REQUIRE_JS</specRunnerTemplate> + <preloadSources> + <source>js/libs/require.js</source> + </preloadSources> + + <!--Sources--> + <jsSrcDir>${project.basedir}/src/main/webapp/assets</jsSrcDir> + <jsTestSrcDir>${project.basedir}/src/test/javascript/specs</jsTestSrcDir> + <customRunnerConfiguration> + ${project.basedir}/src/test/javascript/config.txt + </customRunnerConfiguration> + <!-- Makes output terser --> + <format>progress</format> + <additionalContexts> + <!-- If context roots start with a / the resource will be available on the server at //root. --> + <!-- It is an error for context roots to end with a /. --> + <context> + <contextRoot>fixtures</contextRoot> + <directory>${project.build.directory}/jasmine/fixtures</directory> + </context> + </additionalContexts> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-war-plugin</artifactId> + <version>${maven-war-plugin.version}</version> + <configuration> + <useCache>true</useCache> <!-- to prevent replaced files being overwritten --> + <!-- Insert special LICENSE/NOTICE into the <war>/META-INF folder --> + <webResources> + <webResource> + <targetPath>META-INF</targetPath> + <directory>${basedir}/src/main/license/files</directory> + </webResource> + </webResources> + <archive> + <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile> + </archive> + </configuration> + </plugin> + <!-- Disable the automatic LICENSE/NOTICE placement from the upstream pom, because we need to include + bundled dependencies. See "webResources" section above for where we include the new LICENSE/NOTICE --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-remote-resources-plugin</artifactId> + <executions> + <execution> + <goals> + <goal>process</goal> + </goals> + <configuration> + <skip>true</skip> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <version>2.5.4</version> + <executions> + <execution> + <id>bundle-manifest</id> + <phase>process-classes</phase> + <goals> + <goal>manifest</goal> + </goals> + </execution> + </executions> + <configuration> + <supportedProjectTypes> + <supportedProjectType>war</supportedProjectType> + </supportedProjectTypes> + <instructions> + <Web-ContextPath>/</Web-ContextPath> + </instructions> + </configuration> + </plugin> + </plugins> + + <pluginManagement> + <plugins> + <plugin> + <groupId>org.apache.rat</groupId> + <artifactId>apache-rat-plugin</artifactId> + <configuration> + <excludes combine.children="append"> + <!-- + JavaScript code that is not copyright of Apache Foundation. It is included in NOTICE. + --> + <exclude>**/src/main/webapp/assets/js/libs/*</exclude> + <exclude>**/src/build/requirejs-maven-plugin/r.js</exclude> + + <!-- + Copy of swagger-ui from https://github.com/swagger-api/swagger-ui tag::v2.1.3 + --> + <exclude>**/src/main/webapp/assets/swagger-ui/**</exclude> + + <!-- + Trivial Json controlling the build, "without any degree of creativity". + Json does not support comments, therefore far easier to just omit the license header! + --> + <exclude>**//src/build/optimize-css.json</exclude> + <exclude>**//src/build/optimize-js.json</exclude> + </excludes> + </configuration> + </plugin> + <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.--> + <plugin> + <groupId>org.eclipse.m2e</groupId> + <artifactId>lifecycle-mapping</artifactId> + <version>1.0.0</version> + <configuration> + <lifecycleMappingMetadata> + <pluginExecutions> + <pluginExecution> + <pluginExecutionFilter> + <groupId> + com.github.skwakman.nodejs-maven-plugin + </groupId> + <artifactId> + nodejs-maven-plugin + </artifactId> + <versionRange> + [1.0.3,) + </versionRange> + <goals> + <goal>extract</goal> + </goals> + </pluginExecutionFilter> + <action> + <ignore></ignore> + </action> + </pluginExecution> + </pluginExecutions> + </lifecycleMappingMetadata> + </configuration> + </plugin> + </plugins> + </pluginManagement> + </build> + + <profiles> + <profile> + <id>nodejs-path-override</id> + <activation> + <os><family>linux</family></os> + </activation> + <properties> + <nodejs.path>${project.basedir}/src/build/nodejs</nodejs.path> + </properties> + <dependencies> + <dependency> + <groupId>com.github.skwakman.nodejs-maven-binaries</groupId> + <artifactId>nodejs-maven-binaries</artifactId> + <version>${nodejs-maven-binaries.version}</version> + <classifier>linux-x64</classifier> + <type>zip</type> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <version>${maven-dependency-plugin.version}</version> + <executions> + <execution> + <id>unpack-nodejs64</id> + <phase>prepare-package</phase> + <goals> + <goal>unpack-dependencies</goal> + </goals> + <configuration> + <includeGroupIds>com.github.skwakman.nodejs-maven-binaries</includeGroupIds> + <includeArtifactIds>nodejs-maven-binaries</includeArtifactIds> + <outputDirectory> + ${project.basedir}/target/nodejs64/ + </outputDirectory> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + + <profile> + <id>Optimize resources</id> + <activation> + <property> + <name>!skipOptimization</name> + </property> + </activation> + <build> + <plugins> + <!-- Installs node.js in target/. Means we get the benefits of node's speed + (compared to Rhino) without having to install it manually. --> + <plugin> + <groupId>com.github.skwakman.nodejs-maven-plugin</groupId> + <artifactId>nodejs-maven-plugin</artifactId> + <version>${nodejs-maven-plugin.version}</version> + <executions> + <execution> + <goals> + <goal>extract</goal> + </goals> + </execution> + </executions> + <configuration> + <!-- target directory for node binaries --> + <targetDirectory>${project.basedir}/target/nodejs/</targetDirectory> + </configuration> + </plugin> + + <!-- Including the exploded goal means sources are in place ready for the replacer plugin. --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-war-plugin</artifactId> + <version>${maven-war-plugin.version}</version> + <executions> + <execution> + <id>prepare-war</id> + <phase>prepare-package</phase> + <goals> + <goal>exploded</goal> + </goals> + </execution> + </executions> + </plugin> + + <!-- Runs the require.js optimizer with node to produce a single artifact. --> + <plugin> + <groupId>com.github.mcheely</groupId> + <artifactId>requirejs-maven-plugin</artifactId> + <version>${requirejs-maven-plugin.version}</version> + <executions> + <execution> + <id>optimize-js</id> + <phase>prepare-package</phase> + <goals> + <goal>optimize</goal> + </goals> + <configuration> + <configFile>${project.basedir}/src/build/optimize-js.json</configFile> + </configuration> + </execution> + <execution> + <id>optimize-css</id> + <phase>prepare-package</phase> + <goals> + <goal>optimize</goal> + </goals> + <configuration> + <configFile>${project.basedir}/src/build/optimize-css.json</configFile> + </configuration> + </execution> + </executions> + <configuration> + <nodeExecutable>${nodejs.path}</nodeExecutable> + <optimizerFile>${project.basedir}/src/build/requirejs-maven-plugin/r.js</optimizerFile> + <!-- Replaces Maven tokens in the build file with their values --> + <filterConfig>true</filterConfig> + </configuration> + </plugin> + + <!-- Modify index.html to point to the optimized resources generated above. --> + <plugin> + <groupId>com.google.code.maven-replacer-plugin</groupId> + <artifactId>replacer</artifactId> + <version>${maven-replacer-plugin.version}</version> + <executions> + <execution> + <id>modify-for-optimized</id> + <phase>prepare-package</phase> + <goals> + <goal>replace</goal> + </goals> + </execution> + </executions> + <configuration> + <file>${project.build.webapp}/index.html</file> + <replacements> + <replacement> + <token>assets/js/config.js</token> + <value>assets/js/gui.all.min.js</value> + </replacement> + <replacement> + <token>assets/css/styles.css</token> + <value>assets/css/styles.min.css</value> + </replacement> + <replacement> + <token>GIT_SHA_1</token> + <value>${buildNumber}</value> + </replacement> + </replacements> + </configuration> + </plugin> + + <!-- Compress the minified files. Jetty will serve the gzipped content instead. --> + <plugin> + <artifactId>maven-antrun-plugin</artifactId> + <executions> + <execution> + <id>Compress resources</id> + <phase>prepare-package</phase> + <goals> + <goal>run</goal> + </goals> + <configuration> + <target> + <gzip src="${project.build.webapp}/assets/css/styles.min.css" destfile="${project.build.webapp}/assets/css/styles.min.css.gz" /> + <gzip src="${project.build.webapp}/assets/css/brooklyn.css" destfile="${project.build.webapp}/assets/css/brooklyn.css.gz" /> + <gzip src="${project.build.webapp}/assets/js/gui.all.min.js" destfile="${project.build.webapp}/assets/js/gui.all.min.js.gz" /> + <gzip src="${project.build.webapp}/assets/js/libs/require.js" destfile="${project.build.webapp}/assets/js/libs/require.js.gz" /> + </target> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + </profiles> + +</project> + http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/18b073a9/src/build/.gitattributes ---------------------------------------------------------------------- diff --git a/src/build/.gitattributes b/src/build/.gitattributes new file mode 100644 index 0000000..83a693d --- /dev/null +++ b/src/build/.gitattributes @@ -0,0 +1,2 @@ +#Don't auto-convert line endings for shell scripts on Windows (breaks the scripts) +nodejs text eol=lf http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/18b073a9/src/build/nodejs ---------------------------------------------------------------------- diff --git a/src/build/nodejs b/src/build/nodejs new file mode 100755 index 0000000..2b00792 --- /dev/null +++ b/src/build/nodejs @@ -0,0 +1,41 @@ +#!/bin/sh +# +# 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. +# +# nodejs-maven-plugin incorrectly detects the architecture on +# Linux x64 running 32 bit Java leading to the installation of +# invalid nodejs binary - 32 bit on 64 bit OS. This is a +# wrapper which makes a check for the architecture again and +# forces the usage of the 64 bit binary. The 64 bit nodejs +# is installed in advance in case we need it. +# +# target/nodejs64/node - the forcibly installed 64 bit binary +# target/nodejs/node - the binary installed by nodejs-maven-plugin +# could be 32 bit or 64 bit. +# + +MACHINE_TYPE=`uname -m` +if [ $MACHINE_TYPE = 'x86_64' ]; then + NODE_PATH=$( dirname "$0" )/../../target/nodejs64/node + chmod +x $NODE_PATH + echo Forcing 64 bit nodejs at $NODE_PATH +else + NODE_PATH=$( dirname "$0" )/../../target/nodejs/node +fi + +$NODE_PATH "$@" http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/18b073a9/src/build/optimize-css.json ---------------------------------------------------------------------- diff --git a/src/build/optimize-css.json b/src/build/optimize-css.json new file mode 100644 index 0000000..d27d7ac --- /dev/null +++ b/src/build/optimize-css.json @@ -0,0 +1,12 @@ +({ + cssIn: "${project.build.webapp}/assets/css/styles.css", + out: "${project.build.webapp}/assets/css/styles.min.css", + + // CSS optimization options are: + // - "standard": @import inlining, comment removal and line returns. + // - "standard.keepLines": like "standard" but keeps line returns. + // - "standard.keepComments": keeps the file comments, but removes line returns. + // - "standard.keepComments.keepLines": keeps the file comments and line returns. + // - "none": skip CSS optimizations. + optimizeCss: "standard" +}) http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/18b073a9/src/build/optimize-js.json ---------------------------------------------------------------------- diff --git a/src/build/optimize-js.json b/src/build/optimize-js.json new file mode 100644 index 0000000..60855d9 --- /dev/null +++ b/src/build/optimize-js.json @@ -0,0 +1,18 @@ +({ + // The entry point to the application. Brooklyn's is in config.js. + name: "config", + baseUrl: "${project.build.webapp}/assets/js", + mainConfigFile: "${project.build.webapp}/assets/js/config.js", + paths: { + // Include paths to external resources (e.g. on a CDN) here. + + // Optimiser looks for js/requireLib.js by default. + "requireLib": "libs/require" + }, + + // Place the optimised file in target/<war>/assets. + out: "${project.build.webapp}/assets/js/gui.all.min.js", + + // Set to "none" to skip minification + optimize: "uglify" +})
