mirror of
https://github.com/NiciDieNase/chaosflix
synced 2024-11-23 12:53:08 +00:00
update tests
This commit is contained in:
parent
2916aaa090
commit
6529041317
9 changed files with 386 additions and 467 deletions
|
@ -28,6 +28,9 @@ android {
|
|||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
defaultConfig {
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -52,11 +55,16 @@ dependencies {
|
|||
debugCompile 'com.facebook.stetho:stetho-okhttp3:1.4.2'
|
||||
|
||||
testCompile 'junit:junit:4.12'
|
||||
androidTestCompile 'junit:junit:4.12'
|
||||
|
||||
androidTestCompile ('com.android.support.test:rules:0.5') {
|
||||
exclude module: 'support-annotations'
|
||||
}
|
||||
androidTestCompile ('com.android.support.test:runner:0.5') {
|
||||
exclude module: 'support-annotations'
|
||||
}
|
||||
testCompile 'com.squareup.okhttp3:mockwebserver:3.6.0'
|
||||
// testCompile 'org.mockito:mockito-core:1.10.19'
|
||||
androidTestCompile 'org.hamcrest:hamcrest-library:1.3'
|
||||
androidTestCompile 'com.squareup.okhttp3:mockwebserver:3.6.0'
|
||||
androidTestCompile group: 'commons-io', name: 'commons-io', version: '2.0.1'
|
||||
testCompile 'org.mockito:mockito-core:1.10.19'
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,171 @@
|
|||
package de.nicidienase.chaosflix;
|
||||
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.IBinder;
|
||||
import android.support.test.InstrumentationRegistry;
|
||||
import android.support.test.rule.ServiceTestRule;
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.ClassRule;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
import de.nicidienase.chaosflix.test.R;
|
||||
import de.nicidienase.chaosflix.network.MediaApiService;
|
||||
import okhttp3.mockwebserver.MockResponse;
|
||||
import okhttp3.mockwebserver.MockWebServer;
|
||||
|
||||
import static junit.framework.Assert.fail;
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.hamcrest.MatcherAssert.*;
|
||||
|
||||
/**
|
||||
* Created by felix on 17.03.17.
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class MediaApiServiceTest {
|
||||
|
||||
@ClassRule
|
||||
public static final ServiceTestRule mServiceRule = new ServiceTestRule();
|
||||
|
||||
private static final String TAG = MediaApiServiceTest.class.getSimpleName();
|
||||
private static MockWebServer server;
|
||||
private static String serverUrl;
|
||||
private static MediaApiService service;
|
||||
|
||||
|
||||
@BeforeClass
|
||||
public static void setup() throws IOException, TimeoutException {
|
||||
server = new MockWebServer();
|
||||
// server.setDispatcher(new MediaCccDispatcher());
|
||||
server.start();
|
||||
serverUrl = server.url("").toString();
|
||||
|
||||
|
||||
Intent s = new Intent(InstrumentationRegistry.getTargetContext(),
|
||||
MediaApiService.class);
|
||||
s.putExtra(MediaApiService.RECORDING_URL,serverUrl);
|
||||
s.putExtra(MediaApiService.STREAMING_URL,serverUrl);
|
||||
IBinder binder = mServiceRule.bindService(s);
|
||||
service = ((MediaApiService.LocalBinder) binder).getService();
|
||||
}
|
||||
|
||||
@After
|
||||
public void cleanup(){
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void getConferenceTest() throws IOException {
|
||||
server.enqueue(new MockResponse().setBody(
|
||||
MediaCccDispatcher.getStringFromRaw(R.raw.conferences_101_33c3_json)));
|
||||
|
||||
service.getConference(101)
|
||||
.doOnError(throwable -> fail())
|
||||
.blockingSubscribe
|
||||
(conference -> assertThat(conference.getAcronym(),is("33c3")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void sortAllEvents() throws IOException {
|
||||
server.enqueue(new MockResponse().setBody(
|
||||
MediaCccDispatcher.getStringFromRaw(R.raw.events_json)));
|
||||
|
||||
service.getEvents()
|
||||
.doOnError(throwable -> fail())
|
||||
.blockingSubscribe(events -> Collections.sort(events));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void getEventTest() throws IOException {
|
||||
server.enqueue(new MockResponse().setBody(
|
||||
MediaCccDispatcher.getStringFromRaw(R.raw.events_2837_json)));
|
||||
|
||||
service.getEvent(2837)
|
||||
.doOnError(throwable -> fail())
|
||||
.blockingSubscribe(
|
||||
event -> assertThat(event.getGuid(), is("9f2e9ff0-1555-470b-8743-9f07f54e9097")));
|
||||
}
|
||||
|
||||
// @Test
|
||||
// public void test1() throws IOException {
|
||||
// service.getStreamingConferences().blockingSubscribe(List<LiveConference> liveConferences) -> assertEquals(1, liveConferences.size()));
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void test2() throws IOException {
|
||||
// service.getStreamingConferences().blockingSubscribe
|
||||
// (List<LiveConference> liveConferences) -> assertEquals("FOSSGIS 2017", liveConferences.get(0).getConference()));
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void getEventRecordingsTest() throws IOException {
|
||||
// client.getEvent(3674).blockingSubscribe(event -> assertEquals(9, event.getRecordings().size()));
|
||||
// }
|
||||
//
|
||||
//
|
||||
// @Test
|
||||
// public void getRecordingTest() throws IOException {
|
||||
// client.getRecording(14142)
|
||||
// .blockingSubscribe(recording -> assertEquals("2016-12-29T03:16:16.105+01:00",
|
||||
// recording.getUpdatedAt()));
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void getConferencEventListTest() throws IOException {
|
||||
// client.getConferences().blockingSubscribe(conferences ->
|
||||
// assertEquals(99, conferences.getConferences().size()));
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void eventTagsTest() throws IOException {
|
||||
// client.getConference(101).blockingSubscribe(
|
||||
// conference -> assertEquals(12, conference.getEventsByTags().keySet().size()));
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void sortTest() throws IOException {
|
||||
// client.getConferences().blockingSubscribe(conferences -> {
|
||||
// Collections.sort(conferences.getConferences());
|
||||
// for (Conference conf : conferences.getConferences()) {
|
||||
// client.getConference(conf.getApiID())
|
||||
// .blockingSubscribe(conference -> Collections.sort(conference.getEvents()));
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//
|
||||
//
|
||||
// @Test
|
||||
// public void mrmcd13() throws IOException {
|
||||
// client.getConference(38).blockingSubscribe(conference ->
|
||||
// Collections.sort(Lists.newArrayList(conference.getEventsByTags().keySet())));
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void testTagsToTalksRation() throws IOException {
|
||||
// client.getConferences().blockingSubscribe(conferences -> {
|
||||
// for (Conference conf : conferences.getConferences()) {
|
||||
// client.getConference(conf.getApiID()).blockingSubscribe(conference -> {
|
||||
// System.out.print(conference.getAcronym() + ": " + conference.getEventsByTags().keySet());
|
||||
// float sum = 0;
|
||||
// for (Event e : conference.getEvents()) {
|
||||
// sum += e.getTags().size();
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,107 @@
|
|||
package de.nicidienase.chaosflix;
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.test.InstrumentationRegistry;
|
||||
import android.util.Log;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Arrays;
|
||||
|
||||
import okhttp3.mockwebserver.Dispatcher;
|
||||
import okhttp3.mockwebserver.MockResponse;
|
||||
import okhttp3.mockwebserver.RecordedRequest;
|
||||
|
||||
/**
|
||||
* Created by felix on 25.03.17.
|
||||
*/
|
||||
public class MediaCccDispatcher extends Dispatcher {
|
||||
|
||||
private static final String TAG = MediaCccDispatcher.class.getSimpleName();
|
||||
|
||||
@Override
|
||||
public MockResponse dispatch(RecordedRequest request) throws InterruptedException {
|
||||
try {
|
||||
String path = request.getPath();
|
||||
return getResponseForPath(path);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
return new MockResponse().setResponseCode(404);
|
||||
}
|
||||
}
|
||||
|
||||
@NonNull
|
||||
protected MockResponse getResponseForPath(String path) throws IOException {
|
||||
String[] split = path.split("/");
|
||||
Log.d(TAG, path);
|
||||
switch (split[1]) {
|
||||
case "public":
|
||||
switch (split[2]) {
|
||||
case "conferences":
|
||||
if (split.length <= 3) {
|
||||
return new MockResponse().setBody(getStringFromRaw(de.nicidienase.chaosflix.test.R.raw.conferences_json));
|
||||
} else {
|
||||
switch (split[3]) {
|
||||
case "101":
|
||||
return new MockResponse().setBody(getStringFromRaw(de.nicidienase.chaosflix.test.R.raw.conferences_101_33c3_json));
|
||||
case "13":
|
||||
return new MockResponse().setBody(getStringFromRaw(de.nicidienase.chaosflix.test.R.raw.conferences_13_mrmcd101b_json));
|
||||
case "21":
|
||||
return new MockResponse().setBody(getStringFromRaw(de.nicidienase.chaosflix.test.R.raw.conferences_21_18c3_json));
|
||||
case "78":
|
||||
return new MockResponse().setBody(getStringFromRaw(de.nicidienase.chaosflix.test.R.raw.conferences_78_32c3_json));
|
||||
case "85":
|
||||
return new MockResponse().setBody(getStringFromRaw(de.nicidienase.chaosflix.test.R.raw.conferences_85_gpn16_json));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
case "events":
|
||||
if (split.length <= 3) {
|
||||
return new MockResponse()
|
||||
.setResponseCode(200)
|
||||
.setBody(getStringFromRaw(de.nicidienase.chaosflix.test.R.raw.events_json));
|
||||
} else {
|
||||
switch (split[3]) {
|
||||
case "2837":
|
||||
return new MockResponse().setBody(getStringFromRaw(de.nicidienase.chaosflix.test.R.raw.events_2837_json));
|
||||
case "2848":
|
||||
return new MockResponse().setBody(getStringFromRaw(de.nicidienase.chaosflix.test.R.raw.events_2848_json));
|
||||
case "3062":
|
||||
return new MockResponse().setBody(getStringFromRaw(de.nicidienase.chaosflix.test.R.raw.events_3062_json));
|
||||
case "3066":
|
||||
return new MockResponse().setBody(getStringFromRaw(de.nicidienase.chaosflix.test.R.raw.events_3066_json));
|
||||
case "3104":
|
||||
return new MockResponse().setBody(getStringFromRaw(de.nicidienase.chaosflix.test.R.raw.events_3104_json));
|
||||
case "3623":
|
||||
return new MockResponse().setBody(getStringFromRaw(de.nicidienase.chaosflix.test.R.raw.events_3623_json));
|
||||
case "3768":
|
||||
return new MockResponse().setBody(getStringFromRaw(de.nicidienase.chaosflix.test.R.raw.events_3768_json));
|
||||
case "3668":
|
||||
return new MockResponse().setBody(getStringFromRaw(de.nicidienase.chaosflix.test.R.raw.events_3668_json));
|
||||
case "709":
|
||||
return new MockResponse().setBody(getStringFromRaw(de.nicidienase.chaosflix.test.R.raw.events_709_json));
|
||||
case "710":
|
||||
return new MockResponse().setBody(getStringFromRaw(de.nicidienase.chaosflix.test.R.raw.events_710_json));
|
||||
}
|
||||
}
|
||||
}
|
||||
case "streams":
|
||||
return new MockResponse().setBody(getStringFromRaw(de.nicidienase.chaosflix.test.R.raw.streams_v2_json));
|
||||
default:
|
||||
return new MockResponse().setResponseCode(404);
|
||||
}
|
||||
}
|
||||
|
||||
protected static String getStringFromRaw(int resourceID) throws IOException {
|
||||
InputStream inputStream = InstrumentationRegistry
|
||||
.getContext().getResources().openRawResource(resourceID);
|
||||
StringWriter writer = new StringWriter();
|
||||
IOUtils.copy(inputStream, writer);
|
||||
return writer.toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
package de.nicidienase.chaosflix;
|
||||
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
import android.util.Log;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* Created by felix on 25.03.17.
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class MediaCccDispatcherTest {
|
||||
private static final String TAG = MediaCccDispatcher.class.getSimpleName();
|
||||
private MediaCccDispatcher dispatcher;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
dispatcher = new MediaCccDispatcher();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test200() throws IOException {
|
||||
String status = dispatcher.getResponseForPath("/public/conferences").getStatus();
|
||||
Log.d(TAG,status);
|
||||
assertTrue(status.contains("200"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConferences101() throws IOException {
|
||||
String status = dispatcher.getResponseForPath("/public/conferences/101").getStatus();
|
||||
Log.d(TAG,status);
|
||||
assertTrue(status.contains("200"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test404() throws IOException {
|
||||
String status = dispatcher.getResponseForPath("/foo/bar").getStatus();
|
||||
Log.d(TAG,status);
|
||||
assertTrue(status.contains("404"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEvents() throws IOException {
|
||||
String status = dispatcher.getResponseForPath("/public/events").getStatus();
|
||||
Log.d(TAG,status);
|
||||
assertTrue(status.contains("200"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEvent3062() throws IOException {
|
||||
String status = dispatcher.getResponseForPath("/public/events/3062").getStatus();
|
||||
Log.d(TAG,status);
|
||||
assertTrue(status.contains("200"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStreams() throws IOException {
|
||||
String status = dispatcher.getResponseForPath("/streams/v2.json").getStatus();
|
||||
Log.d(TAG,status);
|
||||
assertTrue(status.contains("200"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStreams2() throws IOException {
|
||||
String status = dispatcher.getResponseForPath("/streams/foobar").getStatus();
|
||||
Log.d(TAG,status);
|
||||
assertTrue(status.contains("200"));
|
||||
}
|
||||
|
||||
}
|
|
@ -3,6 +3,7 @@ package de.nicidienase.chaosflix.network;
|
|||
import android.app.Service;
|
||||
import android.content.Intent;
|
||||
import android.os.Binder;
|
||||
import android.os.Bundle;
|
||||
import android.os.IBinder;
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
|
@ -27,9 +28,12 @@ import retrofit2.converter.gson.GsonConverterFactory;
|
|||
|
||||
public class MediaApiService extends Service {
|
||||
|
||||
public static final String RECORDING_URL = "recording_url";
|
||||
public static final String STREAMING_URL = "streaming_url";
|
||||
|
||||
private final IBinder mBinder = new LocalBinder();
|
||||
private RecordingService mRecordingApiService;
|
||||
private StreamingService mStreamingApiService;
|
||||
private RecordingService mRecordingApiService = null;
|
||||
private StreamingService mStreamingApiService = null;
|
||||
|
||||
public class LocalBinder extends Binder {
|
||||
public MediaApiService getService() {
|
||||
|
@ -37,18 +41,18 @@ public class MediaApiService extends Service {
|
|||
}
|
||||
}
|
||||
|
||||
public MediaApiService(){
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
}
|
||||
|
||||
private void setupApiServices(String streamingUrl, String recordingUrl) {
|
||||
OkHttpClient client = new OkHttpClient();
|
||||
GsonConverterFactory gsonConverterFactory = GsonConverterFactory.create();
|
||||
RxJava2CallAdapterFactory rxJava2CallAdapterFactory = RxJava2CallAdapterFactory.create();
|
||||
|
||||
Retrofit retrofitRecordings = new Retrofit.Builder()
|
||||
.baseUrl(getString(R.string.api_media_ccc_url))
|
||||
.baseUrl(recordingUrl)
|
||||
.client(client)
|
||||
.addConverterFactory(gsonConverterFactory)
|
||||
.addCallAdapterFactory(rxJava2CallAdapterFactory)
|
||||
|
@ -56,7 +60,7 @@ public class MediaApiService extends Service {
|
|||
mRecordingApiService = retrofitRecordings.create(RecordingService.class);
|
||||
|
||||
Retrofit retrofigStreaming = new Retrofit.Builder()
|
||||
.baseUrl(getString(R.string.streaming_media_ccc_url))
|
||||
.baseUrl(streamingUrl)
|
||||
.client(client)
|
||||
.addConverterFactory(gsonConverterFactory)
|
||||
.addCallAdapterFactory(rxJava2CallAdapterFactory)
|
||||
|
@ -67,6 +71,16 @@ public class MediaApiService extends Service {
|
|||
@Nullable
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
if(null == mRecordingApiService || null == mStreamingApiService){
|
||||
Bundle extras = intent.getExtras();
|
||||
String recordingUrl = getResources().getString(R.string.api_media_ccc_url);
|
||||
String streamingUrl = getResources().getString(R.string.streaming_media_ccc_url);
|
||||
if(extras != null){
|
||||
recordingUrl = extras.getString(RECORDING_URL);
|
||||
streamingUrl = extras.getString(STREAMING_URL);
|
||||
}
|
||||
setupApiServices(streamingUrl, recordingUrl);
|
||||
}
|
||||
return mBinder;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,102 +0,0 @@
|
|||
package de.nicidienase.chaosflix;
|
||||
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
|
||||
import de.nicidienase.chaosflix.entities.recording.Conference;
|
||||
import de.nicidienase.chaosflix.entities.recording.Event;
|
||||
|
||||
/**
|
||||
* Created by felix on 17.03.17.
|
||||
*/
|
||||
|
||||
public class RecordingClientTest {
|
||||
|
||||
// private static final String TAG = RecordingClientTest.class.getSimpleName();
|
||||
// private RecordingClient client;
|
||||
//
|
||||
// @Before
|
||||
// public void beforeTest() {
|
||||
// this.client = new RecordingClient();
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void getConferenceTest() throws IOException {
|
||||
// client.getConference(101).subscribe
|
||||
// (conference -> assertEquals("33c3", conference.getAcronym()));
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void getEventTest() throws IOException {
|
||||
// client.getEvent(3674).blockingSubscribe(
|
||||
// event -> assertEquals("bfc2ab1f-8384-4d7d-801a-dde8c81e039c", event.getGuid()));
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void getEventRecordingsTest() throws IOException {
|
||||
// client.getEvent(3674).blockingSubscribe(event -> assertEquals(9, event.getRecordings().size()));
|
||||
// }
|
||||
//
|
||||
//
|
||||
// @Test
|
||||
// public void getRecordingTest() throws IOException {
|
||||
// client.getRecording(14142)
|
||||
// .blockingSubscribe(recording -> assertEquals("2016-12-29T03:16:16.105+01:00",
|
||||
// recording.getUpdatedAt()));
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void getConferencEventListTest() throws IOException {
|
||||
// client.getConferences().blockingSubscribe(conferences ->
|
||||
// assertEquals(99, conferences.getConferences().size()));
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void eventTagsTest() throws IOException {
|
||||
// client.getConference(101).blockingSubscribe(
|
||||
// conference -> assertEquals(12, conference.getEventsByTags().keySet().size()));
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void sortTest() throws IOException {
|
||||
// client.getConferences().blockingSubscribe(conferences -> {
|
||||
// Collections.sort(conferences.getConferences());
|
||||
// for (Conference conf : conferences.getConferences()) {
|
||||
// client.getConference(conf.getApiID())
|
||||
// .blockingSubscribe(conference -> Collections.sort(conference.getEvents()));
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void sortAllEvents() throws IOException {
|
||||
// client.getAllEvents().blockingSubscribe(events -> Collections.sort(events));
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void mrmcd13() throws IOException {
|
||||
// client.getConference(38).blockingSubscribe(conference ->
|
||||
// Collections.sort(Lists.newArrayList(conference.getEventsByTags().keySet())));
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void testTagsToTalksRation() throws IOException {
|
||||
// client.getConferences().blockingSubscribe(conferences -> {
|
||||
// for (Conference conf : conferences.getConferences()) {
|
||||
// client.getConference(conf.getApiID()).blockingSubscribe(conference -> {
|
||||
// System.out.print(conference.getAcronym() + ": " + conference.getEventsByTags().keySet());
|
||||
// float sum = 0;
|
||||
// for (Event e : conference.getEvents()) {
|
||||
// sum += e.getTags().size();
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
package de.nicidienase.chaosflix;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import de.nicidienase.chaosflix.network.StreamingService;
|
||||
import okhttp3.mockwebserver.MockResponse;
|
||||
import okhttp3.mockwebserver.MockWebServer;
|
||||
|
||||
/**
|
||||
* Created by felix on 23.03.17.
|
||||
*/
|
||||
|
||||
public class StreamingClientTest {
|
||||
|
||||
private static MockWebServer server;
|
||||
private static StreamingService service;
|
||||
|
||||
|
||||
// @BeforeClass
|
||||
// public static void setupClass() throws IOException {
|
||||
// server = new MockWebServer();
|
||||
// server.start();
|
||||
// String serverUrl = server.url("/").toString();
|
||||
//// service = new StreamingClient(serverUrl);
|
||||
// service = new StreamingClient();
|
||||
// }
|
||||
//
|
||||
// @Before
|
||||
// public void setupTest() throws IOException {
|
||||
// server.enqueue(new MockResponse().setResponseCode(200).setBody(TestResources.testJson));
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void test1() throws IOException {
|
||||
// service.getStreamingConferences().blockingSubscribe(List<LiveConference> liveConferences) -> assertEquals(1, liveConferences.size()));
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void test2() throws IOException {
|
||||
// service.getStreamingConferences().blockingSubscribe
|
||||
// (List<LiveConference> liveConferences) -> assertEquals("FOSSGIS 2017", liveConferences.get(0).getConference()));
|
||||
// }
|
||||
}
|
|
@ -1,73 +0,0 @@
|
|||
package de.nicidienase.chaosflix;
|
||||
|
||||
/**
|
||||
* Created by felix on 23.03.17.
|
||||
*/
|
||||
|
||||
public class TestResources {
|
||||
public static final String testJson =
|
||||
"[{\"conference\": \"FOSSGIS 2017\",\"slug\": \"fossgis17\",\"author\": \"FOSSGIS e.V.\"" +
|
||||
",\"description\": \"Die FOSSGIS-Konferenz ist im D-A-CH Raum die führende Konfe" +
|
||||
"renz für Freie und Open Source Software für Geoinformationssysteme OpenStreetMa" +
|
||||
"p.\",\"keywords\": \"FOSSGIS, FOSSGIS-Konferenz, 2017, FOSSGIS-Konferenz 2017, " +
|
||||
"Open Source, GIS, Konferenz, Geoinformatik, OpenStreetMap, Passau, Video, Strea" +
|
||||
"ming, Live, Livestream\",\"startsAt\": \"2017-03-22T08:30:00+0000\",\"endsAt\":" +
|
||||
" \"2017-03-25T14:00:00+0000\",\"groups\": [{\"group\": \"Lecture Rooms\",\"room" +
|
||||
"s\": [{\"slug\": \"AM-HS-9\",\"schedulename\": \"AM HS 9\",\"thumb\": \"https:/" +
|
||||
"/streaming.media.ccc.de/thumbs/s6.png\",\"link\": \"https://streaming.media.ccc" +
|
||||
".de/fossgis17/AM-HS-9\",\"display\": \"AM HS 9\",\"streams\": [{\"slug\": \"hd-" +
|
||||
"native\",\"display\": \"AM HS 9 FullHD Video\",\"type\": \"video\",\"isTranslat" +
|
||||
"ed\": false,\"videoSize\": [1920,1080],\"urls\": {\"webm\": {\"display\": \"Web" +
|
||||
"M\",\"tech\": \"1920x1080, VP8+Vorbis in WebM, 3.5 MBit/s\",\"url\": \"https://" +
|
||||
"cdn.c3voc.de/s6_native_hd.webm\"},\"hls\": {\"display\": \"HLS\",\"tech\": \"19" +
|
||||
"20x1080, h264+AAC im MPEG-TS-Container via HTTP, 3 MBit/s\",\"url\": \"https://" +
|
||||
"cdn.c3voc.de/hls/s6_native_hd.m3u8\"}}},{\"slug\": \"sd-native\",\"display\": \"" +
|
||||
"AM HS 9 SD Video\",\"type\": \"video\",\"isTranslated\": false,\"videoSize\": [" +
|
||||
"1024,576],\"urls\": {\"webm\": {\"display\": \"WebM\",\"tech\": \"1024x576, VP8" +
|
||||
"+Vorbis in WebM, 1 MBit/s\",\"url\": \"https://cdn.c3voc.de/s6_native_sd.webm\"" +
|
||||
"},\"hls\": {\"display\": \"HLS\",\"tech\": \"1024x576, h264+AAC im MPEG-TS-Cont" +
|
||||
"ainer via HTTP, 800 kBit/s\",\"url\": \"https://cdn.c3voc.de/hls/s6_native_sd.m" +
|
||||
"3u8\"}}},{\"slug\": \"audio-native\",\"display\": \"AM HS 9 Audio\",\"type\": \"" +
|
||||
"audio\",\"isTranslated\": false,\"videoSize\": null,\"urls\": {\"mp3\": {\"disp" +
|
||||
"lay\": \"MP3\",\"tech\": \"MP3-Audio, 96 kBit/s\",\"url\": \"https://cdn.c3voc." +
|
||||
"de/s6_native.mp3\"},\"opus\": {\"display\": \"Opus\",\"tech\": \"Opus-Audio, 64" +
|
||||
" kBit/s\",\"url\": \"https://cdn.c3voc.de/s6_native.opus\"}}}]},{\"slug\": \"IM" +
|
||||
"-HS-11\",\"schedulename\": \"IM HS 11\",\"thumb\": \"https://streaming.media.cc" +
|
||||
"c.de/thumbs/s4.png\",\"link\": \"https://streaming.media.ccc.de/fossgis17/IM-HS" +
|
||||
"-11\",\"display\": \"IM-HS-11\",\"streams\": [{\"slug\": \"hd-native\",\"displa" +
|
||||
"y\": \"IM-HS-11 FullHD Video\",\"type\": \"video\",\"isTranslated\": false,\"vi" +
|
||||
"deoSize\": [1920,1080],\"urls\": {\"webm\": {\"display\": \"WebM\",\"tech\": \"" +
|
||||
"1920x1080, VP8+Vorbis in WebM, 3.5 MBit/s\",\"url\": \"https://cdn.c3voc.de/s4_" +
|
||||
"native_hd.webm\"},\"hls\": {\"display\": \"HLS\",\"tech\": \"1920x1080, h264+AA" +
|
||||
"C im MPEG-TS-Container via HTTP, 3 MBit/s\",\"url\": \"https://cdn.c3voc.de/hls" +
|
||||
"/s4_native_hd.m3u8\"}}},{\"slug\": \"sd-native\",\"display\": \"IM-HS-11 SD Vid" +
|
||||
"eo\",\"type\": \"video\",\"isTranslated\": false,\"videoSize\": [1024,576],\"ur" +
|
||||
"ls\": {\"webm\": {\"display\": \"WebM\",\"tech\": \"1024x576, VP8+Vorbis in Web" +
|
||||
"M, 1 MBit/s\",\"url\": \"https://cdn.c3voc.de/s4_native_sd.webm\"},\"hls\": {\"" +
|
||||
"display\": \"HLS\",\"tech\": \"1024x576, h264+AAC im MPEG-TS-Container via HTTP" +
|
||||
", 800 kBit/s\",\"url\": \"https://cdn.c3voc.de/hls/s4_native_sd.m3u8\"}}},{\"sl" +
|
||||
"ug\": \"audio-native\",\"display\": \"IM-HS-11 Audio\",\"type\": \"audio\",\"is" +
|
||||
"Translated\": false,\"videoSize\": null,\"urls\": {\"mp3\": {\"display\": \"MP3" +
|
||||
"\",\"tech\": \"MP3-Audio, 96 kBit/s\",\"url\": \"https://cdn.c3voc.de/s4_native" +
|
||||
".mp3\"},\"opus\": {\"display\": \"Opus\",\"tech\": \"Opus-Audio, 64 kBit/s\",\"" +
|
||||
"url\": \"https://cdn.c3voc.de/s4_native.opus\"}}}]},{\"slug\": \"IM-HS-13\",\"s" +
|
||||
"chedulename\": \"IM HS 13\",\"thumb\": \"https://streaming.media.ccc.de/thumbs/" +
|
||||
"s5.png\",\"link\": \"https://streaming.media.ccc.de/fossgis17/IM-HS-13\",\"disp" +
|
||||
"lay\": \"IM HS 13\",\"streams\": [{\"slug\": \"hd-native\",\"display\": \"IM HS" +
|
||||
" 13 FullHD Video\",\"type\": \"video\",\"isTranslated\": false,\"videoSize\": [" +
|
||||
"1920,1080],\"urls\": {\"webm\": {\"display\": \"WebM\",\"tech\": \"1920x1080, V" +
|
||||
"P8+Vorbis in WebM, 3.5 MBit/s\",\"url\": \"https://cdn.c3voc.de/s5_native_hd.we" +
|
||||
"bm\"},\"hls\": {\"display\": \"HLS\",\"tech\": \"1920x1080, h264+AAC im MPEG-TS" +
|
||||
"-Container via HTTP, 3 MBit/s\",\"url\": \"https://cdn.c3voc.de/hls/s5_native_h" +
|
||||
"d.m3u8\"}}},{\"slug\": \"sd-native\",\"display\": \"IM HS 13 SD Video\",\"type\"" +
|
||||
": \"video\",\"isTranslated\": false,\"videoSize\": [1024,576],\"urls\": {\"webm" +
|
||||
"\": {\"display\": \"WebM\",\"tech\": \"1024x576, VP8+Vorbis in WebM, 1 MBit/s\"" +
|
||||
",\"url\": \"https://cdn.c3voc.de/s5_native_sd.webm\"},\"hls\": {\"display\": \"" +
|
||||
"HLS\",\"tech\": \"1024x576, h264+AAC im MPEG-TS-Container via HTTP, 800 kBit/s\"" +
|
||||
",\"url\": \"https://cdn.c3voc.de/hls/s5_native_sd.m3u8\"}}},{\"slug\": \"audio-" +
|
||||
"native\",\"display\": \"IM HS 13 Audio\",\"type\": \"audio\",\"isTranslated\": " +
|
||||
"false,\"videoSize\": null,\"urls\": {\"mp3\": {\"display\": \"MP3\",\"tech\": \"" +
|
||||
"MP3-Audio, 96 kBit/s\",\"url\": \"https://cdn.c3voc.de/s5_native.mp3\"},\"opus\"" +
|
||||
": {\"display\": \"Opus\",\"tech\": \"Opus-Audio, 64 kBit/s\",\"url\": \"https:/" +
|
||||
"/cdn.c3voc.de/s5_native.opus\"}}}]}]}]}]";
|
||||
}
|
234
streams_v2.json
234
streams_v2.json
|
@ -1,234 +0,0 @@
|
|||
[
|
||||
{
|
||||
"conference": "FOSSGIS 2017",
|
||||
"slug": "fossgis17",
|
||||
"author": "FOSSGIS e.V.",
|
||||
"description": "Die FOSSGIS-Konferenz ist im D-A-CH Raum die führende Konferenz für Freie und Open Source Software für Geoinformationssysteme OpenStreetMap.",
|
||||
"keywords": "FOSSGIS, FOSSGIS-Konferenz, 2017, FOSSGIS-Konferenz 2017, Open Source, GIS, Konferenz, Geoinformatik, OpenStreetMap, Passau, Video, Streaming, Live, Livestream",
|
||||
"startsAt": "2017-03-22T08:30:00+0000",
|
||||
"endsAt": "2017-03-25T14:00:00+0000",
|
||||
"groups": [
|
||||
{
|
||||
"group": "Lecture Rooms",
|
||||
"rooms": [
|
||||
{
|
||||
"slug": "AM-HS-9",
|
||||
"schedulename": "AM HS 9",
|
||||
"thumb": "https://streaming.media.ccc.de/thumbs/s6.png",
|
||||
"link": "https://streaming.media.ccc.de/fossgis17/AM-HS-9",
|
||||
"display": "AM HS 9",
|
||||
"streams": [
|
||||
{
|
||||
"slug": "hd-native",
|
||||
"display": "AM HS 9 FullHD Video",
|
||||
"type": "video",
|
||||
"isTranslated": false,
|
||||
"videoSize": [
|
||||
1920,
|
||||
1080
|
||||
],
|
||||
"urls": {
|
||||
"webm": {
|
||||
"display": "WebM",
|
||||
"tech": "1920x1080, VP8+Vorbis in WebM, 3.5 MBit/s",
|
||||
"url": "https://cdn.c3voc.de/s6_native_hd.webm"
|
||||
},
|
||||
"hls": {
|
||||
"display": "HLS",
|
||||
"tech": "1920x1080, h264+AAC im MPEG-TS-Container via HTTP, 3 MBit/s",
|
||||
"url": "https://cdn.c3voc.de/hls/s6_native_hd.m3u8"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"slug": "sd-native",
|
||||
"display": "AM HS 9 SD Video",
|
||||
"type": "video",
|
||||
"isTranslated": false,
|
||||
"videoSize": [
|
||||
1024,
|
||||
576
|
||||
],
|
||||
"urls": {
|
||||
"webm": {
|
||||
"display": "WebM",
|
||||
"tech": "1024x576, VP8+Vorbis in WebM, 1 MBit/s",
|
||||
"url": "https://cdn.c3voc.de/s6_native_sd.webm"
|
||||
},
|
||||
"hls": {
|
||||
"display": "HLS",
|
||||
"tech": "1024x576, h264+AAC im MPEG-TS-Container via HTTP, 800 kBit/s",
|
||||
"url": "https://cdn.c3voc.de/hls/s6_native_sd.m3u8"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"slug": "audio-native",
|
||||
"display": "AM HS 9 Audio",
|
||||
"type": "audio",
|
||||
"isTranslated": false,
|
||||
"videoSize": null,
|
||||
"urls": {
|
||||
"mp3": {
|
||||
"display": "MP3",
|
||||
"tech": "MP3-Audio, 96 kBit/s",
|
||||
"url": "https://cdn.c3voc.de/s6_native.mp3"
|
||||
},
|
||||
"opus": {
|
||||
"display": "Opus",
|
||||
"tech": "Opus-Audio, 64 kBit/s",
|
||||
"url": "https://cdn.c3voc.de/s6_native.opus"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"slug": "IM-HS-11",
|
||||
"schedulename": "IM HS 11",
|
||||
"thumb": "https://streaming.media.ccc.de/thumbs/s4.png",
|
||||
"link": "https://streaming.media.ccc.de/fossgis17/IM-HS-11",
|
||||
"display": "IM-HS-11",
|
||||
"streams": [
|
||||
{
|
||||
"slug": "hd-native",
|
||||
"display": "IM-HS-11 FullHD Video",
|
||||
"type": "video",
|
||||
"isTranslated": false,
|
||||
"videoSize": [
|
||||
1920,
|
||||
1080
|
||||
],
|
||||
"urls": {
|
||||
"webm": {
|
||||
"display": "WebM",
|
||||
"tech": "1920x1080, VP8+Vorbis in WebM, 3.5 MBit/s",
|
||||
"url": "https://cdn.c3voc.de/s4_native_hd.webm"
|
||||
},
|
||||
"hls": {
|
||||
"display": "HLS",
|
||||
"tech": "1920x1080, h264+AAC im MPEG-TS-Container via HTTP, 3 MBit/s",
|
||||
"url": "https://cdn.c3voc.de/hls/s4_native_hd.m3u8"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"slug": "sd-native",
|
||||
"display": "IM-HS-11 SD Video",
|
||||
"type": "video",
|
||||
"isTranslated": false,
|
||||
"videoSize": [
|
||||
1024,
|
||||
576
|
||||
],
|
||||
"urls": {
|
||||
"webm": {
|
||||
"display": "WebM",
|
||||
"tech": "1024x576, VP8+Vorbis in WebM, 1 MBit/s",
|
||||
"url": "https://cdn.c3voc.de/s4_native_sd.webm"
|
||||
},
|
||||
"hls": {
|
||||
"display": "HLS",
|
||||
"tech": "1024x576, h264+AAC im MPEG-TS-Container via HTTP, 800 kBit/s",
|
||||
"url": "https://cdn.c3voc.de/hls/s4_native_sd.m3u8"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"slug": "audio-native",
|
||||
"display": "IM-HS-11 Audio",
|
||||
"type": "audio",
|
||||
"isTranslated": false,
|
||||
"videoSize": null,
|
||||
"urls": {
|
||||
"mp3": {
|
||||
"display": "MP3",
|
||||
"tech": "MP3-Audio, 96 kBit/s",
|
||||
"url": "https://cdn.c3voc.de/s4_native.mp3"
|
||||
},
|
||||
"opus": {
|
||||
"display": "Opus",
|
||||
"tech": "Opus-Audio, 64 kBit/s",
|
||||
"url": "https://cdn.c3voc.de/s4_native.opus"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"slug": "IM-HS-13",
|
||||
"schedulename": "IM HS 13",
|
||||
"thumb": "https://streaming.media.ccc.de/thumbs/s5.png",
|
||||
"link": "https://streaming.media.ccc.de/fossgis17/IM-HS-13",
|
||||
"display": "IM HS 13",
|
||||
"streams": [
|
||||
{
|
||||
"slug": "hd-native",
|
||||
"display": "IM HS 13 FullHD Video",
|
||||
"type": "video",
|
||||
"isTranslated": false,
|
||||
"videoSize": [
|
||||
1920,
|
||||
1080
|
||||
],
|
||||
"urls": {
|
||||
"webm": {
|
||||
"display": "WebM",
|
||||
"tech": "1920x1080, VP8+Vorbis in WebM, 3.5 MBit/s",
|
||||
"url": "https://cdn.c3voc.de/s5_native_hd.webm"
|
||||
},
|
||||
"hls": {
|
||||
"display": "HLS",
|
||||
"tech": "1920x1080, h264+AAC im MPEG-TS-Container via HTTP, 3 MBit/s",
|
||||
"url": "https://cdn.c3voc.de/hls/s5_native_hd.m3u8"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"slug": "sd-native",
|
||||
"display": "IM HS 13 SD Video",
|
||||
"type": "video",
|
||||
"isTranslated": false,
|
||||
"videoSize": [
|
||||
1024,
|
||||
576
|
||||
],
|
||||
"urls": {
|
||||
"webm": {
|
||||
"display": "WebM",
|
||||
"tech": "1024x576, VP8+Vorbis in WebM, 1 MBit/s",
|
||||
"url": "https://cdn.c3voc.de/s5_native_sd.webm"
|
||||
},
|
||||
"hls": {
|
||||
"display": "HLS",
|
||||
"tech": "1024x576, h264+AAC im MPEG-TS-Container via HTTP, 800 kBit/s",
|
||||
"url": "https://cdn.c3voc.de/hls/s5_native_sd.m3u8"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"slug": "audio-native",
|
||||
"display": "IM HS 13 Audio",
|
||||
"type": "audio",
|
||||
"isTranslated": false,
|
||||
"videoSize": null,
|
||||
"urls": {
|
||||
"mp3": {
|
||||
"display": "MP3",
|
||||
"tech": "MP3-Audio, 96 kBit/s",
|
||||
"url": "https://cdn.c3voc.de/s5_native.mp3"
|
||||
},
|
||||
"opus": {
|
||||
"display": "Opus",
|
||||
"tech": "Opus-Audio, 64 kBit/s",
|
||||
"url": "https://cdn.c3voc.de/s5_native.opus"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
Loading…
Reference in a new issue