-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #338 from sialcasa/release
merge release into stable
- Loading branch information
Showing
45 changed files
with
772 additions
and
377 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
mvvmfx-guice/src/test/java/de/saxsys/mvvmfx/guice/interceptiontest/InterceptedView.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package de.saxsys.mvvmfx.guice.interceptiontest; | ||
|
||
import de.saxsys.mvvmfx.FxmlView; | ||
import de.saxsys.mvvmfx.InjectViewModel; | ||
|
||
public class InterceptedView implements FxmlView<InterceptedViewModel> { | ||
public static boolean vmWasInjected = false; | ||
public static boolean wasInitCalled = false; | ||
|
||
@InjectViewModel | ||
private InterceptedViewModel viewModel; | ||
|
||
public void initialize() { | ||
wasInitCalled = true; | ||
vmWasInjected = viewModel != null; | ||
} | ||
|
||
} |
9 changes: 9 additions & 0 deletions
9
mvvmfx-guice/src/test/java/de/saxsys/mvvmfx/guice/interceptiontest/InterceptedViewModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package de.saxsys.mvvmfx.guice.interceptiontest; | ||
|
||
import de.saxsys.mvvmfx.ViewModel; | ||
|
||
public class InterceptedViewModel implements ViewModel { | ||
|
||
|
||
|
||
} |
12 changes: 12 additions & 0 deletions
12
mvvmfx-guice/src/test/java/de/saxsys/mvvmfx/guice/interceptiontest/InterceptorModule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package de.saxsys.mvvmfx.guice.interceptiontest; | ||
|
||
import com.google.inject.Binder; | ||
import com.google.inject.Module; | ||
import com.google.inject.matcher.Matchers; | ||
|
||
public class InterceptorModule implements Module { | ||
@Override | ||
public void configure(Binder binder) { | ||
binder.bindInterceptor(Matchers.subclassesOf(InterceptedView.class), Matchers.any(), new TestInterceptor()); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
mvvmfx-guice/src/test/java/de/saxsys/mvvmfx/guice/interceptiontest/InterceptorTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package de.saxsys.mvvmfx.guice.interceptiontest; | ||
|
||
|
||
import org.junit.Test; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
/** | ||
* Test case to check AOP features (Interceptors) of Guice with mvvmFX. | ||
*/ | ||
public class InterceptorTest { | ||
|
||
|
||
@Test | ||
// @Ignore("until fixed") | ||
public void test() { | ||
|
||
InterceptedView.vmWasInjected = false; | ||
InterceptedView.wasInitCalled = false; | ||
TestInterceptor.wasIntercepted = false; | ||
|
||
|
||
InterceptorTestApp.main(); | ||
|
||
final InterceptedView codeBehind = InterceptorTestApp.viewTuple.getCodeBehind(); | ||
|
||
|
||
assertThat(TestInterceptor.wasIntercepted).isTrue(); | ||
|
||
|
||
assertThat(InterceptedView.wasInitCalled).isTrue(); | ||
assertThat(InterceptedView.vmWasInjected).isTrue(); | ||
} | ||
|
||
} |
36 changes: 36 additions & 0 deletions
36
mvvmfx-guice/src/test/java/de/saxsys/mvvmfx/guice/interceptiontest/InterceptorTestApp.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package de.saxsys.mvvmfx.guice.interceptiontest; | ||
|
||
import com.google.inject.Module; | ||
import de.saxsys.mvvmfx.FluentViewLoader; | ||
import de.saxsys.mvvmfx.ViewTuple; | ||
import de.saxsys.mvvmfx.guice.MvvmfxGuiceApplication; | ||
import javafx.application.Platform; | ||
import javafx.stage.Stage; | ||
|
||
import java.util.List; | ||
|
||
public class InterceptorTestApp extends MvvmfxGuiceApplication { | ||
|
||
public static ViewTuple<InterceptedView, InterceptedViewModel> viewTuple; | ||
|
||
|
||
public static void main(String... args) { | ||
launch(args); | ||
} | ||
|
||
|
||
@Override | ||
public void startMvvmfx(Stage stage) throws Exception { | ||
|
||
viewTuple = FluentViewLoader.fxmlView(InterceptedView.class).load(); | ||
|
||
// we can't shutdown the application in the test case so we need to do it here. | ||
Platform.exit(); | ||
} | ||
|
||
|
||
@Override | ||
public void initGuiceModules(List<Module> modules) throws Exception { | ||
modules.add(new InterceptorModule()); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
mvvmfx-guice/src/test/java/de/saxsys/mvvmfx/guice/interceptiontest/TestInterceptor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package de.saxsys.mvvmfx.guice.interceptiontest; | ||
|
||
import org.aopalliance.intercept.MethodInterceptor; | ||
import org.aopalliance.intercept.MethodInvocation; | ||
|
||
public class TestInterceptor implements MethodInterceptor { | ||
public static boolean wasIntercepted = false; | ||
|
||
@Override | ||
public Object invoke(MethodInvocation methodInvocation) throws Throwable { | ||
wasIntercepted = true; | ||
|
||
return methodInvocation.proceed(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,4 @@ public MyViewModel(MyService service) { | |
assertThat(service).isNotNull(); | ||
works = true; | ||
} | ||
|
||
|
||
} |
7 changes: 7 additions & 0 deletions
7
mvvmfx-guice/src/test/resources/de/saxsys/mvvmfx/guice/interceptiontest/InterceptedView.fxml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<?import java.lang.*?> | ||
<?import javafx.scene.layout.*?> | ||
|
||
|
||
<AnchorPane fx:controller="de.saxsys.mvvmfx.guice.interceptiontest.InterceptedView" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1" /> |
Oops, something went wrong.