aboutsummaryrefslogtreecommitdiffstats
path: root/tests/multiIncremental
diff options
context:
space:
mode:
authoraclement <aclement>2010-01-25 20:45:34 +0000
committeraclement <aclement>2010-01-25 20:45:34 +0000
commitc70383591c468ed1c289791f8b2bfaad12aca804 (patch)
tree78422c25350d9ecd244e7069086ea282ce8623c7 /tests/multiIncremental
parentcd123ff75a28937d49d19cdbdcb57ad9f4328b75 (diff)
downloadaspectj-c70383591c468ed1c289791f8b2bfaad12aca804.tar.gz
aspectj-c70383591c468ed1c289791f8b2bfaad12aca804.zip
298704
Diffstat (limited to 'tests/multiIncremental')
-rw-r--r--tests/multiIncremental/pr298704_baseaspects/base/src/it/uniba/di/cdg/penelope/ui/annotation/View.java23
-rw-r--r--tests/multiIncremental/pr298704_baseaspects/base/src/it/uniba/di/cdg/penelope/ui/mvp/AbstractViewEnhancerAspect.aj38
-rw-r--r--tests/multiIncremental/pr298704_baseaspects/base/src/it/uniba/di/cdg/penelope/ui/mvp/IManagedView.java19
-rw-r--r--tests/multiIncremental/pr298704_baseaspects/base/src/it/uniba/di/cdg/penelope/ui/mvp/IPresenter.java32
-rw-r--r--tests/multiIncremental/pr298704_testaspects/base/src/test/ViewEnhancerIntegrationTest.java40
5 files changed, 152 insertions, 0 deletions
diff --git a/tests/multiIncremental/pr298704_baseaspects/base/src/it/uniba/di/cdg/penelope/ui/annotation/View.java b/tests/multiIncremental/pr298704_baseaspects/base/src/it/uniba/di/cdg/penelope/ui/annotation/View.java
new file mode 100644
index 000000000..c69ae7121
--- /dev/null
+++ b/tests/multiIncremental/pr298704_baseaspects/base/src/it/uniba/di/cdg/penelope/ui/annotation/View.java
@@ -0,0 +1,23 @@
+/**
+ * Copyright (c) 2009 Collaborative Development Group, C.S. Dept., University of Bari
+ *
+ * All rights reserved. This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package it.uniba.di.cdg.penelope.ui.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Marks views to be injected.
+ */
+@Retention( RetentionPolicy.RUNTIME )
+@Target( ElementType.TYPE )
+@Inherited
+public @interface View {
+}
diff --git a/tests/multiIncremental/pr298704_baseaspects/base/src/it/uniba/di/cdg/penelope/ui/mvp/AbstractViewEnhancerAspect.aj b/tests/multiIncremental/pr298704_baseaspects/base/src/it/uniba/di/cdg/penelope/ui/mvp/AbstractViewEnhancerAspect.aj
new file mode 100644
index 000000000..80dd4650d
--- /dev/null
+++ b/tests/multiIncremental/pr298704_baseaspects/base/src/it/uniba/di/cdg/penelope/ui/mvp/AbstractViewEnhancerAspect.aj
@@ -0,0 +1,38 @@
+/**
+ * Copyright (c) 2009 Collaborative Development Group, C.S. Dept., University of Bari
+ *
+ * All rights reserved. This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package it.uniba.di.cdg.penelope.ui.mvp;
+
+import it.uniba.di.cdg.penelope.ui.annotation.View;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Augments views with support for View events.
+ */
+public abstract aspect AbstractViewEnhancerAspect {
+ pointcut scope();
+
+ declare parents: (@View *) implements IManagedView;
+
+ private final List<IPresenter> IManagedView.presenters = new ArrayList<IPresenter>();
+
+ public void IManagedView.fire( Object event ) {
+ for (IPresenter presenter : presenters) {
+ presenter.dispatchEvent( event );
+ }
+ }
+
+ public void IManagedView.registerPresenter( IPresenter presenter ) {
+ presenters.add( presenter );
+ }
+
+ public void IManagedView.unregisterPresenter( IPresenter presenter ) {
+ presenters.remove( presenter );
+ }
+}
diff --git a/tests/multiIncremental/pr298704_baseaspects/base/src/it/uniba/di/cdg/penelope/ui/mvp/IManagedView.java b/tests/multiIncremental/pr298704_baseaspects/base/src/it/uniba/di/cdg/penelope/ui/mvp/IManagedView.java
new file mode 100644
index 000000000..7be156875
--- /dev/null
+++ b/tests/multiIncremental/pr298704_baseaspects/base/src/it/uniba/di/cdg/penelope/ui/mvp/IManagedView.java
@@ -0,0 +1,19 @@
+/**
+ * Copyright (c) 2009 Collaborative Development Group, C.S. Dept., University of Bari
+ *
+ * All rights reserved. This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package it.uniba.di.cdg.penelope.ui.mvp;
+
+/**
+ *
+ */
+public interface IManagedView {
+ void fire( Object event );
+
+ void registerPresenter( IPresenter presenter );
+
+ void unregisterPresenter( IPresenter presenter );
+}
diff --git a/tests/multiIncremental/pr298704_baseaspects/base/src/it/uniba/di/cdg/penelope/ui/mvp/IPresenter.java b/tests/multiIncremental/pr298704_baseaspects/base/src/it/uniba/di/cdg/penelope/ui/mvp/IPresenter.java
new file mode 100644
index 000000000..6cdb46dfb
--- /dev/null
+++ b/tests/multiIncremental/pr298704_baseaspects/base/src/it/uniba/di/cdg/penelope/ui/mvp/IPresenter.java
@@ -0,0 +1,32 @@
+/**
+ * Copyright (c) 2009 Collaborative Development Group, C.S. Dept., University of Bari
+ *
+ * All rights reserved. This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package it.uniba.di.cdg.penelope.ui.mvp;
+
+import java.beans.PropertyChangeListener;
+
+/**
+ * Basic interface for <strong>Presenter</strong> implementations. Within Penelope, a Presenter is a supervising controller
+ * which reacts to view events (see the View Events mechanism): the view just displays the session state stored within
+ * the <strong>Presentation Model</strong>.
+ */
+public interface IPresenter extends PropertyChangeListener {
+ /**
+ * View has been created.
+ */
+ void onViewCreated();
+
+ /**
+ * View has been destroyed.
+ */
+ void onViewDisposed();
+
+ /**
+ * @param event
+ */
+ void dispatchEvent( Object event );
+}
diff --git a/tests/multiIncremental/pr298704_testaspects/base/src/test/ViewEnhancerIntegrationTest.java b/tests/multiIncremental/pr298704_testaspects/base/src/test/ViewEnhancerIntegrationTest.java
new file mode 100644
index 000000000..a10ddd060
--- /dev/null
+++ b/tests/multiIncremental/pr298704_testaspects/base/src/test/ViewEnhancerIntegrationTest.java
@@ -0,0 +1,40 @@
+/**
+ * Copyright (c) 2009 Collaborative Development Group, C.S. Dept., University of Bari
+ *
+ * All rights reserved. This program and the accompanying materials are made available under
+ * the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package test;
+
+import it.uniba.di.cdg.penelope.ui.annotation.View;
+import it.uniba.di.cdg.penelope.ui.mvp.IManagedView;
+import it.uniba.di.cdg.penelope.ui.mvp.AbstractViewEnhancerAspect;
+
+/**
+ *
+ */
+public class ViewEnhancerIntegrationTest {
+
+@View
+ public static class MockView {
+
+ }
+
+ static aspect ViewEnhancerAspect extends AbstractViewEnhancerAspect {
+ pointcut scope() : within( test.ViewEnhancerIntegrationTest );
+ }
+
+ public void simulateViewCreation() {
+ }
+
+ public void shouldAugmentView() {
+ //given @View class has been augmented
+
+ //when
+ MockView view = new MockView();
+
+ //then
+ // assertTrue( view instanceof IManagedView );
+ }
+}