Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 11d53aff authored by tobiasKaminsky's avatar tobiasKaminsky Committed by AndyScherzinger
Browse files

- move to new src folder

- add integration test for ExceptionParser
- include integration tests
parent 73320979
Loading
Loading
Loading
Loading

.codecov.yml

0 → 100644
+13 −0
Original line number Diff line number Diff line
codecov:
  branch: master
  ci:
    - drone.nextcloud.com

coverage:
  precision: 2
  round: down
  range: "70...100"

comment:
  layout: "header, diff, changes, uncovered, tree"
  behavior: default
 No newline at end of file
+23 −16
Original line number Diff line number Diff line
pipeline:
  test:
    image: nextcloudci/android:android-30
  compile:
    image: nextcloudci/android:android-33
    commands:
      # - echo no | android create avd --force -n test -t $ANDROID_TARGET --abi $ANDROID_ABI -c 20M
      # - emulator -avd test -no-window &
      # - ./wait_for_emulator.sh
      
      # build app 
      - ./gradlew clean build
      # build app and assemble APK
      - ./gradlew assemble

    environment:
      - ANDROID_TARGET=android-28
      - ANDROID_ABI=armeabi-v7a
      - LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/:/opt/android-sdk-linux/tools/lib64/gles_mesa/
  test:
      image: nextcloudci/android:android-33
      privileged: true
      commands:
        - emulator -avd android-27 -no-window -no-audio &
        - ./wait_for_emulator.sh
        - ./gradlew jacocoTestDebugUnitTestReport || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "Unit"
        - ./gradlew assembleDebug installDebugAndroidTest
        - ./gradlew createDebugCoverageReport || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "IT"
        - ./gradlew combinedTestReport
        - curl -o codecov.sh https://codecov.io/bash
        - bash ./codecov.sh -t 2eec98c3-ff20-4cad-9e08-463471a33431
      secrets: [ LOG_USERNAME, LOG_PASSWORD ]

  lint:
      image: nextcloudci/android:android-30
      image: nextcloudci/android:android-33
      commands:
        # needs gplay
        - sed -i '/com.google.*.gms/s/^.*\\/\\///g' build.gradle
        - export BRANCH=$(scripts/lint/getBranchName.sh $GIT_USERNAME $GIT_TOKEN $DRONE_PULL_REQUEST)
        - scripts/lint/lint-up-wrapper.sh $GIT_USERNAME $GIT_TOKEN $BRANCH $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER
      secrets: [ GIT_USERNAME, GIT_TOKEN, LOG_USERNAME, LOG_PASSWORD ]
@@ -38,4 +41,8 @@ pipeline:
          status: failure
          branch: master

services:
  server:
    image: nextcloudci/server:server-1

branches: master
+1 −1
Original line number Diff line number Diff line
DO NOT TOUCH; GENERATED BY DRONE
      <span class="mdl-layout-title">Lint Report: 2 errors and 15 warnings</span>
      <span class="mdl-layout-title">Lint Report: 2 errors and 19 warnings</span>
+19 −0
Original line number Diff line number Diff line
#!/usr/bin/env bash

URL=https://nextcloud.kaminsky.me/remote.php/webdav/integrationTests-library
ID=$3
USER=$1
PASS=$2
TYPE=$4

if [ $TYPE = "IT" ]; then
    cd test_client/build/reports/androidTests/connected/
else 
    cd test_client/build/reports/tests/testDebugUnitTest
fi

find . -type d -exec curl -u $USER:$PASS -X MKCOL $URL/$ID/$(echo {} | sed s#\./##) \;
find . -type f -exec curl -u $USER:$PASS -X PUT $URL/$ID/$(echo {} | sed s#\./##) --upload-file {} \;

echo "Uploaded failing library tests to https://nextcloud.kaminsky.me/index.php/s/Pfc8NMxTStWtmMC -> $ID" 
exit 1
+9 −5
Original line number Diff line number Diff line
@@ -26,6 +26,8 @@ package com.owncloud.android.lib.common.operations;

import android.util.Xml;

import com.owncloud.android.lib.common.utils.Log_OC;

import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlPullParserFactory;
@@ -39,6 +41,7 @@ import java.io.InputStream;
 * @author masensio, tobiaskaminsky
 */
public class ExceptionParser {
    private static final String TAG = ExceptionParser.class.getSimpleName();

    private static final String INVALID_PATH_EXCEPTION_STRING = "OC\\Connector\\Sabre\\Exception\\InvalidPath";
    private static final String INVALID_PATH_EXCEPTION_UPLOAD_STRING = "OCP\\Files\\InvalidPathException";
@@ -52,8 +55,8 @@ public class ExceptionParser {
    private static final String NODE_EXCEPTION = "s:exception";
    private static final String NODE_MESSAGE = "s:message";

    private String exception;
    private String message;
    private String exception = "";
    private String message = "";

    /**
     * Parse is as an Invalid Path Exception
@@ -64,7 +67,6 @@ public class ExceptionParser {
     * @throws IOException
     */
    public ExceptionParser(InputStream is) throws XmlPullParserException, IOException {

        try {
            // XMLPullParser
            XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
@@ -75,14 +77,16 @@ public class ExceptionParser {
            parser.setInput(is, null);
            parser.nextTag();
            readError(parser);

        } catch (Exception e) {
            Log_OC.e(TAG, "Error parsing exception: " + e.getMessage());
        } finally {
            is.close();
        }
    }

    public boolean isInvalidCharacterException() {
        return exception.equalsIgnoreCase(INVALID_PATH_EXCEPTION_STRING) || exception.equalsIgnoreCase(INVALID_PATH_EXCEPTION_UPLOAD_STRING);
        return exception.equalsIgnoreCase(INVALID_PATH_EXCEPTION_STRING) ||
                exception.equalsIgnoreCase(INVALID_PATH_EXCEPTION_UPLOAD_STRING);
    }

    public boolean isVirusException() {
Loading