shiro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lhazlew...@apache.org
Subject svn commit: r1410707 [2/2] - in /shiro/trunk/core/src: main/java/org/apache/shiro/event/ main/java/org/apache/shiro/event/bus/ main/java/org/apache/shiro/util/ test/groovy/org/apache/shiro/event/ test/groovy/org/apache/shiro/event/bus/
Date Sat, 17 Nov 2012 08:12:51 GMT
Added: shiro/trunk/core/src/test/groovy/org/apache/shiro/event/bus/SubclassTestSubscriber.groovy
URL: http://svn.apache.org/viewvc/shiro/trunk/core/src/test/groovy/org/apache/shiro/event/bus/SubclassTestSubscriber.groovy?rev=1410707&view=auto
==============================================================================
--- shiro/trunk/core/src/test/groovy/org/apache/shiro/event/bus/SubclassTestSubscriber.groovy
(added)
+++ shiro/trunk/core/src/test/groovy/org/apache/shiro/event/bus/SubclassTestSubscriber.groovy
Sat Nov 17 08:12:48 2012
@@ -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.shiro.event.bus
+
+import org.apache.shiro.event.Subscribe
+
+/**
+ * @since 1.3
+ */
+class SubclassTestSubscriber extends TestSubscriber {
+
+    int bazCount
+
+    SubclassTestSubscriber() {
+        bazCount = 0
+    }
+
+    @Subscribe
+    void onEvent(BazEvent event) {
+        bazCount++
+        lastEvent = event;
+    }
+
+    @Subscribe
+    void onEvent(ErrorCausingEvent event) {
+        throw new UnsupportedOperationException("This throws!")
+    }
+
+    @Override
+    int getCount() {
+        return super.getCount() + bazCount
+    }
+}

Added: shiro/trunk/core/src/test/groovy/org/apache/shiro/event/bus/TestSubscriber.groovy
URL: http://svn.apache.org/viewvc/shiro/trunk/core/src/test/groovy/org/apache/shiro/event/bus/TestSubscriber.groovy?rev=1410707&view=auto
==============================================================================
--- shiro/trunk/core/src/test/groovy/org/apache/shiro/event/bus/TestSubscriber.groovy (added)
+++ shiro/trunk/core/src/test/groovy/org/apache/shiro/event/bus/TestSubscriber.groovy Sat
Nov 17 08:12:48 2012
@@ -0,0 +1,50 @@
+/*
+ * 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.shiro.event.bus
+
+import org.apache.shiro.event.Subscribe
+
+/**
+ * @since 1.3
+ */
+class TestSubscriber {
+
+    int fooCount, barCount
+    Object lastEvent;
+
+    TestSubscriber() {
+        fooCount = barCount = 0
+    }
+
+    @Subscribe
+    void onFooEvent(FooEvent event) {
+        fooCount++
+        lastEvent = event;
+    }
+
+    @Subscribe
+    void onBarEvent(BarEvent event) {
+        barCount++
+        lastEvent = event;
+    }
+
+    int getCount() {
+        return fooCount + barCount
+    }
+}



Mime
View raw message