diff --git a/example-client/build.gradle b/example-client/build.gradle index 8b54e85..ea145fa 100644 --- a/example-client/build.gradle +++ b/example-client/build.gradle @@ -45,7 +45,8 @@ android { } dependencies { - implementation 'com.android.support:appcompat-v7:28.0.0' + implementation 'androidx.appcompat:appcompat:1.0.2' + implementation 'androidx.recyclerview:recyclerview:1.0.0' implementation 'org.java-websocket:Java-WebSocket:1.3.6' implementation 'com.android.support:recyclerview-v7:28.0.0' diff --git a/example-client/gradle.properties b/example-client/gradle.properties new file mode 100644 index 0000000..d015431 --- /dev/null +++ b/example-client/gradle.properties @@ -0,0 +1,2 @@ +android.useAndroidX=true +android.enableJetifier=true \ No newline at end of file diff --git a/example-client/src/main/AndroidManifest.xml b/example-client/src/main/AndroidManifest.xml index 8acdccd..5a65fcc 100644 --- a/example-client/src/main/AndroidManifest.xml +++ b/example-client/src/main/AndroidManifest.xml @@ -1,20 +1,21 @@ + xmlns:tools="http://schemas.android.com/tools" + package="ua.naiksoftware.stompclientexample"> - + + android:allowBackup="true" + android:icon="@mipmap/ic_launcher" + android:label="@string/app_name" + android:supportsRtl="true" + android:theme="@style/AppTheme"> - + - + diff --git a/example-client/src/main/java/ua/naiksoftware/stompclientexample/MainActivity.java b/example-client/src/main/java/ua/naiksoftware/stompclientexample/MainActivity.java index a249e9b..df5e3b9 100644 --- a/example-client/src/main/java/ua/naiksoftware/stompclientexample/MainActivity.java +++ b/example-client/src/main/java/ua/naiksoftware/stompclientexample/MainActivity.java @@ -1,9 +1,6 @@ package ua.naiksoftware.stompclientexample; import android.os.Bundle; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.View; import android.widget.Toast; @@ -17,6 +14,9 @@ import java.util.List; import java.util.Locale; +import androidx.appcompat.app.AppCompatActivity; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; import io.reactivex.CompletableTransformer; import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.disposables.CompositeDisposable; @@ -46,7 +46,7 @@ public class MainActivity extends AppCompatActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); - mRecyclerView = (RecyclerView) findViewById(R.id.recycler_view); + mRecyclerView = findViewById(R.id.recycler_view); mAdapter = new SimpleAdapter(mDataSet); mAdapter.setHasStableIds(true); mRecyclerView.setAdapter(mAdapter); diff --git a/example-client/src/main/java/ua/naiksoftware/stompclientexample/SimpleAdapter.java b/example-client/src/main/java/ua/naiksoftware/stompclientexample/SimpleAdapter.java index f546409..52947fc 100644 --- a/example-client/src/main/java/ua/naiksoftware/stompclientexample/SimpleAdapter.java +++ b/example-client/src/main/java/ua/naiksoftware/stompclientexample/SimpleAdapter.java @@ -1,6 +1,5 @@ package ua.naiksoftware.stompclientexample; -import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -8,6 +7,8 @@ import java.util.List; +import androidx.recyclerview.widget.RecyclerView; + /** * Created by Naik on 24.02.17. */ diff --git a/example-client/src/main/res/layout/activity_main.xml b/example-client/src/main/res/layout/activity_main.xml index 0596fa9..4c68891 100644 --- a/example-client/src/main/res/layout/activity_main.xml +++ b/example-client/src/main/res/layout/activity_main.xml @@ -62,7 +62,7 @@ - {System.out.println((String) i.getArgument(0) + " --> " + (String) i.getArgument(1) ); return null; }); - Mockito.when(Log.w(anyString(), anyString())).then(i -> {System.out.println((String) i.getArgument(0) + " --> " + (String) i.getArgument(1) ); return null; }); - Mockito.when(Log.d(anyString(), anyString())).then(i -> {System.out.println((String) i.getArgument(0) + " --> " + (String) i.getArgument(1) ); return null; }); - Mockito.when(Log.e(anyString(), anyString())).then(i -> {System.out.println((String) i.getArgument(0) + " --> " + (String) i.getArgument(1) ); return null; }); - - //TODO: bootstap a spring boot test server, so we can run tests. - } - - @AfterClass - public static void terminate() { - //TODO: teardown a spring boot test server, so we can run tests. - } - - - @Test - public void callWebsocket() { - //TODO: uncomment and create proper testing. - -// final List messages = new ArrayList<>(); -// -// final Map connectHttpHeaders = new HashMap<>(); -// connectHttpHeaders.put("Authorization", "Basic bHVhbDpwYXNz"); -// -// final StompClient mStompClient = Stomp.over(Stomp.ConnectionProvider.OKHTTP, "ws://localhost:8080/notifications/websocket", connectHttpHeaders); -// //don't care...but server will force it -// mStompClient.withClientHeartbeat(10000).withServerHeartbeat(10000); -// -// mStompClient.topic("/topic/notification/system/demo/username/lual").subscribe(topicMessage -> { -// Log.i(TAG,topicMessage.getPayload()); -// messages.add(topicMessage.getPayload()); -// }); -// -// mStompClient.lifecycle().subscribe(lifecycleEvent -> { -// switch (lifecycleEvent.getType()) { -// -// case OPENED: -// Log.i(TAG,"Stomp connection opened"); -// break; -// -// case ERROR: -// Log.i(TAG,"Error " + lifecycleEvent.getException()); -// break; -// -// case CLOSED: -// Log.i(TAG,"Stomp connection closed"); -// break; -// } -// }); -// -// mStompClient.connect(); -// -// await().atMost(5, MINUTES).until( messages::size, is(10)); -// -// mStompClient.disconnect(); - } - - -} \ No newline at end of file