Updated Branches: refs/heads/master 6568ce556 -> 0740a02e3
WICKET-5366 ResourceAggregator looses information about priority/filtering/... when using a bundle Add a test case showing the problem Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/0740a02e Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/0740a02e Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/0740a02e Branch: refs/heads/master Commit: 0740a02e39fa8ea7b4f3f7525eef38d5358ea315 Parents: 6568ce5 Author: Martin Tzvetanov Grigorov <[email protected]> Authored: Tue Sep 24 10:27:41 2013 +0200 Committer: Martin Tzvetanov Grigorov <[email protected]> Committed: Tue Sep 24 10:27:41 2013 +0200 ---------------------------------------------------------------------- .../BundlePriorityApplication.java | 42 +++++++++++++++++ .../bundlepriority/BundlePriorityPage.java | 49 ++++++++++++++++++++ .../bundlepriority/BundlePriorityTest.java | 40 ++++++++++++++++ .../aggregator/bundlepriority/ReferenceA.java | 30 ++++++++++++ .../aggregator/bundlepriority/ReferenceB.java | 30 ++++++++++++ .../resource/aggregator/bundlepriority/a.js | 17 +++++++ .../resource/aggregator/bundlepriority/b.js | 17 +++++++ 7 files changed, 225 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/wicket/blob/0740a02e/wicket-core/src/test/java/org/apache/wicket/resource/aggregator/bundlepriority/BundlePriorityApplication.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/test/java/org/apache/wicket/resource/aggregator/bundlepriority/BundlePriorityApplication.java b/wicket-core/src/test/java/org/apache/wicket/resource/aggregator/bundlepriority/BundlePriorityApplication.java new file mode 100644 index 0000000..1eea36b --- /dev/null +++ b/wicket-core/src/test/java/org/apache/wicket/resource/aggregator/bundlepriority/BundlePriorityApplication.java @@ -0,0 +1,42 @@ +/* + * 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. + */ +package org.apache.wicket.resource.aggregator.bundlepriority; + +import org.apache.wicket.Page; +import org.apache.wicket.protocol.http.WebApplication; + +/** + * + */ +public class BundlePriorityApplication extends WebApplication +{ + + @Override + public Class<? extends Page> getHomePage() + { + return BundlePriorityPage.class; + } + + @Override + protected void init() + { + super.init(); + + getResourceBundles().addJavaScriptBundle(BundlePriorityApplication.class, "bundle-a.js", new ReferenceA()); + getResourceBundles().addJavaScriptBundle(BundlePriorityApplication.class, "bundle-b.js", new ReferenceB()); + } +} http://git-wip-us.apache.org/repos/asf/wicket/blob/0740a02e/wicket-core/src/test/java/org/apache/wicket/resource/aggregator/bundlepriority/BundlePriorityPage.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/test/java/org/apache/wicket/resource/aggregator/bundlepriority/BundlePriorityPage.java b/wicket-core/src/test/java/org/apache/wicket/resource/aggregator/bundlepriority/BundlePriorityPage.java new file mode 100644 index 0000000..9a5c439 --- /dev/null +++ b/wicket-core/src/test/java/org/apache/wicket/resource/aggregator/bundlepriority/BundlePriorityPage.java @@ -0,0 +1,49 @@ +/* + * 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. + */ +package org.apache.wicket.resource.aggregator.bundlepriority; + +import org.apache.wicket.MarkupContainer; +import org.apache.wicket.markup.IMarkupResourceStreamProvider; +import org.apache.wicket.markup.head.IHeaderResponse; +import org.apache.wicket.markup.head.JavaScriptHeaderItem; +import org.apache.wicket.markup.head.PriorityHeaderItem; +import org.apache.wicket.markup.head.StringHeaderItem; +import org.apache.wicket.markup.html.WebPage; +import org.apache.wicket.util.resource.IResourceStream; +import org.apache.wicket.util.resource.StringResourceStream; + +/** + * + */ +public class BundlePriorityPage extends WebPage implements IMarkupResourceStreamProvider +{ + @Override + public void renderHead(IHeaderResponse response) + { + super.renderHead(response); + + response.render(StringHeaderItem.forString("<style>some style</style>")); + response.render(JavaScriptHeaderItem.forReference(new ReferenceB())); + response.render(new PriorityHeaderItem(JavaScriptHeaderItem.forReference(new ReferenceA()))); + } + + @Override + public IResourceStream getMarkupResourceStream(MarkupContainer container, Class<?> containerClass) + { + return new StringResourceStream("<html><body></body></html>"); + } +} http://git-wip-us.apache.org/repos/asf/wicket/blob/0740a02e/wicket-core/src/test/java/org/apache/wicket/resource/aggregator/bundlepriority/BundlePriorityTest.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/test/java/org/apache/wicket/resource/aggregator/bundlepriority/BundlePriorityTest.java b/wicket-core/src/test/java/org/apache/wicket/resource/aggregator/bundlepriority/BundlePriorityTest.java new file mode 100644 index 0000000..8838f59 --- /dev/null +++ b/wicket-core/src/test/java/org/apache/wicket/resource/aggregator/bundlepriority/BundlePriorityTest.java @@ -0,0 +1,40 @@ +/* + * 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. + */ +package org.apache.wicket.resource.aggregator.bundlepriority; + +import org.apache.wicket.WicketTestCase; +import org.apache.wicket.protocol.http.WebApplication; +import org.junit.Test; + +/** + * + */ +public class BundlePriorityTest extends WicketTestCase +{ + @Override + protected WebApplication newApplication() + { + return new BundlePriorityApplication(); + } + + @Test + public void bundleAShouldBeAtTheTop() + { + tester.startPage(new BundlePriorityPage()); + System.err.println(tester.getLastResponseAsString()); + } +} http://git-wip-us.apache.org/repos/asf/wicket/blob/0740a02e/wicket-core/src/test/java/org/apache/wicket/resource/aggregator/bundlepriority/ReferenceA.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/test/java/org/apache/wicket/resource/aggregator/bundlepriority/ReferenceA.java b/wicket-core/src/test/java/org/apache/wicket/resource/aggregator/bundlepriority/ReferenceA.java new file mode 100644 index 0000000..0fb5a33 --- /dev/null +++ b/wicket-core/src/test/java/org/apache/wicket/resource/aggregator/bundlepriority/ReferenceA.java @@ -0,0 +1,30 @@ +/* + * 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. + */ +package org.apache.wicket.resource.aggregator.bundlepriority; + +import org.apache.wicket.request.resource.JavaScriptResourceReference; + +/** + * + */ +public class ReferenceA extends JavaScriptResourceReference +{ + public ReferenceA() + { + super(ReferenceA.class, "a.js"); + } +} http://git-wip-us.apache.org/repos/asf/wicket/blob/0740a02e/wicket-core/src/test/java/org/apache/wicket/resource/aggregator/bundlepriority/ReferenceB.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/test/java/org/apache/wicket/resource/aggregator/bundlepriority/ReferenceB.java b/wicket-core/src/test/java/org/apache/wicket/resource/aggregator/bundlepriority/ReferenceB.java new file mode 100644 index 0000000..4ceee09 --- /dev/null +++ b/wicket-core/src/test/java/org/apache/wicket/resource/aggregator/bundlepriority/ReferenceB.java @@ -0,0 +1,30 @@ +/* + * 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. + */ +package org.apache.wicket.resource.aggregator.bundlepriority; + +import org.apache.wicket.request.resource.JavaScriptResourceReference; + +/** + * + */ +public class ReferenceB extends JavaScriptResourceReference +{ + public ReferenceB() + { + super(ReferenceB.class, "b.js"); + } +} http://git-wip-us.apache.org/repos/asf/wicket/blob/0740a02e/wicket-core/src/test/java/org/apache/wicket/resource/aggregator/bundlepriority/a.js ---------------------------------------------------------------------- diff --git a/wicket-core/src/test/java/org/apache/wicket/resource/aggregator/bundlepriority/a.js b/wicket-core/src/test/java/org/apache/wicket/resource/aggregator/bundlepriority/a.js new file mode 100644 index 0000000..b7e14eb --- /dev/null +++ b/wicket-core/src/test/java/org/apache/wicket/resource/aggregator/bundlepriority/a.js @@ -0,0 +1,17 @@ +/* + * 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 a = "A"; http://git-wip-us.apache.org/repos/asf/wicket/blob/0740a02e/wicket-core/src/test/java/org/apache/wicket/resource/aggregator/bundlepriority/b.js ---------------------------------------------------------------------- diff --git a/wicket-core/src/test/java/org/apache/wicket/resource/aggregator/bundlepriority/b.js b/wicket-core/src/test/java/org/apache/wicket/resource/aggregator/bundlepriority/b.js new file mode 100644 index 0000000..19c773c --- /dev/null +++ b/wicket-core/src/test/java/org/apache/wicket/resource/aggregator/bundlepriority/b.js @@ -0,0 +1,17 @@ +/* + * 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 b = "B";
