You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by iv...@apache.org on 2009/02/11 22:56:57 UTC
svn commit: r743525 - in /wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src:
main/java/org/apache/wicket/feedback/FeedbackMessages.java
test/java/org/apache/wicket/feedback/
test/java/org/apache/wicket/feedback/FeedbackMessagesTest2.java
Author: ivaynberg
Date: Wed Feb 11 21:56:57 2009
New Revision: 743525
URL: http://svn.apache.org/viewvc?rev=743525&view=rev
Log:
WICKET-2190
Added:
wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/test/java/org/apache/wicket/feedback/
wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/test/java/org/apache/wicket/feedback/FeedbackMessagesTest2.java (with props)
Modified:
wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/feedback/FeedbackMessages.java
Modified: wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/feedback/FeedbackMessages.java
URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/feedback/FeedbackMessages.java?rev=743525&r1=743524&r2=743525&view=diff
==============================================================================
--- wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/feedback/FeedbackMessages.java (original)
+++ wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/feedback/FeedbackMessages.java Wed Feb 11 21:56:57 2009
@@ -189,8 +189,16 @@
*/
public final boolean hasMessageFor(Component component, int level)
{
- final FeedbackMessage message = messageForComponent(component);
- return message != null && message.isLevel(level);
+ Iterator it = messages.iterator();
+ while (it.hasNext())
+ {
+ final FeedbackMessage message = (FeedbackMessage)it.next();
+ if (message.getReporter() == component && message.isLevel(level))
+ {
+ return true;
+ }
+ }
+ return false;
}
/**
@@ -229,6 +237,8 @@
/**
* Looks up a message for the given component.
*
+ * TODO: 1.5 This should be deprecated and return a Collection.
+ *
* @param component
* the component to look up the message for
* @return the message that is found for the given component (first match) or null if none was
Added: wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/test/java/org/apache/wicket/feedback/FeedbackMessagesTest2.java
URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/test/java/org/apache/wicket/feedback/FeedbackMessagesTest2.java?rev=743525&view=auto
==============================================================================
--- wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/test/java/org/apache/wicket/feedback/FeedbackMessagesTest2.java (added)
+++ wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/test/java/org/apache/wicket/feedback/FeedbackMessagesTest2.java Wed Feb 11 21:56:57 2009
@@ -0,0 +1,61 @@
+/*
+ * 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.feedback;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.wicket.Page;
+import org.apache.wicket.Session;
+import org.apache.wicket.TestPage_1;
+import org.apache.wicket.util.tester.WicketTester;
+
+/**
+ * @author oli
+ */
+public class FeedbackMessagesTest2 extends TestCase
+{
+
+ WicketTester tester;
+
+
+ protected void setUp() throws Exception
+ {
+ tester = new WicketTester();
+ }
+
+ protected void tearDown() throws Exception
+ {
+ tester.destroy();
+ }
+
+ /**
+ * Test method for
+ * {@link org.apache.wicket.feedback.FeedbackMessages#hasMessageFor(org.apache.wicket.Component, int)}
+ * .
+ */
+ public void testHasMessageForComponentInt()
+ {
+ Session session = tester.setupRequestAndResponse().getSession();
+ final Page page = new TestPage_1();
+ tester.startPage(page);
+ page.debug("debug message");
+ page.info("info message");
+ page.error("error message");
+ Assert.assertTrue(session.getFeedbackMessages().hasMessageFor(page, FeedbackMessage.ERROR));
+ }
+}
Propchange: wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/test/java/org/apache/wicket/feedback/FeedbackMessagesTest2.java
------------------------------------------------------------------------------
svn:mime-type = text/plain