Skip to content

Latest commit

 

History

History
270 lines (159 loc) · 8.35 KB

README.md

File metadata and controls

270 lines (159 loc) · 8.35 KB

Build Status

The project

Client-side

app-mvp is a client-side JVM MVP application skeleton for simple notes keeping in Kotlin.

app-infra-rest-retrofit is an infra layer - client REST controllers that are used by client apps.

Mobile - Android

app-android is an Android app.

Mobile - iOS

To create podspec files run in root project directory:

./gradlew podspec

app-ios is an iOS app.

Mobile - Flutter (Android/iOS)

app-flutter is an Android/iOS Flutter app.

Desktop - JavaFX

app-javafx is a desktop JavaFX app.

Server-side

Client-side application requires server-side JVM application to be running. Applications interact over HTTP REST. Make sure you run it before running Android application.

MVP

All the apps (except Flutter) use MVP design pattern (see app-mvp module):

MVP

Android and JavaFX apps just provide concrete View implementations and reuse Model and Presenter from app-mvp. In order to interact with server-side app Model has a reference to UseCase implementation (from server-side app-api). In order to pass boundary we use according Controller that implement UseCase and abstracts transport/protocol. So both apps use app-infra-rest-retrofit module with Controllers which can be easily replaced with another one.

MVP

Building

Applications use app-api module from server-side application repository.

First, make sure:

  • NotesServerApp artifacts are available on local Maven repository: clone NotesServerApp repository to any directory, build and publish it to local Maven repository or
  • use Gradle composite-build: clone NotesServerApp repository to ../NotesServerApp directory (no separate building/publication is required).

Android app

In this repository root directory:

./gradlew app-android:assemble

Find compiled .apks in ./app-android/build/outputs/apk/ directories.

JavaFX app

In this repository root directory:

./gradlew app-javafx:shadowJar

Find compiled app-javafx-all.jar "shadow" jar (includes all dependencies) in ./app-javafx/build/libs/ directory.

iOS app

Compile and install podspec files for server-side and client apps in root directories:

./gradlew podspec

Install app-mvp pod in app-ios directory:

pod install

Flutter app

Android app

In app-flutter directory:

flutter pub get
flutter packages pub run build_runner build
flutter build apk --target-platform android-arm

Testing

Unit testing

JavaFX/Android app

One can find few unit tests that demonstrate some benefits of clean architecture for testing:

./gradlew test

iOS app

One can find few unit tests in app-ios/app-iosTests. Run them in XCode.

Automated UI Testing

Android app

First, create and run AVD. In this repository root directory:

./gradlew app-android:connectedAndroidTest

Make sure all the tests passed:

...
12:12:53 V/InstrumentationResultParser: Time: 15.482
12:12:53 V/InstrumentationResultParser: 
12:12:53 V/InstrumentationResultParser: OK (4 tests)
12:12:53 V/InstrumentationResultParser: 
12:12:53 V/InstrumentationResultParser: 
12:12:53 V/InstrumentationResultParser: INSTRUMENTATION_CODE: -1
12:12:53 V/InstrumentationResultParser: 
12:12:53 I/XmlResultReporter: XML test result file generated at /Users/asmirnov/Documents/dev/src/Notes/NotesClientApp/app-android/build/outputs/androidTest-results/connected/TEST-Nexus_5X_API_25_-_dev(AVD) - 7.1.1-app-android-.xml. Total tests 4, passed 4, 

Flutter app

In app-flutter directory:

flutter test

Manual testing

Android app

Stop server-side app (just to test errors handling). Install Android app to your device/emulator:

adb install ./app-android/build/outputs/apk/debug/app-android-debug.apk

and run the app.

Type server-side app host and port:

Server host and port

Make sure you can see connection error:

Connection error

Run server-side app and click "Reload" button to reload the notes list in Android app:

List notes loading progress Empty notes list

Click "Add" button and type note title and body:

Add note Add note progress

Make sure you can see added note:

Notes list

JavaFX app

Stop server-side app (just to test errors handling). Run JavaFX app:

java -jar app-javafx/build/libs/app-javafx-all.jar  

Type server-side app host and port:

Server host and port

Make sure you can see connection error:

Connection error

Run server-side app and click "Reload" button to reload the notes list in javafx app:

List notes loading progress Empty notes list

Click "Add" button and type note title and body:

Add note Add note progress

Make sure you can see added note:

Notes list

iOS app

Stop server-side app (just to test errors handling). Run the app in iOS device simulator.

Type server-side app host and port:

Server host and port

Make sure you can see connection error:

Connection error

Run server-side app and click "Reload" button to reload the notes list in iOS app:

Empty notes list

Click "Add" button and type note title and body:

Add note

Make sure you can see added note:

Notes list

Flutter app

Android

Server host and port Add note Notes list

iOS

Server host and port Add note Notes list

Frameworks and tools

Feedback

Please find TODOs in source code as topics for improvements if desired.

Any feedback and discussion is appreciated. Contact me on e-mail for this or fork the repository and pull a request.

Author

Anton Smirnov

dev [at] antonsmirnov [dot] name

2019