Skip to content
This repository has been archived by the owner on Jul 23, 2020. It is now read-only.

Commit

Permalink
1.75
Browse files Browse the repository at this point in the history
  • Loading branch information
raulhaag committed Dec 8, 2017
1 parent 99e3326 commit 6b5583d
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 35 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ Downloads

Changelog
---------
Cambios en v1.75:
* Todos los servidores funcionando al 08/12/2017.

Changes in v1.75:
* All servers working at 08/12/2017.

Cambios en v1.74:
* Todos los servidores funcionando 26/11/2017 excepto por japScan en mantenimiento.

Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ android {

defaultConfig {
applicationId "ar.rulosoft.mimanganu"
versionCode 74
versionName "1.74"
versionCode 75
versionName "1.75"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class TestServersCommon {
* @param hostBasedTests <code>true</code> if tests are to be run on the host, <code>false</code>
* otherwise
* @param context the <code>Context</code> to use during testing
* @throws Exception if something goes wrong
* @throws Exception if something goes wrong
*/
public TestServersCommon(int serverId, boolean hostBasedTests, Context context) throws Exception {
this.rand = new Random();
Expand All @@ -51,7 +51,7 @@ public TestServersCommon(int serverId, boolean hostBasedTests, Context context)

logMessage(String.format(Locale.getDefault(), "Testing: %s (id=%d)", serverBase.getServerName(), serverBase.getServerID()));

if(serverBase instanceof DeadServer) {
if (serverBase instanceof DeadServer) {
logMessage("[INFO] server is an instance of DeadServer - skipping.");
return;
}
Expand Down Expand Up @@ -94,12 +94,11 @@ private void testManga(ArrayList<Manga> mangas) throws Exception {
testLoadManga(manga);
try {
serverBase.loadChapters(manga, false);
}
catch (Exception e) {
} catch (Exception e) {
fail(getContext(e.getMessage()));
}

if(manga.getChapters().isEmpty()) {
if (manga.getChapters().isEmpty()) {
logMessage("[WRN] no chapters found - will try another Manga.");
}
} while (manga.getChapters().isEmpty() && retries-- > 0);
Expand Down Expand Up @@ -128,26 +127,25 @@ private void testLoadManga(Manga manga) throws Exception {

try {
serverBase.loadMangaInformation(manga, false);
}
catch (Exception e) {
} catch (Exception e) {
fail(getContext(e.getMessage()));
}
assertNotNull(getContext(), manga.getImages());
if(manga.getImages().isEmpty()) {
if (manga.getImages().isEmpty()) {
System.err.println("[WRN] no cover image set");
}

assertNotNull(getContext(), manga.getSynopsis());
assertFalse(getContext(), manga.getSynopsis().isEmpty());
assertEquals(getContext(), manga.getSynopsis(), manga.getSynopsis().trim());
if(manga.getSynopsis().equals(context.getString(R.string.nodisponible))) {
if (manga.getSynopsis().equals(context.getString(R.string.nodisponible))) {
System.err.println("[WRN] default value for 'summary'");
}

assertNotNull(getContext(), manga.getAuthor());
assertFalse(getContext(), manga.getAuthor().isEmpty());
assertEquals(getContext(), manga.getAuthor(), manga.getAuthor().trim().replaceAll("\\s+", " "));
if(manga.getAuthor().equals(context.getString(R.string.nodisponible))) {
if (manga.getAuthor().equals(context.getString(R.string.nodisponible))) {
System.err.println("[WRN] default value for 'author'");
}

Expand All @@ -157,7 +155,7 @@ private void testLoadManga(Manga manga) throws Exception {
assertEquals(getContext(), manga.getGenre(), manga.getGenre().replaceAll(",+", ","));
assertFalse(getContext(), manga.getGenre().startsWith(","));
assertFalse(getContext(), manga.getGenre().endsWith(","));
if(manga.getGenre().equals(context.getString(R.string.nodisponible))) {
if (manga.getGenre().equals(context.getString(R.string.nodisponible))) {
System.err.println("[WRN] default value for 'genre'");
}
}
Expand All @@ -174,8 +172,7 @@ private void testInitChapter(Chapter chapter) throws Exception {

try {
serverBase.chapterInit(chapter);
}
catch (Exception e) {
} catch (Exception e) {
fail(getContext(e.getMessage()));
}
assertFalse(getContext(), chapter.getPages() == 0);
Expand All @@ -186,8 +183,7 @@ private void testInitChapter(Chapter chapter) throws Exception {
try {
numimg = rand.nextInt(chapter.getPages()) + 1;
url = serverBase.getImageFrom(chapter, numimg);
}
catch (Exception e) {
} catch (Exception e) {
fail(getContext("[NUM] " + numimg + " - " + e.getMessage()));
}
testLoadImage(url);
Expand All @@ -197,19 +193,21 @@ private void testInitChapter(Chapter chapter) throws Exception {
try {
numimg = chapter.getPages();
url = serverBase.getImageFrom(chapter, numimg);
}
catch (Exception e) {
} catch (Exception e) {
fail(getContext("[NUM] " + numimg + " - " + e.getMessage()));
}
testLoadImage(url);
}

private void testLoadImage(String image) throws Exception {
logMessage(String.format(Locale.getDefault(), "[IMG] %s", image));

String parts[] = image.split("\\|");
logMessage(String.format(Locale.getDefault(), "[IMG] %s", parts[0]));
assertNotNull(getContext(), image);
assertFalse(getContext(), image.isEmpty());
assertTrue(getContext(), (image.split("//", -1).length - 1) <= 1);
if (parts.length == 1)
assertTrue(getContext(), (image.split("//", -1).length - 1) <= 1);
else
assertTrue(getContext(), (image.split("//", -1).length - 1) <= 2);

// additional test for NineManga servers to detect broken hotlinking
assertFalse(
Expand All @@ -218,44 +216,46 @@ private void testLoadImage(String image) throws Exception {
);

// check if the image loaded has at least 1kB (assume proper content)
image = Navigator.getInstance().getAndReturnResponseCodeOnFailure(image);
Navigator nav = Navigator.getInstance();
if (parts.length > 1) {
nav.addHeader("Referer", parts[1]);
}
image = nav.getAndReturnResponseCodeOnFailure(parts[0]);
assertTrue(getContext("[CONTENT] " + image), image.length() > 1024);
}

/**
* Log a message.
*
* <p>
* For host based tests, the message will directly be written on <code>System.out</code>. Device
* based tests do not have this pipe connected, so the message will be stored for now.
*
* @param msg the message to log
*/
private void logMessage(String msg) {
if(hostBasedTests) {
if (hostBasedTests) {
// direct output
System.out.println(msg);
}
else {
} else {
// store
messages.push(msg);
}
}

/**
* Create a context message to be used in assertions as message.
*
* <p>
* Returns nothing for host-based tests as <code>System.out</code> is working, for device based
* tests it will dump the collected logs as context before the exception stack trace.
*
* <p>
* Use this like <code>assertXXX(getContext(), condition);</code>.
*
* @return a string representing the log up to now
*/
private String getContext() {
if(hostBasedTests) {
if (hostBasedTests) {
return "\n";
}
else {
} else {
return "\n" + TextUtils.join("\n", messages) + "\n";
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="update_message">Cambios en v1.74:\n\t* Todos los servidores funcionando 26/11/2017 excepto por japScan en mantenimiento.</string>
<string name="update_message">Cambios en v1.75:\n\t* Todos los servidores funcionando 08/12/2017.</string>
<string name="action_ajustar_a">Ajustar a</string>
<string name="descargas">Descargas</string>
<string name="datosde">Datos de </string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="update_message">Changes in v1.74:\n\t* All servers working 26/11/2017 except for japScan under maintenance.</string>
<string name="update_message">Changes in v1.75:\n\t* All servers working 08/12/2017.</string>
<string name="_12hours">12 Hours</string>
<string name="_1day">1 day</string>
<string name="_2day">2 days</string>
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'com.android.tools.build:gradle:3.0.1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down

0 comments on commit 6b5583d

Please sign in to comment.