├── .gitmodules ├── version ├── server ├── integration-tests │ ├── libs │ │ ├── .gitkeep │ │ ├── junit-4.12.jar │ │ └── hamcrest-core-1.3.jar │ ├── calabash-test-suite │ │ ├── Gemfile │ │ ├── features │ │ │ ├── support │ │ │ │ └── env.rb │ │ │ ├── unittest.feature │ │ │ └── steps │ │ │ │ └── shared.rb │ │ ├── .calabash_settings │ │ ├── .irb-history │ │ └── test.keystore │ ├── resources │ │ └── unit-tester.apk │ ├── .gitignore │ ├── 01-compile-calabash.sh │ ├── 02-compile-tests.sh │ ├── 04-run-tests.sh │ ├── log.sh │ ├── 03-build-test-apk.sh │ └── test.sh ├── settings.gradle ├── app │ ├── .gitignore │ └── src │ │ ├── main │ │ ├── res │ │ │ └── values │ │ │ │ ├── styles.xml │ │ │ │ ├── strings.xml │ │ │ │ └── colors.xml │ │ └── AndroidManifest.xml │ │ └── androidTest │ │ └── java │ │ ├── sh │ │ └── calaba │ │ │ ├── org │ │ │ ├── codehaus │ │ │ │ └── jackson │ │ │ │ │ ├── map │ │ │ │ │ ├── util │ │ │ │ │ │ ├── package-info.java │ │ │ │ │ │ ├── Named.java │ │ │ │ │ │ ├── Provider.java │ │ │ │ │ │ ├── Annotations.java │ │ │ │ │ │ ├── LRUMap.java │ │ │ │ │ │ └── LinkedNode.java │ │ │ │ │ ├── ser │ │ │ │ │ │ ├── package-info.java │ │ │ │ │ │ ├── impl │ │ │ │ │ │ │ └── package-info.java │ │ │ │ │ │ ├── ArraySerializers.java │ │ │ │ │ │ ├── JdkSerializers.java │ │ │ │ │ │ ├── ContainerSerializers.java │ │ │ │ │ │ ├── StdKeySerializer.java │ │ │ │ │ │ ├── ToStringSerializer.java │ │ │ │ │ │ ├── EnumSerializer.java │ │ │ │ │ │ ├── ScalarSerializerBase.java │ │ │ │ │ │ ├── SerializerBase.java │ │ │ │ │ │ ├── FilterProvider.java │ │ │ │ │ │ ├── std │ │ │ │ │ │ │ ├── StringSerializer.java │ │ │ │ │ │ │ ├── NullSerializer.java │ │ │ │ │ │ │ ├── NonTypedScalarSerializerBase.java │ │ │ │ │ │ │ └── TimeZoneSerializer.java │ │ │ │ │ │ └── BeanPropertyFilter.java │ │ │ │ │ ├── deser │ │ │ │ │ │ ├── package-info.java │ │ │ │ │ │ ├── DateDeserializer.java │ │ │ │ │ │ ├── UntypedObjectDeserializer.java │ │ │ │ │ │ ├── StdKeyDeserializers.java │ │ │ │ │ │ ├── ArrayDeserializers.java │ │ │ │ │ │ ├── StdKeyDeserializer.java │ │ │ │ │ │ ├── StdScalarDeserializer.java │ │ │ │ │ │ ├── FromStringDeserializer.java │ │ │ │ │ │ ├── ThrowableDeserializer.java │ │ │ │ │ │ ├── ContainerDeserializer.java │ │ │ │ │ │ ├── EnumDeserializer.java │ │ │ │ │ │ ├── impl │ │ │ │ │ │ │ └── package-info.java │ │ │ │ │ │ ├── EnumResolver.java │ │ │ │ │ │ ├── std │ │ │ │ │ │ │ ├── package-info.java │ │ │ │ │ │ │ ├── AtomicBooleanDeserializer.java │ │ │ │ │ │ │ ├── DateDeserializer.java │ │ │ │ │ │ │ ├── TimestampDeserializer.java │ │ │ │ │ │ │ ├── StdScalarDeserializer.java │ │ │ │ │ │ │ ├── ContainerDeserializerBase.java │ │ │ │ │ │ │ ├── TokenBufferDeserializer.java │ │ │ │ │ │ │ └── JavaTypeDeserializer.java │ │ │ │ │ │ └── ArrayDeserializer.java │ │ │ │ │ ├── annotate │ │ │ │ │ │ ├── package-info.java │ │ │ │ │ │ ├── NoClass.java │ │ │ │ │ │ ├── JsonValueInstantiator.java │ │ │ │ │ │ ├── JacksonStdImpl.java │ │ │ │ │ │ ├── JsonRootName.java │ │ │ │ │ │ ├── JsonCachable.java │ │ │ │ │ │ ├── JacksonInject.java │ │ │ │ │ │ ├── JsonFilter.java │ │ │ │ │ │ ├── JsonTypeResolver.java │ │ │ │ │ │ ├── JsonTypeIdResolver.java │ │ │ │ │ │ └── JsonView.java │ │ │ │ │ ├── introspect │ │ │ │ │ │ ├── MethodFilter.java │ │ │ │ │ │ └── package-info.java │ │ │ │ │ ├── jsontype │ │ │ │ │ │ ├── impl │ │ │ │ │ │ │ ├── package-info.java │ │ │ │ │ │ │ ├── TypeSerializerBase.java │ │ │ │ │ │ │ └── TypeIdResolverBase.java │ │ │ │ │ │ └── package-info.java │ │ │ │ │ ├── type │ │ │ │ │ │ └── package-info.java │ │ │ │ │ ├── RuntimeJsonMappingException.java │ │ │ │ │ ├── JsonSerializableWithType.java │ │ │ │ │ ├── module │ │ │ │ │ │ └── package-info.java │ │ │ │ │ ├── ext │ │ │ │ │ │ └── package-info.java │ │ │ │ │ ├── KeyDeserializers.java │ │ │ │ │ ├── ResolvableSerializer.java │ │ │ │ │ ├── ResolvableDeserializer.java │ │ │ │ │ ├── KeyDeserializer.java │ │ │ │ │ ├── JsonSerializable.java │ │ │ │ │ └── package-info.java │ │ │ │ │ ├── util │ │ │ │ │ └── package-info.java │ │ │ │ │ ├── io │ │ │ │ │ └── package.html │ │ │ │ │ ├── sym │ │ │ │ │ ├── package-info.java │ │ │ │ │ ├── Name3.java │ │ │ │ │ ├── Name2.java │ │ │ │ │ ├── Name1.java │ │ │ │ │ └── Name.java │ │ │ │ │ ├── schema │ │ │ │ │ ├── package-info.java │ │ │ │ │ └── SchemaAware.java │ │ │ │ │ ├── impl │ │ │ │ │ ├── package-info.java │ │ │ │ │ ├── DefaultPrettyPrinter.java │ │ │ │ │ ├── JsonNumericParserBase.java │ │ │ │ │ └── Indenter.java │ │ │ │ │ ├── format │ │ │ │ │ └── package-info.java │ │ │ │ │ ├── node │ │ │ │ │ ├── package-info.java │ │ │ │ │ └── NullNode.java │ │ │ │ │ ├── type │ │ │ │ │ └── package-info.java │ │ │ │ │ ├── annotate │ │ │ │ │ ├── JsonCreator.java │ │ │ │ │ ├── JacksonAnnotation.java │ │ │ │ │ ├── package-info.java │ │ │ │ │ ├── JsonAnySetter.java │ │ │ │ │ ├── JsonTypeName.java │ │ │ │ │ ├── JsonAnyGetter.java │ │ │ │ │ ├── JsonIgnoreType.java │ │ │ │ │ ├── JsonWriteNullProperties.java │ │ │ │ │ ├── JsonGetter.java │ │ │ │ │ ├── JsonSetter.java │ │ │ │ │ ├── JsonRawValue.java │ │ │ │ │ └── JsonProperty.java │ │ │ │ │ ├── JsonParseException.java │ │ │ │ │ ├── JsonGenerationException.java │ │ │ │ │ ├── Versioned.java │ │ │ │ │ ├── package-info.java │ │ │ │ │ └── FormatSchema.java │ │ │ └── apache │ │ │ │ └── http │ │ │ │ └── entity │ │ │ │ └── mime │ │ │ │ └── version.properties │ │ │ └── instrumentationbackend │ │ │ ├── actions │ │ │ ├── device │ │ │ │ ├── ScrollDirection.java │ │ │ │ ├── Strategies.java │ │ │ │ ├── PullNotification.java │ │ │ │ ├── Actions.java │ │ │ │ ├── UiautomatorTouchText.java │ │ │ │ ├── UiautomatorDragCoordinates.java │ │ │ │ ├── UiautomatorTouchPartialText.java │ │ │ │ ├── WaitForIdleSync.java │ │ │ │ ├── UiautomatorTextDump.java │ │ │ │ └── DpToDevicePixel.java │ │ │ ├── Action.java │ │ │ ├── view │ │ │ │ ├── IOnViewAction.java │ │ │ │ ├── GetActivityName.java │ │ │ │ ├── ExecuteOnView.java │ │ │ │ └── IsCurrentActivityFocused.java │ │ │ ├── NullAction.java │ │ │ ├── version │ │ │ │ ├── AndroidSDKVersion.java │ │ │ │ └── Version.java │ │ │ ├── webview │ │ │ │ ├── GetLoadProgress.java │ │ │ │ ├── UnableToFindChromeClientException.java │ │ │ │ └── GetUrl.java │ │ │ ├── gestures │ │ │ │ ├── DoubleTapCoordinate.java │ │ │ │ ├── TouchCoordinates.java │ │ │ │ ├── DragCoordinates.java │ │ │ │ ├── ClickOnScreen.java │ │ │ │ ├── Swipe.java │ │ │ │ ├── Drag.java │ │ │ │ ├── ResumeApplication.java │ │ │ │ ├── LongPressCoordinate.java │ │ │ │ └── DragLeaveKeyboard.java │ │ │ ├── helpers │ │ │ │ └── ListActions.java │ │ │ ├── softkey │ │ │ │ └── KeyUtil.java │ │ │ ├── Utils.java │ │ │ ├── preferences │ │ │ │ ├── ClearPreferences.java │ │ │ │ └── GetPreferences.java │ │ │ ├── l10n │ │ │ │ └── L10nHelper.java │ │ │ ├── text │ │ │ │ └── HideSoftKeyboard.java │ │ │ └── activity │ │ │ │ └── GetActivityOrientation.java │ │ │ ├── TestServerLifeCycle.java │ │ │ ├── query │ │ │ ├── Operation.java │ │ │ ├── ast │ │ │ │ ├── UIQueryASTPredicateRelation.java │ │ │ │ ├── InvalidUIQueryException.java │ │ │ │ ├── optimization │ │ │ │ │ ├── QueryOptimizer.java │ │ │ │ │ ├── GeneralUIQueryOptimizer.java │ │ │ │ │ └── UIQueryASTClassNameCache.java │ │ │ │ ├── UIQueryAST.java │ │ │ │ ├── evaluation │ │ │ │ │ ├── QueryEvaluationStep.java │ │ │ │ │ ├── QueryEvaluator.java │ │ │ │ │ └── UIQueryEvaluationRules.java │ │ │ │ ├── UIQueryDirection.java │ │ │ │ ├── UIQueryVisibility.java │ │ │ │ ├── ContainsRelation.java │ │ │ │ ├── EndsWithRelation.java │ │ │ │ ├── BeginsWithRelation.java │ │ │ │ ├── UIQueryMatcher.java │ │ │ │ └── UIQueryVisibilityMatcher.java │ │ │ ├── UIQuery.tokens │ │ │ ├── ui │ │ │ │ ├── UIObject.java │ │ │ │ ├── InvalidUIObjectException.java │ │ │ │ └── UIObjectView.java │ │ │ ├── QueryResult.java │ │ │ ├── UIQueryResultVoid.java │ │ │ └── CompletedFuture.java │ │ │ ├── CalabashInstrumentationTestRunner.java │ │ │ ├── ApplicationLifeCycle.java │ │ │ ├── entrypoint │ │ │ ├── EntryPoint.java │ │ │ ├── UnableToLoadCalabashException.java │ │ │ └── ApplicationUnderTestInstrumentation.java │ │ │ ├── automation │ │ │ ├── ApplicationUnderTest.java │ │ │ ├── CalabashAutomation.java │ │ │ └── CalabashAutomationEmbedded.java │ │ │ ├── InstrumentationStatus.java │ │ │ ├── StatusReporterActivityClear.java │ │ │ ├── TestHelpers.java │ │ │ ├── Main.java │ │ │ ├── utils │ │ │ ├── StringUtils.java │ │ │ ├── SlidingMap.java │ │ │ ├── SystemPropertiesWrapper.java │ │ │ └── CompletableFuture.java │ │ │ ├── Logger.java │ │ │ ├── json │ │ │ ├── UriSerializer.java │ │ │ ├── CustomAndroidModule.java │ │ │ ├── ComponentNameSerializer.java │ │ │ ├── ComponentNameDeserializer.java │ │ │ └── JSONUtils.java │ │ │ ├── WakeUp.java │ │ │ ├── ClearAppData2.java │ │ │ ├── ClearAppData3.java │ │ │ ├── ClearPreferences.java │ │ │ ├── Command.java │ │ │ ├── GetPreferences.java │ │ │ └── InstrumentationReport.java │ │ └── com │ │ └── jayway │ │ └── android │ │ └── robotium │ │ └── solo │ │ └── SoloEnhanced.java ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── .gitignore ├── build.gradle └── gradle.properties ├── TestServer.apk ├── NOTICE ├── bin ├── ci │ └── ado │ │ ├── install-android-sdk.sh │ │ └── start-emulator.sh ├── git-tag.sh └── log.sh ├── LICENSE ├── .gitignore └── azure-pipelines.yml /.gitmodules: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /version: -------------------------------------------------------------------------------- 1 | 0.9.25 2 | -------------------------------------------------------------------------------- /server/integration-tests/libs/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /server/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /server/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | .project 3 | .classpath 4 | -------------------------------------------------------------------------------- /server/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /TestServer.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calabash/calabash-android-server/HEAD/TestServer.apk -------------------------------------------------------------------------------- /server/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | instrumentationbackend 3 | 4 | -------------------------------------------------------------------------------- /server/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calabash/calabash-android-server/HEAD/server/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /server/integration-tests/calabash-test-suite/Gemfile: -------------------------------------------------------------------------------- 1 | source "https://rubygems.org" 2 | 3 | gem "calabash-android", path: "../calabash-android" 4 | -------------------------------------------------------------------------------- /server/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /server/integration-tests/calabash-test-suite/features/support/env.rb: -------------------------------------------------------------------------------- 1 | require 'calabash-android/operations' 2 | 3 | World(Calabash::Android::Operations) 4 | -------------------------------------------------------------------------------- /server/integration-tests/libs/junit-4.12.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calabash/calabash-android-server/HEAD/server/integration-tests/libs/junit-4.12.jar -------------------------------------------------------------------------------- /server/integration-tests/calabash-test-suite/.calabash_settings: -------------------------------------------------------------------------------- 1 | {"keystore_location":"./test.keystore","keystore_password":"android","keystore_alias":"mykey"} 2 | -------------------------------------------------------------------------------- /server/integration-tests/resources/unit-tester.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calabash/calabash-android-server/HEAD/server/integration-tests/resources/unit-tester.apk -------------------------------------------------------------------------------- /server/integration-tests/libs/hamcrest-core-1.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calabash/calabash-android-server/HEAD/server/integration-tests/libs/hamcrest-core-1.3.jar -------------------------------------------------------------------------------- /server/integration-tests/calabash-test-suite/.irb-history: -------------------------------------------------------------------------------- 1 | start_test_server_in_background 2 | reinstall_apps 3 | start_test_server_in_background 4 | backdoor('startTest') 5 | -------------------------------------------------------------------------------- /server/integration-tests/calabash-test-suite/test.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/calabash/calabash-android-server/HEAD/server/integration-tests/calabash-test-suite/test.keystore -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/util/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Utility classes for Mapper package. 3 | */ 4 | package sh.calaba.org.codehaus.jackson.map.util; 5 | -------------------------------------------------------------------------------- /server/integration-tests/.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | test.iml 3 | 4 | calabash-test-suite/test-report 5 | libs/build/* 6 | libs/junit-4.12.jar 7 | libs/hamcrest-core-1.3.jar 8 | out/ 9 | !resources/* 10 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/util/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Utility classes used by Jackson Core functionality. 3 | */ 4 | package sh.calaba.org.codehaus.jackson.util; 5 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/io/package.html: -------------------------------------------------------------------------------- 1 | 2 | This package contains I/O helper classes Jackson itself uses, but that 3 | are not exposed for external reuse. 4 | 5 | -------------------------------------------------------------------------------- /server/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/libraries 5 | /.idea/modules.xml 6 | /.idea/workspace.xml 7 | .DS_Store 8 | /build 9 | /captures 10 | .externalNativeBuild 11 | .settings 12 | .project 13 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/actions/device/ScrollDirection.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.actions.device; 2 | 3 | public enum ScrollDirection { 4 | FORWARD, 5 | BACKWARD 6 | } 7 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/ser/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Contains implementation classes of serialization part of 3 | * data binding. 4 | */ 5 | package sh.calaba.org.codehaus.jackson.map.ser; 6 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/TestServerLifeCycle.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend; 2 | 3 | public interface TestServerLifeCycle { 4 | public void start(); 5 | public void stop(); 6 | } 7 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/deser/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Contains implementation classes of deserialization part of 3 | * data binding. 4 | */ 5 | package sh.calaba.org.codehaus.jackson.map.deser; 6 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/ser/impl/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Contains implementation classes of serialization part of 3 | * data binding. 4 | */ 5 | package sh.calaba.org.codehaus.jackson.map.ser.impl; 6 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/sym/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Internal implementation classes for efficient handling of 3 | * of symbols in JSON (field names in Objects) 4 | */ 5 | package sh.calaba.org.codehaus.jackson.sym; 6 | -------------------------------------------------------------------------------- /server/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/query/Operation.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.query; 2 | 3 | public interface Operation { 4 | 5 | public Object apply(Object o) throws Exception; 6 | public String getName(); 7 | } 8 | -------------------------------------------------------------------------------- /server/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/schema/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Classes needed for JSON schema support (currently just ability 3 | * to generate schemas using serialization part of data mapping) 4 | */ 5 | package sh.calaba.org.codehaus.jackson.schema; 6 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/query/ast/UIQueryASTPredicateRelation.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.query.ast; 2 | 3 | public interface UIQueryASTPredicateRelation { 4 | public boolean areRelated(Object firstValue, Object secondValue); 5 | } 6 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/annotate/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Annotations that directly depend on Mapper classes (not just 3 | * Jackson core) and are used for configuring Data Mapping functionality. 4 | */ 5 | package sh.calaba.org.codehaus.jackson.map.annotate; 6 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/impl/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Parser and generator implementation classes that Jackson 3 | * defines and uses. 4 | * Application code should not (need to) use contents of this package. 5 | */ 6 | package sh.calaba.org.codehaus.jackson.impl; 7 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/actions/Action.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.actions; 2 | 3 | import sh.calaba.instrumentationbackend.Result; 4 | 5 | 6 | public interface Action { 7 | 8 | Result execute(String... args); 9 | 10 | String key(); 11 | } 12 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/util/Named.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map.util; 2 | 3 | /** 4 | * Simple tag interface mostly to allow sorting by name 5 | * 6 | * @since 1.9 7 | */ 8 | public interface Named { 9 | public String getName(); 10 | } 11 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/CalabashInstrumentationTestRunner.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend; 2 | 3 | /* Only here for backward compatibility. Test-starters might refer to this class */ 4 | public class CalabashInstrumentationTestRunner extends CalabashInstrumentation { 5 | } 6 | -------------------------------------------------------------------------------- /server/integration-tests/calabash-test-suite/features/unittest.feature: -------------------------------------------------------------------------------- 1 | Feature: Running the unit test 2 | Scenario: Running the unit test 3 | Then I install the app 4 | Then I start the app 5 | Then I wait for the unit test result 6 | Then I print it to stdout 7 | Then I fail if the unit test did not succeed -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/ApplicationLifeCycle.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend; 2 | 3 | import android.app.Activity; 4 | import android.content.Intent; 5 | 6 | public interface ApplicationLifeCycle { 7 | public Activity start(Intent startIntent); 8 | public void stop(); 9 | } 10 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/entrypoint/EntryPoint.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.entrypoint; 2 | 3 | import sh.calaba.instrumentationbackend.automation.CalabashAutomation; 4 | 5 | public interface EntryPoint { 6 | public void start(); 7 | public CalabashAutomation getCalabashAutomation(); 8 | } 9 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/format/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Package that contains interfaces needed for dynamic, pluggable 3 | * format (auto)detection; as well as basic utility classes for 4 | * simple format detection functionality. 5 | * 6 | * @since 1.8 7 | */ 8 | package sh.calaba.org.codehaus.jackson.format; 9 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/query/ast/InvalidUIQueryException.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.query.ast; 2 | 3 | @SuppressWarnings("serial") 4 | public class InvalidUIQueryException extends RuntimeException { 5 | 6 | public InvalidUIQueryException(String query) { 7 | super(query); 8 | } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/automation/ApplicationUnderTest.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.automation; 2 | 3 | import android.app.Activity; 4 | import android.app.Application; 5 | 6 | public interface ApplicationUnderTest { 7 | public Application getApplication(); 8 | public Activity getCurrentActivity(); 9 | } 10 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/ser/ArraySerializers.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map.ser; 2 | 3 | /** 4 | * @deprecated Since 1.9 use {@link sh.calaba.org.codehaus.jackson.map.ser.std.StdArraySerializers} 5 | */ 6 | @Deprecated 7 | public class ArraySerializers extends sh.calaba.org.codehaus.jackson.map.ser.std.StdArraySerializers { } 8 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/query/ast/optimization/QueryOptimizer.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.query.ast.optimization; 2 | 3 | import java.util.List; 4 | 5 | import sh.calaba.instrumentationbackend.query.ast.UIQueryAST; 6 | 7 | public interface QueryOptimizer { 8 | List optimize(List queryPath); 9 | } 10 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/query/UIQuery.tokens: -------------------------------------------------------------------------------- 1 | ALL=4 2 | BEGINPRED=5 3 | BOOL=6 4 | DIRECTION=7 5 | DOUBLE_ESC_SEQ=8 6 | ENDPRED=9 7 | ESC_SEQ=10 8 | FILTER_COLON=11 9 | HEX_DIGIT=12 10 | INT=13 11 | NAME=14 12 | NIL=15 13 | OCTAL_ESC=16 14 | QUALIFIED_NAME=17 15 | RELATION=18 16 | STRING=19 17 | UNICODE_ESC=20 18 | VISIBLE=21 19 | WHITE=22 20 | WILDCARD=23 21 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/introspect/MethodFilter.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map.introspect; 2 | 3 | import java.lang.reflect.Method; 4 | 5 | /** 6 | * Simple interface that defines API used to filter out irrelevant 7 | * methods 8 | */ 9 | public interface MethodFilter 10 | { 11 | public boolean includeMethod(Method m); 12 | } 13 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/actions/device/Strategies.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.actions.device; 2 | 3 | public enum Strategies { 4 | clazz, 5 | res, 6 | desc, 7 | descContains, 8 | descEndsWith, 9 | descStartWith, 10 | text, 11 | textContains, 12 | textEndsWith, 13 | textStartWith, 14 | pkg; 15 | } 16 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/query/ui/UIObject.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.query.ui; 2 | 3 | import java.util.concurrent.Callable; 4 | import java.util.concurrent.Future; 5 | 6 | public interface UIObject { 7 | public Object getObject(); 8 | public Future evaluateAsyncInMainThread(final Callable callable) throws Exception; 9 | } 10 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/ser/JdkSerializers.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map.ser; 2 | 3 | /** 4 | * @deprecated Since 1.9 use {@link sh.calaba.org.codehaus.jackson.map.ser.std.StdJdkSerializers} 5 | */ 6 | @Deprecated 7 | public class JdkSerializers 8 | extends sh.calaba.org.codehaus.jackson.map.ser.std.StdJdkSerializers 9 | { 10 | 11 | } 12 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/ser/ContainerSerializers.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map.ser; 2 | 3 | /** 4 | * @deprecated Since 1.9 use {@link sh.calaba.org.codehaus.jackson.map.ser.std.StdContainerSerializers} instead 5 | */ 6 | @Deprecated 7 | public class ContainerSerializers 8 | extends sh.calaba.org.codehaus.jackson.map.ser.std.StdContainerSerializers { } 9 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/deser/DateDeserializer.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map.deser; 2 | 3 | /** 4 | * @deprecated Since 1.9, use {@link sh.calaba.org.codehaus.jackson.map.deser.std.JsonNodeDeserializer} instead. 5 | */ 6 | @Deprecated 7 | public class DateDeserializer 8 | extends sh.calaba.org.codehaus.jackson.map.deser.std.DateDeserializer 9 | { } 10 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/jsontype/impl/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Package that contains standard implementations for 3 | * {@link sh.calaba.org.codehaus.jackson.map.jsontype.TypeResolverBuilder} 4 | * and 5 | * {@link sh.calaba.org.codehaus.jackson.map.jsontype.TypeIdResolver}. 6 | * 7 | * @since 1.5 8 | */ 9 | package sh.calaba.org.codehaus.jackson.map.jsontype.impl; 10 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | This project, Calabash Android, is licensed under the Eclipse Public License. 2 | See: epl-v10.html for more information. 3 | 4 | The project contains source code from other open source 5 | or public domain projects. 6 | 7 | ---- 8 | The Android Open Source Project: https://android.googlesource.com/?format=HTML 9 | Licensed under the Apache 2.0 License 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | (See Apache2.txt) 12 | ---- 13 | -------------------------------------------------------------------------------- /bin/ci/ado/install-android-sdk.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ANDROID_SDK_VERSION=29 3 | pushd "${ANDROID_HOME}/tools" > /dev/null 4 | bin/sdkmanager --version 5 | echo "y" | bin/sdkmanager --update 6 | 7 | echo "y" | \ 8 | bin/sdkmanager --install tools platform-tools emulator 'platforms;android-'$ANDROID_SDK_VERSION \ 9 | 'build-tools;28.0.3' 'system-images;android-'$ANDROID_SDK_VERSION';google_apis;x86' 10 | popd > /dev/null 11 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/InstrumentationStatus.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend; 2 | 3 | import android.app.Activity; 4 | 5 | public enum InstrumentationStatus { 6 | SUCCESSFUL(Activity.RESULT_OK), 7 | FAILED(Activity.RESULT_CANCELED); 8 | 9 | final int resultCode; 10 | 11 | InstrumentationStatus(int resultCode) { 12 | this.resultCode = resultCode; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/query/ast/UIQueryAST.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.query.ast; 2 | 3 | import java.util.List; 4 | 5 | import sh.calaba.instrumentationbackend.query.ui.UIObject; 6 | 7 | public interface UIQueryAST { 8 | public List evaluateWithViews(List inputUIObjects, 9 | UIQueryDirection direction, UIQueryVisibility visibility); 10 | } 11 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/deser/UntypedObjectDeserializer.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map.deser; 2 | 3 | /** 4 | * @deprecated Since 1.9, use {@link sh.calaba.org.codehaus.jackson.map.deser.std.UntypedObjectDeserializer} instead. 5 | */ 6 | @Deprecated 7 | public class UntypedObjectDeserializer 8 | extends sh.calaba.org.codehaus.jackson.map.deser.std.UntypedObjectDeserializer 9 | { } 10 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/node/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Contains concrete {@link sh.calaba.org.codehaus.jackson.JsonNode} implementations 3 | * Jackson uses for the Tree model. 4 | * These classes are public since concrete type will be needed 5 | * for most operations that modify node trees. For read-only access concrete 6 | * types are usually not needed. 7 | */ 8 | package sh.calaba.org.codehaus.jackson.node; 9 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/actions/view/IOnViewAction.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.actions.view; 2 | 3 | import sh.calaba.instrumentationbackend.query.ast.UIQueryMatcher; 4 | import sh.calaba.instrumentationbackend.query.ui.UIObject; 5 | 6 | /** 7 | * Created by john7doe on 06/01/15. 8 | */ 9 | public interface IOnViewAction { 10 | UIQueryMatcher getUIQueryMatcher(UIObject uiObject); 11 | } 12 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/query/ast/evaluation/QueryEvaluationStep.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.query.ast.evaluation; 2 | 3 | import java.util.List; 4 | 5 | import sh.calaba.instrumentationbackend.query.ast.*; 6 | 7 | public interface QueryEvaluationStep { 8 | List step(UIQueryDirection direction); 9 | List step(UIQueryVisibility visibility); 10 | List step(UIQueryAST step); 11 | } 12 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/ser/StdKeySerializer.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map.ser; 2 | /** 3 | * @deprecated Since 1.9 use {@link org.codehaus.jackson.map.ser.std.StdKeySerializer} instead 4 | */ 5 | @Deprecated 6 | public final class StdKeySerializer 7 | extends sh.calaba.org.codehaus.jackson.map.ser.std.StdKeySerializer 8 | { 9 | final static StdKeySerializer instace = new StdKeySerializer(); 10 | } -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/deser/StdKeyDeserializers.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map.deser; 2 | 3 | /** 4 | * @deprecated Since 1.9, use {@link sh.calaba.org.codehaus.jackson.map.deser.std.StdKeyDeserializers} instead. 5 | */ 6 | @Deprecated 7 | class StdKeyDeserializers 8 | extends sh.calaba.org.codehaus.jackson.map.deser.std.StdKeyDeserializers 9 | { 10 | protected StdKeyDeserializers() { super(); } 11 | } 12 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Calabash-android Copyright (2012) LessPainful ApS. All rights reserved. 2 | The use and distribution terms for this software are covered by the 3 | Eclipse Public License 1.0 4 | (http://opensource.org/licenses/eclipse-1.0.php) which can be found in 5 | the file epl-v10.html at the root of this distribution. By using this 6 | software in any fashion, you are agreeing to be bound by the terms of 7 | this license. You must not remove this notice, or any other, from 8 | this software. -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/impl/DefaultPrettyPrinter.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.impl; 2 | 3 | /** 4 | * Deprecated version of the default pretty printer. 5 | * 6 | * @deprecated Moved to {@link sh.calaba.org.codehaus.jackson.util.DefaultPrettyPrinter}; will be removed in Jackson 2.0 7 | */ 8 | @Deprecated 9 | public class DefaultPrettyPrinter 10 | extends sh.calaba.org.codehaus.jackson.util.DefaultPrettyPrinter 11 | { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/deser/ArrayDeserializers.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map.deser; 2 | 3 | /** 4 | * @deprecated Since 1.9, use {@link sh.calaba.org.codehaus.jackson.map.deser.std.PrimitiveArrayDeserializers} instead. 5 | */ 6 | @Deprecated 7 | public class ArrayDeserializers 8 | extends sh.calaba.org.codehaus.jackson.map.deser.std.PrimitiveArrayDeserializers 9 | { 10 | private ArrayDeserializers() { super(); } 11 | } 12 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/StatusReporterActivityClear.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | 6 | public class StatusReporterActivityClear extends Activity { 7 | @Override 8 | public void onCreate(Bundle savedInstanceState) { 9 | super.onCreate(savedInstanceState); 10 | 11 | new StatusReporter(this).clear(); 12 | 13 | finish(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/deser/StdKeyDeserializer.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map.deser; 2 | 3 | /** 4 | * @deprecated Since 1.9, use {@link sh.calaba.org.codehaus.jackson.map.deser.std.StdKeyDeserializer} instead. 5 | */ 6 | @Deprecated 7 | public abstract class StdKeyDeserializer 8 | extends sh.calaba.org.codehaus.jackson.map.deser.std.StdKeyDeserializer 9 | { 10 | protected StdKeyDeserializer(Class cls) { super(cls); } 11 | } 12 | 13 | -------------------------------------------------------------------------------- /bin/git-tag.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | source bin/log.sh 6 | 7 | BRANCH=$(git rev-parse --symbolic-full-name --abbrev-ref HEAD | tr -d "\n") 8 | 9 | if [ "${BRANCH}" != "master" ]; then 10 | error "Only create tags from the master branch" 11 | error "The current branch is: ${BRANCH}" 12 | exit 1 13 | fi 14 | 15 | TAG=$(cat version | tr -d "\n") 16 | 17 | git tag -a "${TAG}" -m"${TAG}" 18 | git push origin "${TAG}" 19 | git branch "tag/${TAG}" "${TAG}" 20 | git checkout "tag/${TAG}" 21 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/type/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Contains classes needed for type introspection, mostly used by data binding 3 | * functionality. Most of this functionality is needed to properly handled 4 | * generic types, and to simplify and unify processing of things Jackson needs 5 | * to determine how contained types (of {@link java.util.Collection} and 6 | * {@link java.util.Map} classes) are to be handled. 7 | */ 8 | package sh.calaba.org.codehaus.jackson.type; 9 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/TestHelpers.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend; 2 | 3 | public class TestHelpers { 4 | public static void wait(int durationInSeconds) { 5 | wait(new Double(durationInSeconds)); 6 | } 7 | 8 | 9 | public static void wait(double durationInSeconds) { 10 | try { 11 | Thread.sleep((int)(durationInSeconds * 1000)); 12 | } catch (InterruptedException e) { 13 | throw new RuntimeException(e); 14 | } 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/jsontype/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Package that contains interfaces that define how to implement 3 | * functionality for dynamically resolving type during deserialization. 4 | * This is needed for complete handling of polymorphic types, where 5 | * actual type can not be determined statically (declared type is 6 | * a supertype of actual polymorphic serialized types). 7 | * 8 | * @since 1.5 9 | */ 10 | package sh.calaba.org.codehaus.jackson.map.jsontype; 11 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/automation/CalabashAutomation.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.automation; 2 | 3 | import android.app.Activity; 4 | import android.app.Application; 5 | import sh.calaba.instrumentationbackend.query.ui.UIObject; 6 | 7 | import java.util.Collection; 8 | 9 | public interface CalabashAutomation { 10 | public Activity getCurrentActivity(); 11 | public Application getCurrentApplication(); 12 | public Collection getRootViews(); 13 | } 14 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/deser/StdScalarDeserializer.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map.deser; 2 | 3 | /** 4 | * @deprecated Since 1.9, use {@link sh.calaba.org.codehaus.jackson.map.deser.std.StdScalarDeserializer} instead. 5 | */ 6 | @Deprecated 7 | public abstract class StdScalarDeserializer 8 | extends sh.calaba.org.codehaus.jackson.map.deser.std.StdDeserializer 9 | { 10 | protected StdScalarDeserializer(Class vc) { 11 | super(vc); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/deser/FromStringDeserializer.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map.deser; 2 | 3 | /** 4 | * @deprecated Since 1.9, use {@link sh.calaba.org.codehaus.jackson.map.deser.std.FromStringDeserializer} instead. 5 | */ 6 | @Deprecated 7 | public abstract class FromStringDeserializer 8 | extends sh.calaba.org.codehaus.jackson.map.deser.std.FromStringDeserializer 9 | { 10 | protected FromStringDeserializer(Class vc) { 11 | super(vc); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/Main.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend; 2 | 3 | import sh.calaba.instrumentationbackend.automation.CalabashAutomationEmbedded; 4 | import sh.calaba.instrumentationbackend.entrypoint.EntryPoint; 5 | 6 | public class Main { 7 | public static void start(EntryPoint entryPoint) { 8 | CalabashInstrumentation.dontRun = true; 9 | InstrumentationBackend.setDefaultCalabashAutomation(entryPoint.getCalabashAutomation()); 10 | entryPoint.start(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/deser/ThrowableDeserializer.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map.deser; 2 | 3 | /** 4 | * @deprecated Since 1.9, use {@link sh.calaba.org.codehaus.jackson.map.deser.std.ThrowableDeserializer} instead. 5 | */ 6 | @Deprecated 7 | public class ThrowableDeserializer 8 | extends sh.calaba.org.codehaus.jackson.map.deser.std.ThrowableDeserializer 9 | { 10 | public ThrowableDeserializer(BeanDeserializer baseDeserializer) { 11 | super(baseDeserializer); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/deser/ContainerDeserializer.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map.deser; 2 | 3 | /** 4 | * @deprecated Since 1.9, use {@link sh.calaba.org.codehaus.jackson.map.deser.std.ContainerDeserializerBase} instead. 5 | */ 6 | @Deprecated 7 | public abstract class ContainerDeserializer 8 | extends sh.calaba.org.codehaus.jackson.map.deser.std.ContainerDeserializerBase 9 | { 10 | protected ContainerDeserializer(Class selfType) 11 | { 12 | super(selfType); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/deser/EnumDeserializer.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map.deser; 2 | 3 | import sh.calaba.org.codehaus.jackson.map.util.EnumResolver; 4 | 5 | /** 6 | * @deprecated Since 1.9, use {@link sh.calaba.org.codehaus.jackson.map.deser.std.EnumDeserializer} instead. 7 | */ 8 | @Deprecated 9 | public class EnumDeserializer 10 | extends sh.calaba.org.codehaus.jackson.map.deser.std.EnumDeserializer 11 | { 12 | public EnumDeserializer(EnumResolver res) { 13 | super(res); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/deser/impl/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Contains those implementation classes of deserialization part of 3 | * data binding that are not considered part of public or semi-public 4 | * interfaces. Use of these classes by non-core classes is discouraged, 5 | * although occasionally this may be necessary. 6 | * Note that backwards-compatibility of these classes is not guaranteed 7 | * between minor releases (but is between patch releases). 8 | */ 9 | package sh.calaba.org.codehaus.jackson.map.deser.impl; 10 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/utils/StringUtils.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.utils; 2 | 3 | import java.io.PrintWriter; 4 | import java.io.StringWriter; 5 | 6 | public final class StringUtils { 7 | 8 | private StringUtils() {} 9 | 10 | public static String toString(Throwable th) { 11 | StringWriter stringWriter = new StringWriter(); 12 | stringWriter.write("Unknown error:\n"); 13 | th.printStackTrace(new PrintWriter(stringWriter)); 14 | 15 | return stringWriter.toString(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/ser/ToStringSerializer.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map.ser; 2 | 3 | import sh.calaba.org.codehaus.jackson.map.annotate.JacksonStdImpl; 4 | 5 | /** 6 | * @deprecated Since 1.9 use {@link sh.calaba.org.codehaus.jackson.map.ser.std.ToStringSerializer} 7 | */ 8 | @Deprecated 9 | @JacksonStdImpl 10 | public final class ToStringSerializer 11 | extends sh.calaba.org.codehaus.jackson.map.ser.std.ToStringSerializer 12 | { 13 | public final static ToStringSerializer instance = new ToStringSerializer(); 14 | } 15 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/query/ast/UIQueryDirection.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.query.ast; 2 | 3 | import java.util.List; 4 | 5 | public enum UIQueryDirection implements UIQueryAST { 6 | DESCENDANT, CHILD, PARENT, SIBLING; 7 | 8 | @SuppressWarnings("rawtypes") 9 | @Override 10 | public List evaluateWithViews(List inputViews, UIQueryDirection direction, 11 | UIQueryVisibility visibility) { 12 | //Never called. Not so pretty, I know. 13 | throw new UnsupportedOperationException("This method should never be called"); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/deser/EnumResolver.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map.deser; 2 | 3 | import java.util.HashMap; 4 | 5 | /** 6 | * @deprecated Since 1.9, use {@link sh.calaba.org.codehaus.jackson.map.util.EnumResolver} instead. 7 | */ 8 | @Deprecated 9 | public final class EnumResolver> 10 | extends sh.calaba.org.codehaus.jackson.map.util.EnumResolver 11 | { 12 | private EnumResolver(Class enumClass, T[] enums, HashMap map) { 13 | super(enumClass, enums, map); 14 | } 15 | } 16 | 17 | 18 | -------------------------------------------------------------------------------- /server/integration-tests/01-compile-calabash.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | source ./log.sh 5 | 6 | banner "Creating and Installing Calabash.jar" 7 | 8 | rm -rf "libs/build" 9 | mkdir -p "libs/build" 10 | 11 | SERVER_DIR="../app/build/intermediates/javac/debugAndroidTest/compileDebugAndroidTestJavaWithJavac/classes" 12 | info "Creating Calabash.jar from *.class files" 13 | pushd "${SERVER_DIR}" > /dev/null 14 | find . -name "*.class" | jar cf Calabash.jar @/dev/stdin 15 | popd > /dev/null 16 | 17 | mv "${SERVER_DIR}/Calabash.jar" "libs/build" 18 | info "Installed libs/build/Calabash.jar" 19 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/query/QueryResult.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.query; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Collection; 5 | import java.util.List; 6 | 7 | public class QueryResult { 8 | private final List result; 9 | 10 | public QueryResult(Collection input) { 11 | result = new ArrayList(input); 12 | } 13 | 14 | public List asMappedList() { 15 | return ViewMapper.mapList(result); 16 | } 17 | 18 | public List asList() { 19 | return result; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/type/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Package that contains concrete implementations of 3 | * {@link sh.calaba.org.codehaus.jackson.type.JavaType}, as 4 | * well as the factory ({@link sh.calaba.org.codehaus.jackson.map.type.TypeFactory}) for 5 | * constructing instances from various input data types 6 | * (like {@link java.lang.Class}, {@link java.lang.reflect.Type}) 7 | * and programmatically (for structured types, arrays, 8 | * {@link java.util.List}s and {@link java.util.Map}s). 9 | */ 10 | package sh.calaba.org.codehaus.jackson.map.type; 11 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/ser/EnumSerializer.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map.ser; 2 | 3 | import sh.calaba.org.codehaus.jackson.map.annotate.JacksonStdImpl; 4 | import sh.calaba.org.codehaus.jackson.map.util.EnumValues; 5 | 6 | /** 7 | * @deprecated Since 1.9 use {@link sh.calaba.org.codehaus.jackson.map.ser.std.EnumSerializer} 8 | */ 9 | @Deprecated 10 | @JacksonStdImpl 11 | public class EnumSerializer 12 | extends sh.calaba.org.codehaus.jackson.map.ser.std.EnumSerializer 13 | { 14 | public EnumSerializer(EnumValues v) { 15 | super(v); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/actions/NullAction.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.actions; 2 | 3 | import sh.calaba.instrumentationbackend.Result; 4 | 5 | 6 | public class NullAction implements Action { 7 | 8 | private String missingKey; 9 | 10 | @Override 11 | public Result execute(String... args) { 12 | return new Result(false, "Could not find implementation for: '" + missingKey + "'"); 13 | } 14 | 15 | @Override 16 | public String key() { 17 | return "nullAction"; 18 | } 19 | 20 | public void setMissingKey(String key) { 21 | this.missingKey = key; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/util/Provider.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map.util; 2 | 3 | import java.util.*; 4 | 5 | /** 6 | * Simple helper class used for decoupling instantiation of 7 | * optionally loaded handlers, like deserializers and deserializers 8 | * for libraries that are only present on some platforms. 9 | * 10 | * @author tatu 11 | * 12 | * @param Type of objects provided 13 | */ 14 | public interface Provider 15 | { 16 | /** 17 | * Method used to request provider to provide entries it has 18 | */ 19 | public Collection provide(); 20 | } 21 | 22 | -------------------------------------------------------------------------------- /server/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | 5 | repositories { 6 | google() 7 | jcenter() 8 | } 9 | dependencies { 10 | classpath 'com.android.tools.build:gradle:8.2.2' 11 | 12 | // NOTE: Do not place your application dependencies here; they belong 13 | // in the individual module build.gradle files 14 | } 15 | } 16 | 17 | allprojects { 18 | repositories { 19 | google() 20 | jcenter() 21 | } 22 | } 23 | 24 | task clean(type: Delete) { 25 | delete rootProject.buildDir 26 | } 27 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/ser/ScalarSerializerBase.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map.ser; 2 | 3 | /** 4 | * @deprecated Since 1.9 use {@link sh.calaba.org.codehaus.jackson.map.ser.std.SerializerBase} instead. 5 | */ 6 | @Deprecated 7 | public abstract class ScalarSerializerBase 8 | extends sh.calaba.org.codehaus.jackson.map.ser.std.SerializerBase 9 | { 10 | protected ScalarSerializerBase(Class t) { 11 | super(t); 12 | } 13 | 14 | @SuppressWarnings("unchecked") 15 | protected ScalarSerializerBase(Class t, boolean dummy) { 16 | super((Class) t); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/entrypoint/UnableToLoadCalabashException.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.entrypoint; 2 | 3 | public class UnableToLoadCalabashException extends Exception { 4 | public UnableToLoadCalabashException() { 5 | } 6 | 7 | public UnableToLoadCalabashException(String detailMessage) { 8 | super(detailMessage); 9 | } 10 | 11 | public UnableToLoadCalabashException(String detailMessage, Throwable throwable) { 12 | super(detailMessage, throwable); 13 | } 14 | 15 | public UnableToLoadCalabashException(Throwable throwable) { 16 | super(throwable); 17 | } 18 | } -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/query/ui/InvalidUIObjectException.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.query.ui; 2 | 3 | public class InvalidUIObjectException extends RuntimeException { 4 | public InvalidUIObjectException() { 5 | super(); 6 | } 7 | 8 | public InvalidUIObjectException(String detailMessage) { 9 | super(detailMessage); 10 | } 11 | 12 | public InvalidUIObjectException(String detailMessage, Throwable throwable) { 13 | super(detailMessage, throwable); 14 | } 15 | 16 | public InvalidUIObjectException(Throwable throwable) { 17 | super(throwable); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/actions/device/PullNotification.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.actions.device; 2 | 3 | import sh.calaba.instrumentationbackend.InstrumentationBackend; 4 | import sh.calaba.instrumentationbackend.Result; 5 | import sh.calaba.instrumentationbackend.actions.Action; 6 | 7 | public class PullNotification implements Action { 8 | @Override 9 | public Result execute(String... args) { 10 | InstrumentationBackend.getUiDevice().openNotification(); 11 | return new Result(true); 12 | } 13 | 14 | @Override 15 | public String key() { 16 | return "pull_notification"; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/actions/version/AndroidSDKVersion.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.actions.version; 2 | 3 | import sh.calaba.instrumentationbackend.Result; 4 | import sh.calaba.instrumentationbackend.actions.Action; 5 | import android.os.Build; 6 | 7 | 8 | public class AndroidSDKVersion implements Action { 9 | public static final int VERSION = Build.VERSION.SDK_INT; 10 | 11 | @Override 12 | public Result execute(String... args) { 13 | return new Result(true, Integer.toString(VERSION)); 14 | } 15 | 16 | @Override 17 | public String key() { 18 | return "android_sdk_version"; 19 | } 20 | 21 | } -------------------------------------------------------------------------------- /server/integration-tests/02-compile-tests.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | source log.sh 5 | 6 | banner "Building CalabashIntegrationTests.jar" 7 | 8 | rm -rf ./tmp 9 | mkdir -p ./tmp 10 | 11 | rm -rf ./out 12 | mkdir ./out 13 | 14 | info "Compiling from ./src" 15 | find ./src -name "*.java" | \ 16 | javac -cp \ 17 | "${ANDROID_PLATFORM}/android.jar:libs/build/Calabash.jar:libs/junit-4.12.jar" \ 18 | -d tmp @/dev/stdin 19 | 20 | pushd tmp > /dev/null 21 | find . -name "*.class" | jar cf CalabashIntegrationTests.jar @/dev/stdin 22 | popd > /dev/null 23 | 24 | mv "tmp/CalabashIntegrationTests.jar" "out/CalabashIntegrationTests.jar" 25 | info "Installed out/CalabashIntegrationTests.jar" 26 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/introspect/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Functionality needed for Bean introspection, required for detecting 3 | * accessors and mutators for Beans, as well as locating and handling 4 | * method annotations. 5 | *

6 | * Beyond collecting annotations, additional "method annotation inheritance" 7 | * is also supported: whereas regular JDK classes do not add annotations 8 | * from overridden methods in any situation. But code in this package does. 9 | * Similarly class-annotations are inherited properly from interfaces, in 10 | * addition to abstract and concrete classes. 11 | */ 12 | package sh.calaba.org.codehaus.jackson.map.introspect; 13 | -------------------------------------------------------------------------------- /server/integration-tests/04-run-tests.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | set -e 4 | 5 | cp "unit-tester-new.apk" "calabash-test-suite/unit-tester.apk" 6 | 7 | pushd calabash-test-suite > /dev/null 8 | bundle update 9 | bundle exec calabash-android resign unit-tester.apk 10 | bundle exec calabash-android build unit-tester.apk 11 | 12 | # The app will pop a sh.calaba.unittester "built for older version of Android" 13 | # dialog. This can be ignored - it does not influence the success or failure 14 | # of the tests. 15 | SKIP_VERSION_CHECK=1 bundle exec calabash-android run \ 16 | unit-tester.apk \ 17 | --format pretty \ 18 | --format junit \ 19 | --out test-report 20 | popd > /dev/null 21 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/query/ast/optimization/GeneralUIQueryOptimizer.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.query.ast.optimization; 2 | 3 | import java.util.List; 4 | 5 | import sh.calaba.instrumentationbackend.query.ast.UIQueryAST; 6 | 7 | public class GeneralUIQueryOptimizer implements QueryOptimizer { 8 | @Override 9 | public List optimize(List queryPath) { 10 | QueryOptimizer visibilityOptimizer = new UIQueryVisibilityOptimizer(); 11 | QueryOptimizer redundancyOptimizer = new UIQueryRedundancyOptimizer(); 12 | 13 | return redundancyOptimizer.optimize(visibilityOptimizer.optimize(queryPath)); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/annotate/JsonCreator.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.annotate; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * Marker annotation that can be used to define constructors and factory 10 | * methods as one to use for instantiating new instances of the associated 11 | * class. 12 | */ 13 | @Target({ElementType.METHOD, ElementType.CONSTRUCTOR}) 14 | @Retention(RetentionPolicy.RUNTIME) 15 | @JacksonAnnotation 16 | public @interface JsonCreator 17 | { 18 | // no values, since there's no property 19 | } 20 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/actions/webview/GetLoadProgress.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.actions.webview; 2 | 3 | import sh.calaba.instrumentationbackend.Result; 4 | import sh.calaba.instrumentationbackend.actions.Action; 5 | import android.webkit.WebView; 6 | 7 | public class GetLoadProgress implements Action { 8 | 9 | @Override 10 | public Result execute(String... args) { 11 | CalabashChromeClient ccc = CalabashChromeClient.findAndPrepareWebViews().get(0); 12 | WebView webView = ccc.getWebView(); 13 | return new Result(true, "" + webView.getProgress()); 14 | } 15 | 16 | @Override 17 | public String key() { 18 | return "get_load_progress"; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/RuntimeJsonMappingException.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map; 2 | 3 | /** 4 | * Wrapper used when interface does not allow throwing a checked 5 | * {@link JsonMappingException} 6 | */ 7 | @SuppressWarnings("serial") 8 | public class RuntimeJsonMappingException extends RuntimeException 9 | { 10 | public RuntimeJsonMappingException(JsonMappingException cause) { 11 | super(cause); 12 | } 13 | 14 | public RuntimeJsonMappingException(String message) { 15 | super(message); 16 | } 17 | 18 | public RuntimeJsonMappingException(String message, JsonMappingException cause) { 19 | super(message, cause); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/deser/std/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Contains public standard implementations of abstraction that 3 | * Jackson uses. This means that they are not merely implementation 4 | * details, but part of semi-public interface where project 5 | * tries to maintain backwards compatibility at higher level 6 | * than for 'impl' types (although less so than with fully 7 | * public interfaces). 8 | *

9 | * Note that since this package was only added relatively late 10 | * in development cycle, not all classes that belong here are 11 | * included. Plan is to move more classes over time. 12 | * 13 | * @since 1.9 14 | */ 15 | package sh.calaba.org.codehaus.jackson.map.deser.std; 16 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/Logger.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend; 2 | 3 | import android.util.Log; 4 | 5 | public final class Logger { 6 | public final static String TAG = "calabash"; 7 | 8 | public static void info(String message) { 9 | Log.i(TAG, message); 10 | } 11 | 12 | public static void debug(String message) { 13 | Log.d(TAG, message); 14 | } 15 | 16 | public static void verbose(String message) { 17 | Log.v(TAG, message); 18 | } 19 | 20 | public static void warn(String message) { 21 | Log.w(TAG, message); 22 | } 23 | 24 | public static void error(String message) { 25 | Log.e(TAG, message); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/ser/SerializerBase.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map.ser; 2 | 3 | import sh.calaba.org.codehaus.jackson.type.JavaType; 4 | 5 | /** 6 | * @deprecated Since 1.9 use {@link sh.calaba.org.codehaus.jackson.map.ser.std.SerializerBase} 7 | */ 8 | @Deprecated 9 | public abstract class SerializerBase 10 | extends sh.calaba.org.codehaus.jackson.map.ser.std.SerializerBase 11 | { 12 | protected SerializerBase(Class t) { 13 | super(t); 14 | } 15 | 16 | protected SerializerBase(JavaType type) { 17 | super(type); 18 | } 19 | 20 | protected SerializerBase(Class t, boolean dummy) { 21 | super(t, dummy); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/util/Annotations.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map.util; 2 | 3 | import java.lang.annotation.Annotation; 4 | 5 | /** 6 | * Interface that defines interface for collection of annotations. 7 | *

8 | * Standard mutable implementation is {@link sh.calaba.org.codehaus.jackson.map.introspect.AnnotationMap} 9 | * 10 | * @since 1.7 11 | */ 12 | public interface Annotations 13 | { 14 | /** 15 | * Main access method used to find value for given annotation. 16 | */ 17 | public A get(Class cls); 18 | 19 | /** 20 | * Returns number of annotation entries in this collection. 21 | */ 22 | public int size(); 23 | } 24 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/query/UIQueryResultVoid.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.query; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | 7 | public class UIQueryResultVoid { 8 | public static final UIQueryResultVoid instance = new UIQueryResultVoid(); 9 | 10 | private UIQueryResultVoid() {} 11 | 12 | @SuppressWarnings({ "rawtypes", "unchecked" }) 13 | public Object asMap(String methodName, Object receiver, 14 | String errorMessage) { 15 | Map map = new HashMap(); 16 | map.put("error", errorMessage); 17 | map.put("methodName", methodName); 18 | map.put("receiverClass", receiver.getClass().getName()); 19 | map.put("receiverString", receiver.toString()); 20 | return map; 21 | } 22 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Files for the Dalvik VM 3 | *.dex 4 | 5 | # Java class files 6 | *.class 7 | 8 | # Generated files 9 | gen/ 10 | 11 | # Gradle files 12 | .gradle/ 13 | build/ 14 | /*/build/ 15 | server/staging 16 | server/bin 17 | 18 | # Local configuration file (sdk path, etc) 19 | local.properties 20 | 21 | # Proguard folder generated by Eclipse 22 | proguard/ 23 | 24 | # Log Files 25 | *.log 26 | 27 | .idea/ 28 | *.iml 29 | 30 | # Ruby 31 | server/integration-tests/**/Gemfile.lock 32 | server/integration-tests/calabash-android 33 | 34 | # Test 35 | server/integration-tests/calabash-test-suite/test_servers 36 | server/integration-tests/calabash-test-suite/unit-tester.apk 37 | server/integration-tests/unit-tester.apk 38 | server/integration-tests/unit-tester-new.apk 39 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/JsonParseException.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson; 2 | 3 | /** 4 | * Exception type for parsing problems, used when non-well-formed content 5 | * (content that does not conform to JSON syntax as per specification) 6 | * is encountered. 7 | */ 8 | public class JsonParseException 9 | extends JsonProcessingException 10 | { 11 | @SuppressWarnings("hiding") 12 | final static long serialVersionUID = 123; // Stupid eclipse... 13 | 14 | public JsonParseException(String msg, JsonLocation loc) 15 | { 16 | super(msg, loc); 17 | } 18 | 19 | public JsonParseException(String msg, JsonLocation loc, Throwable root) 20 | { 21 | super(msg, loc, root); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/impl/JsonNumericParserBase.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.impl; 2 | 3 | import sh.calaba.org.codehaus.jackson.*; 4 | import sh.calaba.org.codehaus.jackson.io.IOContext; 5 | 6 | /** 7 | * Another intermediate base class used by all Jackson {@link JsonParser} 8 | * implementations. Contains shared functionality for dealing with 9 | * number parsing aspects, independent of input source decoding. 10 | * 11 | * @deprecated Since 1.9.0: functionality demoted down to JsonParserBase 12 | */ 13 | @Deprecated 14 | public abstract class JsonNumericParserBase 15 | extends JsonParserBase 16 | { 17 | protected JsonNumericParserBase(IOContext ctxt, int features) { 18 | super(ctxt, features); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/json/UriSerializer.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.json; 2 | 3 | import android.net.Uri; 4 | 5 | import java.io.IOException; 6 | 7 | import sh.calaba.instrumentationbackend.Logger; 8 | import sh.calaba.org.codehaus.jackson.JsonGenerator; 9 | import sh.calaba.org.codehaus.jackson.JsonProcessingException; 10 | import sh.calaba.org.codehaus.jackson.map.JsonSerializer; 11 | import sh.calaba.org.codehaus.jackson.map.SerializerProvider; 12 | 13 | public class UriSerializer extends JsonSerializer { 14 | @Override 15 | public void serialize(Uri value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { 16 | jgen.writeString(value.toString()); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/util/LRUMap.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map.util; 2 | 3 | import java.util.LinkedHashMap; 4 | import java.util.Map; 5 | 6 | /** 7 | * Helper for simple bounded LRU maps used for reusing lookup values. 8 | * 9 | * @since 1.7 10 | */ 11 | @SuppressWarnings("serial") 12 | public class LRUMap extends LinkedHashMap 13 | { 14 | protected final int _maxEntries; 15 | 16 | public LRUMap(int initialEntries, int maxEntries) 17 | { 18 | super(initialEntries, 0.8f, true); 19 | _maxEntries = maxEntries; 20 | } 21 | 22 | @Override 23 | protected boolean removeEldestEntry(Map.Entry eldest) 24 | { 25 | return size() > _maxEntries; 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/actions/webview/UnableToFindChromeClientException.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.actions.webview; 2 | 3 | import android.webkit.WebView; 4 | 5 | @SuppressWarnings("serial") 6 | public class UnableToFindChromeClientException extends RuntimeException { 7 | 8 | private final WebView webView; 9 | 10 | public UnableToFindChromeClientException(WebView webView) { 11 | this.webView = webView; 12 | } 13 | 14 | public UnableToFindChromeClientException(Exception e, WebView webView) { 15 | super(e); 16 | this.webView = webView; 17 | } 18 | 19 | public WebView getWebView() { 20 | return webView; 21 | } 22 | 23 | public String toString() { 24 | return super.toString() + "- WebView: " + webView; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/JsonSerializableWithType.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map; 2 | 3 | import java.io.IOException; 4 | 5 | import sh.calaba.org.codehaus.jackson.JsonGenerator; 6 | import sh.calaba.org.codehaus.jackson.JsonProcessingException; 7 | 8 | /** 9 | * Interface that is to replace {@link JsonSerializable} to 10 | * allow for dynamic type information embedding. 11 | * 12 | * @since 1.5 13 | * @author tatu 14 | */ 15 | @SuppressWarnings("deprecation") 16 | public interface JsonSerializableWithType 17 | extends JsonSerializable 18 | { 19 | public void serializeWithType(JsonGenerator jgen, SerializerProvider provider, 20 | TypeSerializer typeSer) 21 | throws IOException, JsonProcessingException; 22 | } 23 | -------------------------------------------------------------------------------- /server/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx1536m 10 | android.useAndroidX=true 11 | # When configured, Gradle will run in incubating parallel mode. 12 | # This option should only be used with decoupled projects. More details, visit 13 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 14 | # org.gradle.parallel=true 15 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/impl/Indenter.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.impl; 2 | 3 | import java.io.IOException; 4 | 5 | import sh.calaba.org.codehaus.jackson.*; 6 | 7 | /** 8 | * Interface that defines objects that can produce indentation used 9 | * to separate object entries and array values. Indentation in this 10 | * context just means insertion of white space, independent of whether 11 | * linefeeds are output. 12 | */ 13 | public interface Indenter 14 | { 15 | public void writeIndentation(JsonGenerator jg, int level) 16 | throws IOException, JsonGenerationException; 17 | 18 | /** 19 | * @return True if indenter is considered inline (does not add linefeeds), 20 | * false otherwise 21 | */ 22 | public boolean isInline(); 23 | } 24 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/annotate/JacksonAnnotation.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.annotate; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * Meta-annotation (annotations used on other annotations) 10 | * used for marking all annotations that are 11 | * part of Jackson package. Can be used for recognizing all 12 | * Jackson annotations generically, and in future also for 13 | * passing other generic annotation configuration. 14 | */ 15 | @Target({ElementType.ANNOTATION_TYPE}) 16 | @Retention(RetentionPolicy.RUNTIME) 17 | public @interface JacksonAnnotation 18 | { 19 | // for now, a pure tag annotation, no parameters 20 | } 21 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/module/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Package that contains classes and interfaces to help implement 3 | * custom extension {@link sh.calaba.org.codehaus.jackson.map.Module}s 4 | * (which are registered using 5 | * {@link sh.calaba.org.codehaus.jackson.map.ObjectMapper#registerModule}. 6 | *

7 | * Note that classes in the package only support registering 8 | * handlers for non-generic types (types without type 9 | * parameterization) -- hence "simple" -- which works for 10 | * many cases, but not all. So if you will need to register 11 | * handlers for generic types, you will usually need to either 12 | * sub-class handlers, or implement/extend base types directly. 13 | * 14 | * @since 1.7 15 | */ 16 | package sh.calaba.org.codehaus.jackson.map.module; 17 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/actions/gestures/DoubleTapCoordinate.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.actions.gestures; 2 | 3 | import android.view.Display; 4 | import sh.calaba.instrumentationbackend.InstrumentationBackend; 5 | import sh.calaba.instrumentationbackend.Result; 6 | import sh.calaba.instrumentationbackend.actions.Action; 7 | 8 | public class DoubleTapCoordinate implements Action { 9 | @Override 10 | public Result execute(String... args) { 11 | float x = Float.parseFloat(args[0]); 12 | float y = Float.parseFloat(args[1]); 13 | 14 | InstrumentationBackend.solo.doubleTapOnScreen(x, y); 15 | 16 | return Result.successResult(); 17 | } 18 | 19 | @Override 20 | public String key() { 21 | return "double_tap_coordinate"; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/actions/gestures/TouchCoordinates.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.actions.gestures; 2 | 3 | 4 | import android.view.Display; 5 | import sh.calaba.instrumentationbackend.InstrumentationBackend; 6 | import sh.calaba.instrumentationbackend.Result; 7 | import sh.calaba.instrumentationbackend.actions.Action; 8 | 9 | 10 | public class TouchCoordinates implements Action { 11 | 12 | @Override 13 | public Result execute(String... args) { 14 | float x = Float.parseFloat(args[0]); 15 | float y = Float.parseFloat(args[1]); 16 | 17 | InstrumentationBackend.solo.clickOnScreen(x, y); 18 | return Result.successResult(); 19 | } 20 | 21 | @Override 22 | public String key() { 23 | return "touch_coordinate"; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/actions/helpers/ListActions.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.actions.helpers; 2 | 3 | 4 | import sh.calaba.instrumentationbackend.InstrumentationBackend; 5 | import sh.calaba.instrumentationbackend.Result; 6 | import sh.calaba.instrumentationbackend.actions.Action; 7 | 8 | 9 | public class ListActions implements Action { 10 | 11 | @Override 12 | public Result execute(String... args) { 13 | Result result = new Result(true, "Available actions"); 14 | for(String key: InstrumentationBackend.actions.getActions().keySet()) { 15 | result.addBonusInformation(key); 16 | } 17 | 18 | return result; 19 | } 20 | 21 | @Override 22 | public String key() { 23 | return "list_actions"; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/actions/device/Actions.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.actions.device; 2 | 3 | /** 4 | * List of UIAutomator actions supported by uiautomator_execute command. 5 | * 6 | * List of available methods in UIAutomator can be found here: 7 | * https://developer.android.com/reference/androidx/test/uiautomator/UiObject2 8 | */ 9 | public enum Actions { 10 | click, 11 | longClick, 12 | getText, 13 | getContentDescription, 14 | getClassName, 15 | getResourceName, 16 | getVisibleBounds, 17 | getVisibleCenter, 18 | getApplicationPackage, 19 | getChildCount, 20 | clear, 21 | isCheckable, 22 | isChecked, 23 | isClickable, 24 | isEnabled, 25 | isFocusable, 26 | isFocused, 27 | isLongClickable, 28 | isScrollable, 29 | isSelected; 30 | } 31 | -------------------------------------------------------------------------------- /server/integration-tests/calabash-test-suite/features/steps/shared.rb: -------------------------------------------------------------------------------- 1 | Then(/^I install the app$/) do 2 | reinstall_apps 3 | end 4 | 5 | Then(/^I start the app$/) do 6 | shutdown_test_server 7 | start_test_server_in_background 8 | backdoor('startTest') 9 | end 10 | 11 | Then(/^I wait for the unit test result$/) do 12 | wait_for_element_exists("textview {text BEGINSWITH 'TEST'}", timeout: 60*10) 13 | end 14 | 15 | Then(/^I print it to stdout$/) do 16 | s = query("edittext", :getText).first.gsub("URI: //ready\nparams: {json={}\n}", "").gsub("URI: //ping\nparams: {json={}\n}", "") 17 | puts s 18 | $stdout.puts s 19 | File.open("../result.log", 'w') do |file| 20 | file.write(s) 21 | end 22 | end 23 | 24 | Then(/^I fail if the unit test did not succeed$/) do 25 | if element_exists("textview text:'TEST FAILED'") 26 | raise "Unit test failed" 27 | end 28 | end 29 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/actions/gestures/DragCoordinates.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.actions.gestures; 2 | 3 | import sh.calaba.instrumentationbackend.InstrumentationBackend; 4 | import sh.calaba.instrumentationbackend.Result; 5 | import sh.calaba.instrumentationbackend.actions.Action; 6 | 7 | public class DragCoordinates implements Action { 8 | 9 | @Override 10 | public Result execute(String... args) { 11 | 12 | Float fromX = new Float(args[0]); 13 | Float fromY = new Float(args[1]); 14 | Float toX = new Float(args[2]); 15 | Float toY = new Float(args[3]); 16 | Integer stepCount = 40; 17 | 18 | InstrumentationBackend.solo.drag(fromX, toX, fromY, toY, stepCount); 19 | 20 | return Result.successResult(); 21 | } 22 | 23 | @Override 24 | public String key() { 25 | return "drag_coordinates"; 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/annotate/NoClass.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map.annotate; 2 | 3 | /** 4 | * Marker class used with annotations to indicate "no class". This is 5 | * a silly but necessary work-around -- annotations can not take nulls 6 | * as either default or explicit values. Hence for class values we must 7 | * explicitly use a bogus placeholder to denote equivalent of 8 | * "no class" (for which 'null' is usually the natural choice). 9 | *

10 | * Note before version 1.4, this marker class was under 11 | * "sh.calaba.org.codehaus.jackson.annotate". However, since it is only used 12 | * by annotations in "sh.calaba.org.codehaus.jackson.map.annotate" (and not externally 13 | * exposed), it was moved to that package as of version 1.5. 14 | */ 15 | public final class NoClass 16 | { 17 | private NoClass() { } 18 | } 19 | 20 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/json/CustomAndroidModule.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.json; 2 | 3 | import android.content.ComponentName; 4 | import android.content.Intent; 5 | import android.net.Uri; 6 | 7 | import sh.calaba.org.codehaus.jackson.Version; 8 | import sh.calaba.org.codehaus.jackson.map.module.SimpleModule; 9 | 10 | public class CustomAndroidModule extends SimpleModule { 11 | public CustomAndroidModule() { 12 | super("CustomAndroidModule", new Version(0, 1, 0, null)); 13 | addSerializer(Intent.class, new IntentSerializer()); 14 | addDeserializer(Intent.class, new IntentDeserializer()); 15 | addSerializer(ComponentName.class, new ComponentNameSerializer()); 16 | addDeserializer(ComponentName.class, new ComponentNameDeserializer()); 17 | addSerializer(Uri.class, new UriSerializer()); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/JsonGenerationException.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson; 2 | 3 | /** 4 | * Exception type for exceptions during JSON writing, such as trying 5 | * to output content in wrong context (non-matching end-array or end-object, 6 | * for example). 7 | */ 8 | public class JsonGenerationException 9 | extends JsonProcessingException 10 | { 11 | @SuppressWarnings("hiding") 12 | final static long serialVersionUID = 123; // Stupid eclipse... 13 | 14 | public JsonGenerationException(Throwable rootCause) 15 | { 16 | super(rootCause); 17 | } 18 | 19 | public JsonGenerationException(String msg) 20 | { 21 | super(msg, (JsonLocation)null); 22 | } 23 | 24 | public JsonGenerationException(String msg, Throwable rootCause) 25 | { 26 | super(msg, (JsonLocation)null, rootCause); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/schema/SchemaAware.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.schema; 2 | 3 | import sh.calaba.org.codehaus.jackson.JsonNode; 4 | import sh.calaba.org.codehaus.jackson.map.JsonMappingException; 5 | import sh.calaba.org.codehaus.jackson.map.SerializerProvider; 6 | 7 | import java.lang.reflect.Type; 8 | 9 | /** 10 | * Marker interface for schema-aware serializers. 11 | * 12 | * @author Ryan Heaton 13 | */ 14 | public interface SchemaAware 15 | { 16 | /** 17 | * Get the representation of the schema to which this serializer will conform. 18 | * 19 | * @param provider The serializer provider. 20 | * @param typeHint A hint about the type. 21 | * @return Json-schema for this serializer. 22 | */ 23 | JsonNode getSchema(SerializerProvider provider, Type typeHint) 24 | throws JsonMappingException; 25 | } 26 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/Versioned.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson; 2 | 3 | /** 4 | * Interface that those Jackson components that are explicitly versioned will implement. 5 | * Intention is to allow both plug-in components (custom extensions) and applications and 6 | * frameworks that use Jackson to detect exact version of Jackson in use. 7 | * This may be useful for example for ensuring that proper Jackson version is deployed 8 | * (beyond mechanisms that deployment system may have), as well as for possible 9 | * workarounds. 10 | * 11 | * @since 1.6 12 | */ 13 | public interface Versioned { 14 | /** 15 | * Method called to detect version of the component that implements this interface; 16 | * returned version should never be null, but may return specific "not available" 17 | * instance (see {@link Version} for details). 18 | */ 19 | public Version version(); 20 | } 21 | -------------------------------------------------------------------------------- /bin/log.sh: -------------------------------------------------------------------------------- 1 | # Log functions for scripts. 2 | # 3 | # Suitable for Xcode Run Script Build Phase and command line scripts. 4 | # 5 | # Usage: 6 | # 7 | # source bin/log.sh 8 | 9 | function info { 10 | if [ "${TERM}" = "dumb" ]; then 11 | echo -e "INFO: $1" 12 | else 13 | echo -e "$(tput setaf 2)INFO: $1$(tput sgr0)" 14 | fi 15 | } 16 | 17 | function shell { 18 | if [ "${TERM}" = "dumb" ]; then 19 | echo -e "SHELL: $1" 20 | else 21 | echo -e "$(tput setaf 6)SHELL: $1$(tput sgr0)" 22 | fi 23 | } 24 | 25 | function error { 26 | if [ "${TERM}" = "dumb" ]; then 27 | echo -e "ERROR: $1" 28 | else 29 | echo -e "$(tput setaf 1)ERROR: $1$(tput sgr0)" 30 | fi 31 | } 32 | 33 | function banner { 34 | if [ "${TERM}" = "dumb" ]; then 35 | echo "" 36 | echo "######## $1 ########" 37 | echo "" 38 | else 39 | echo "" 40 | echo "$(tput setaf 5)######## $1 ########$(tput sgr0)" 41 | echo "" 42 | fi 43 | } 44 | 45 | -------------------------------------------------------------------------------- /server/integration-tests/log.sh: -------------------------------------------------------------------------------- 1 | # Log functions for scripts. 2 | # 3 | # Suitable for Xcode Run Script Build Phase and command line scripts. 4 | # 5 | # Usage: 6 | # 7 | # source bin/log.sh 8 | 9 | function info { 10 | if [ "${TERM}" = "dumb" ]; then 11 | echo "INFO: $1" 12 | else 13 | echo "$(tput setaf 2)INFO: $1$(tput sgr0)" 14 | fi 15 | } 16 | 17 | function warn { 18 | if [ "${TERM}" = "dumb" ]; then 19 | echo "WARN: $1" 20 | else 21 | echo "$(tput setaf 3)WARN: $1$(tput sgr0)" 22 | fi 23 | } 24 | 25 | function error { 26 | if [ "${TERM}" = "dumb" ]; then 27 | echo "ERROR: $1" 28 | else 29 | echo "$(tput setaf 1)ERROR: $1$(tput sgr0)" 30 | fi 31 | } 32 | 33 | function banner { 34 | if [ "${TERM}" = "dumb" ]; then 35 | echo "" 36 | echo "######## $1 ########" 37 | echo "" 38 | else 39 | echo "" 40 | echo "$(tput setaf 5)######## $1 ########$(tput sgr0)" 41 | echo "" 42 | fi 43 | } 44 | 45 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/annotate/JsonValueInstantiator.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map.annotate; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | import sh.calaba.org.codehaus.jackson.annotate.JacksonAnnotation; 9 | import sh.calaba.org.codehaus.jackson.map.deser.ValueInstantiator; 10 | 11 | /** 12 | * Annotation that can be used to indicate a {@link ValueInstantiator} to use 13 | * for creating instances of specified type. 14 | * 15 | * @since 1.9 16 | */ 17 | @Target(ElementType.TYPE) 18 | @Retention(RetentionPolicy.RUNTIME) 19 | @JacksonAnnotation 20 | public @interface JsonValueInstantiator 21 | { 22 | /** 23 | * @return {@link ValueInstantiator} to use for annotated type 24 | */ 25 | public Class value(); 26 | } 27 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/annotate/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Public core annotations, most of which are used to configure how 3 | * Data Mapping/Binding works. Annotations in this package can only 4 | * have dependencies to non-annotation classes in Core package; 5 | * annotations that have dependencies to Mapper classes are included 6 | * in Mapper module (under sh.calaba.org.codehaus.jackson.map.annotate). 7 | * Also contains parameter types (mostly enums) needed by annotations. 8 | *

9 | * In future (version 2.0?), this package will probably be split off 10 | * as a separate jar/module, to allow use of annotations without 11 | * including core module. This would be useful for third party value 12 | * classes that themselves do not depend on Jackson, but may want to 13 | * be annotated to be automatically and conveniently serializable by 14 | * Jackson. 15 | */ 16 | package sh.calaba.org.codehaus.jackson.annotate; 17 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/deser/std/AtomicBooleanDeserializer.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map.deser.std; 2 | 3 | import java.io.IOException; 4 | import java.util.concurrent.atomic.AtomicBoolean; 5 | 6 | import sh.calaba.org.codehaus.jackson.JsonParser; 7 | import sh.calaba.org.codehaus.jackson.JsonProcessingException; 8 | import sh.calaba.org.codehaus.jackson.map.DeserializationContext; 9 | 10 | public class AtomicBooleanDeserializer 11 | extends StdScalarDeserializer 12 | { 13 | public AtomicBooleanDeserializer() { super(AtomicBoolean.class); } 14 | 15 | @Override 16 | public AtomicBoolean deserialize(JsonParser jp, DeserializationContext ctxt) 17 | throws IOException, JsonProcessingException 18 | { 19 | // 16-Dec-2010, tatu: Should we actually convert null to null AtomicBoolean? 20 | return new AtomicBoolean(_parseBooleanPrimitive(jp, ctxt)); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/actions/softkey/KeyUtil.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.actions.softkey; 2 | 3 | import android.view.KeyEvent; 4 | 5 | import java.lang.reflect.Field; 6 | 7 | public class KeyUtil { 8 | public static Integer getKey(String keyName) { 9 | keyName = keyName.toUpperCase(); 10 | 11 | Class keyEventClass = KeyEvent.class; 12 | try { 13 | Field field = keyEventClass.getField(keyName); 14 | 15 | return field.getInt(null); 16 | } catch (NoSuchFieldException e) { 17 | return null; 18 | } catch (IllegalAccessException e) { 19 | return null; 20 | } 21 | } 22 | 23 | public static boolean isNumber(String string) { 24 | try { 25 | Integer.parseInt(string); 26 | 27 | return true; 28 | } catch (NumberFormatException e) { 29 | return false; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/annotate/JsonAnySetter.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.annotate; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * Marker annotation that can be used to define a non-static, 10 | * single-argument method, to be used as a "fallback" handler 11 | * for all otherwise unrecognized properties found from Json content. 12 | * It is similar to {@link javax.xml.bind.annotation.XmlAnyElement} 13 | * in behavior; and can only be used to denote a single property 14 | * per type. 15 | *

16 | * If used, all otherwise unmapped key-value pairs from Json Object 17 | * structs are added to the property (of type Map or bean). 18 | */ 19 | @Target(ElementType.METHOD) 20 | @Retention(RetentionPolicy.RUNTIME) 21 | @JacksonAnnotation 22 | public @interface JsonAnySetter 23 | { 24 | } 25 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/ext/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | Contains extended support for "external" packages: things that 3 | may or may not be present in runtime environment, but that are 4 | commonly enough used so that explicit support can be added. 5 |

6 | Currently supported extensions include: 7 |

    8 |
  • Support for Java 1.5 core XML datatypes: the reason these are 9 | considered "external" is that some platforms that claim to be 1.5 conformant 10 | are only partially so (Google Android, GAE) and do not included these 11 | types. 12 |
  • 13 |
  • Joda time. This package has superior date/time handling functionality, 14 | and is thus supported. However, to minimize forced dependencies this 15 | support is added as extension so that Joda is not needed by Jackson 16 | itself: but if it is present, its core types are supported to some 17 | degree 18 |
  • 19 |
20 | 21 | */ 22 | 23 | package sh.calaba.org.codehaus.jackson.map.ext; 24 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/deser/ArrayDeserializer.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map.deser; 2 | 3 | import sh.calaba.org.codehaus.jackson.map.*; 4 | import sh.calaba.org.codehaus.jackson.map.type.ArrayType; 5 | 6 | /** 7 | * @deprecated Since 1.9, use {@link sh.calaba.org.codehaus.jackson.map.deser.std.ObjectArrayDeserializer} instead. 8 | */ 9 | @Deprecated 10 | public class ArrayDeserializer 11 | extends sh.calaba.org.codehaus.jackson.map.deser.std.ObjectArrayDeserializer 12 | { 13 | /** 14 | * @deprecated 15 | */ 16 | @Deprecated 17 | public ArrayDeserializer(ArrayType arrayType, JsonDeserializer elemDeser) 18 | { 19 | this(arrayType, elemDeser, null); 20 | } 21 | 22 | public ArrayDeserializer(ArrayType arrayType, JsonDeserializer elemDeser, 23 | TypeDeserializer elemTypeDeser) 24 | { 25 | super(arrayType, elemDeser, elemTypeDeser); 26 | } 27 | } 28 | 29 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/json/ComponentNameSerializer.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.json; 2 | 3 | import android.content.ComponentName; 4 | 5 | import java.io.IOException; 6 | 7 | import sh.calaba.org.codehaus.jackson.JsonGenerator; 8 | import sh.calaba.org.codehaus.jackson.JsonProcessingException; 9 | import sh.calaba.org.codehaus.jackson.map.JsonSerializer; 10 | import sh.calaba.org.codehaus.jackson.map.SerializerProvider; 11 | 12 | public class ComponentNameSerializer extends JsonSerializer { 13 | @Override 14 | public void serialize(ComponentName componentName, JsonGenerator jgen, SerializerProvider provider) 15 | throws IOException, JsonProcessingException { 16 | jgen.writeStartObject(); 17 | jgen.writeStringField("className", componentName.getClassName()); 18 | jgen.writeStringField("packageName", componentName.getPackageName()); 19 | jgen.writeEndObject(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/annotate/JsonTypeName.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.annotate; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | 9 | /** 10 | * Annotation used for binding logical name that the annotated class 11 | * has. Used with {@link JsonTypeInfo} (and specifically its 12 | * {@link JsonTypeInfo#use} property) to establish relationship 13 | * between type names and types. 14 | * 15 | * @since 1.5 16 | * 17 | * @author tatu 18 | */ 19 | @Target({ElementType.TYPE}) 20 | @Retention(RetentionPolicy.RUNTIME) 21 | @JacksonAnnotation 22 | public @interface JsonTypeName { 23 | /** 24 | * Logical type name for annotated type. If missing (or defined as Empty String), 25 | * defaults to using non-qualified class name as the type. 26 | */ 27 | public String value() default ""; 28 | } 29 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/annotate/JacksonStdImpl.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map.annotate; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | import sh.calaba.org.codehaus.jackson.annotate.JacksonAnnotation; 9 | 10 | /** 11 | * Marker interface used to indicate implementation classes 12 | * (serializers, deserializers etc) that are standard ones Jackson 13 | * uses; not custom ones that application has added. It can be 14 | * added in cases where certain optimizations can be made if 15 | * default instances are uses; for example when handling conversions 16 | * of "natural" JSON types like Strings, booleans and numbers. 17 | * 18 | * @since 1.6 19 | */ 20 | @Target({ElementType.TYPE}) 21 | @Retention(RetentionPolicy.RUNTIME) 22 | @JacksonAnnotation 23 | public @interface JacksonStdImpl { 24 | 25 | } 26 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/WakeUp.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | import android.os.Handler; 6 | import android.view.Window; 7 | import android.view.WindowManager; 8 | 9 | /** 10 | * @author casidiablo 11 | * @version 1.0 12 | */ 13 | public class WakeUp extends Activity { 14 | @Override 15 | public void onCreate(Bundle savedInstanceState) { 16 | super.onCreate(savedInstanceState); 17 | 18 | Window window = getWindow(); 19 | window.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED 20 | | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON 21 | | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD); 22 | 23 | Handler handler = new Handler(); 24 | handler.postDelayed(new Runnable() { 25 | public void run() { 26 | WakeUp.this.finish(); 27 | } 28 | }, 200); 29 | } 30 | } -------------------------------------------------------------------------------- /server/app/src/androidTest/java/com/jayway/android/robotium/solo/SoloEnhanced.java: -------------------------------------------------------------------------------- 1 | package com.jayway.android.robotium.solo; 2 | 3 | import java.util.List; 4 | 5 | import android.app.Activity; 6 | import android.app.Instrumentation; 7 | import android.graphics.PointF; 8 | 9 | public class SoloEnhanced extends Solo { 10 | public SoloEnhanced(Instrumentation instrumentation) { 11 | super(instrumentation); 12 | } 13 | 14 | public ActivityUtils getActivityUtils() { 15 | return activityUtils; 16 | } 17 | 18 | public void doubleTapOnScreen(float x, float y) { 19 | clicker.clickOnScreen(x,y); 20 | clicker.clickOnScreen(x,y); 21 | } 22 | 23 | 24 | public void drag_without_hiding_keyboard(float fromX, float toX, float fromY, float toY, 25 | int stepCount) { 26 | scroller.drag(fromX, toX, fromY, toY, stepCount); 27 | } 28 | 29 | public void runOnMainSync(Runnable runner) { 30 | instrumentation.runOnMainSync(runner); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/utils/SlidingMap.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.utils; 2 | 3 | import java.util.AbstractMap; 4 | import java.util.LinkedHashMap; 5 | import java.util.Map; 6 | import java.util.Set; 7 | 8 | /* 9 | A map that contains a fixed set of entries, removing the oldest ones on addition. 10 | */ 11 | public class SlidingMap extends AbstractMap { 12 | private Map map = new LinkedHashMap(); 13 | private int maxSize; 14 | 15 | public SlidingMap(int maxSize) { 16 | this.maxSize = maxSize; 17 | } 18 | 19 | @Override 20 | public synchronized V put(K key, V value) { 21 | if (map.size() >= maxSize) { 22 | map.remove(map.keySet().iterator().next()); 23 | } 24 | 25 | map.remove(key); 26 | map.put(key, value); 27 | 28 | return null; 29 | } 30 | 31 | @Override 32 | public Set> entrySet() { 33 | return map.entrySet(); 34 | } 35 | } -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/query/ast/evaluation/QueryEvaluator.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.query.ast.evaluation; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import sh.calaba.instrumentationbackend.query.ast.*; 7 | 8 | public class QueryEvaluator { 9 | public static List evaluateQueryForPath(List queryPath, 10 | QueryEvaluationStep stepHandler) { 11 | List result = new ArrayList(); 12 | 13 | for (UIQueryAST step : queryPath) { 14 | if (step instanceof UIQueryDirection) { 15 | result = stepHandler.step((UIQueryDirection) step); 16 | } else if (step instanceof UIQueryVisibility) { 17 | result = stepHandler.step((UIQueryVisibility) step); 18 | } else { 19 | result = stepHandler.step(step); 20 | } 21 | } 22 | 23 | return result; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/actions/Utils.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.actions; 2 | 3 | import android.content.Context; 4 | import android.content.pm.PackageManager; 5 | 6 | import java.io.FileInputStream; 7 | import java.io.IOException; 8 | import java.io.InputStream; 9 | import java.io.OutputStream; 10 | 11 | public class Utils { 12 | public static void copyContents(InputStream from, OutputStream to) throws IOException { 13 | byte[] buffer = new byte[4*1024]; 14 | 15 | int read; 16 | 17 | while ((read = from.read(buffer)) != -1) { 18 | to.write(buffer, 0, read); 19 | } 20 | } 21 | 22 | public static boolean isApplicationInstalled(Context context, String packageName) { 23 | try { 24 | context.getPackageManager().getApplicationInfo(packageName, 0); 25 | 26 | return true; 27 | } catch (PackageManager.NameNotFoundException e) { 28 | return false; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/utils/SystemPropertiesWrapper.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.utils; 2 | 3 | import java.lang.reflect.InvocationTargetException; 4 | import java.lang.reflect.Method; 5 | 6 | public class SystemPropertiesWrapper { 7 | public static int getInt(String key, int def) { 8 | try { 9 | Class systemPropertiesClass = Class.forName("android.os.SystemProperties"); 10 | Method getInt = systemPropertiesClass.getMethod("getInt", String.class, int.class); 11 | 12 | return (Integer) getInt.invoke(null, key, def); 13 | } catch (NoSuchMethodException e) { 14 | throw new RuntimeException(e); 15 | } catch (IllegalAccessException e) { 16 | throw new RuntimeException(e); 17 | } catch (InvocationTargetException e) { 18 | throw new RuntimeException(e); 19 | } catch (ClassNotFoundException e) { 20 | throw new RuntimeException(e); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/annotate/JsonAnyGetter.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.annotate; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * Marker annotation that can be used to define a non-static, 10 | * no-argument method or member field as something of a reverse of 11 | * {@link JsonAnySetter} method; basically being used like a 12 | * getter but such that contents of the returned Map (type must be 13 | * {@link java.util.Map}) are serialized as if they were actual properties 14 | * of the bean that contains method/field with this annotations. 15 | * As with {@link JsonAnySetter}, only one property should be annotated 16 | * with this annotation. 17 | * 18 | * @since 1.6 19 | */ 20 | @Target(ElementType.METHOD) 21 | @Retention(RetentionPolicy.RUNTIME) 22 | @JacksonAnnotation 23 | public @interface JsonAnyGetter 24 | { 25 | } 26 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/KeyDeserializers.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map; 2 | 3 | import sh.calaba.org.codehaus.jackson.type.JavaType; 4 | 5 | /** 6 | * Interface that defines API for simple extensions that can provide additional deserializers 7 | * for deserializer Map keys of various types, from JSON property names. 8 | * Access is by a single callback method; instance is to either return 9 | * a configured {@link KeyDeserializer} for specified type, or null to indicate that it 10 | * does not support handling of the type. In latter case, further calls can be made 11 | * for other providers; in former case returned key deserializer is used for handling of 12 | * key instances of specified type. 13 | * 14 | * @since 1.8 15 | */ 16 | public interface KeyDeserializers 17 | { 18 | public KeyDeserializer findKeyDeserializer(JavaType type, DeserializationConfig config, 19 | BeanDescription beanDesc, BeanProperty property) 20 | throws JsonMappingException; 21 | } 22 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/query/ast/optimization/UIQueryASTClassNameCache.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.query.ast.optimization; 2 | 3 | import java.util.Map; 4 | import java.util.concurrent.locks.Lock; 5 | import java.util.concurrent.locks.ReentrantLock; 6 | 7 | import sh.calaba.instrumentationbackend.utils.SlidingMap; 8 | 9 | public class UIQueryASTClassNameCache { 10 | private static Map> map = new SlidingMap>(20); 11 | private static Lock lock = new ReentrantLock(); 12 | 13 | public static Class loadedClass(String className) { 14 | lock.lock(); 15 | 16 | try { 17 | return map.get(className); 18 | } finally { 19 | lock.unlock(); 20 | } 21 | } 22 | 23 | public static void markAsLoaded(String className, Class clazz) { 24 | lock.lock(); 25 | 26 | try { 27 | map.put(className, clazz); 28 | } finally { 29 | lock.unlock(); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/json/ComponentNameDeserializer.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.json; 2 | 3 | import android.content.ComponentName; 4 | 5 | import java.io.IOException; 6 | import java.util.HashMap; 7 | import java.util.Map; 8 | 9 | import sh.calaba.org.codehaus.jackson.JsonParser; 10 | import sh.calaba.org.codehaus.jackson.JsonProcessingException; 11 | import sh.calaba.org.codehaus.jackson.map.DeserializationContext; 12 | import sh.calaba.org.codehaus.jackson.map.JsonDeserializer; 13 | 14 | public class ComponentNameDeserializer extends JsonDeserializer { 15 | @Override 16 | public ComponentName deserialize(JsonParser jp, DeserializationContext ctxt) 17 | throws IOException, JsonProcessingException { 18 | HashMap map = (HashMap) jp.readValueAs(Map.class); 19 | String className = (String) map.get("className"); 20 | String packageName = (String) map.get("packageName"); 21 | 22 | return new ComponentName(packageName, className); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/apache/http/entity/mime/version.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | # 19 | info.module = HttpMime 20 | info.release = 4.1.2 21 | info.timestamp = ${mvn.timestamp} 22 | # timestamp requires Maven 2.1 23 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/actions/view/GetActivityName.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.actions.view; 2 | 3 | import sh.calaba.instrumentationbackend.InstrumentationBackend; 4 | import sh.calaba.instrumentationbackend.Result; 5 | import sh.calaba.instrumentationbackend.actions.Action; 6 | import android.app.Activity; 7 | import android.app.TabActivity; 8 | 9 | /** 10 | * @author Nicholas Albion 11 | */ 12 | @SuppressWarnings("deprecation") 13 | public class GetActivityName implements Action { 14 | 15 | @Override 16 | public Result execute(String... args) { 17 | Activity currentActivity = InstrumentationBackend.getCurrentActivity(); 18 | 19 | Result result = new Result(true, currentActivity.getClass().getSimpleName()); 20 | 21 | if( currentActivity instanceof TabActivity ) { 22 | result.addBonusInformation( ((TabActivity)currentActivity).getTabHost().getCurrentTabTag() ); 23 | } 24 | 25 | return result; 26 | } 27 | 28 | @Override 29 | public String key() { 30 | return "get_activity_name"; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/ser/FilterProvider.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map.ser; 2 | 3 | /** 4 | * Interface for objects that providers instances of {@link BeanPropertyFilter} 5 | * that match given ids. A provider is configured to be used during serialization, 6 | * to find filter to used based on id specified by {@link sh.calaba.org.codehaus.jackson.map.annotate.JsonFilter} 7 | * annotation on bean class. 8 | * 9 | * @since 1.7 10 | */ 11 | public abstract class FilterProvider 12 | { 13 | /** 14 | * Lookup method used to find {@link BeanPropertyFilter} that has specified id. 15 | * Note that id is typically a {@link java.lang.String}, but is not necessarily 16 | * limited to that; that is, while standard components use String, custom 17 | * implementation can choose other kinds of keys. 18 | * 19 | * @return Filter registered with specified id, if one defined; null if 20 | * none found. 21 | */ 22 | public abstract BeanPropertyFilter findFilter(Object filterId); 23 | } 24 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/annotate/JsonRootName.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map.annotate; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | import sh.calaba.org.codehaus.jackson.annotate.JacksonAnnotation; 9 | 10 | /** 11 | * Annotation similar to {@link javax.xml.bind.annotation.XmlRootElement}, 12 | * used to indicate name to use for root-level wrapping, if wrapping is 13 | * enabled. Annotation itself does not indicate that wrapping should 14 | * be used; but if it is, name used for serialization should be name 15 | * specified here, and deserializer will expect the name as well. 16 | * 17 | * @since 1.9.0 18 | */ 19 | @Target(ElementType.TYPE) 20 | @Retention(RetentionPolicy.RUNTIME) 21 | @JacksonAnnotation 22 | public @interface JsonRootName 23 | { 24 | /** 25 | * Root name to use if root-level wrapping is enabled. 26 | */ 27 | public String value(); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /bin/ci/ado/start-emulator.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ANDROID_SDK_VERSION=29 3 | echo "Ensuring no emulators are running" 4 | 5 | $ANDROID_HOME/platform-tools/adb devices | \ 6 | grep emulator | cut -f1 | \ 7 | while read line; do adb -s $line emu kill || true; done 8 | 9 | echo "Creating emulator" 10 | echo "no" | $ANDROID_HOME/tools/bin/avdmanager create avd \ 11 | -n xamarin_android_emulator \ 12 | -k 'system-images;android-'$ANDROID_SDK_VERSION';google_apis;x86' \ 13 | --force 14 | 15 | $ANDROID_HOME/emulator/emulator -list-avds 16 | 17 | echo "Starting emulator" 18 | 19 | nohup $ANDROID_HOME/emulator/emulator -avd xamarin_android_emulator \ 20 | -no-snapshot > /dev/null 2>&1 & 21 | $ANDROID_HOME/platform-tools/adb wait-for-device \ 22 | shell 'while [[ -z $(getprop sys.boot_completed | tr -d '\r') ]]; do sleep 1; done; input keyevent 82' 23 | 24 | echo "Disabling animations on emulator" 25 | 26 | adb shell settings put global window_animation_scale 0 27 | adb shell settings put global transition_animation_scale 0 28 | adb shell settings put global animator_duration_scale 0 29 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/ResolvableSerializer.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map; 2 | 3 | /** 4 | * Interface used to indicate serializers that want to do post-processing 5 | * after construction and being added to {@link SerializerProvider}, 6 | * but before being used. This is typically used to resolve references 7 | * to other contained types; for example, bean serializers use this 8 | * to eagerly find serializers for contained field types. 9 | */ 10 | public interface ResolvableSerializer 11 | { 12 | /** 13 | * Method called after {@link SerializerProvider} has registered 14 | * the serializer, but before it has returned it to the caller. 15 | * Called object can then resolve its dependencies to other types, 16 | * including self-references (direct or indirect). 17 | * 18 | * @param provider Provider that has constructed serializer this method 19 | * is called on. 20 | */ 21 | public abstract void resolve(SerializerProvider provider) 22 | throws JsonMappingException; 23 | } 24 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/jsontype/impl/TypeSerializerBase.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map.jsontype.impl; 2 | 3 | import sh.calaba.org.codehaus.jackson.annotate.JsonTypeInfo; 4 | import sh.calaba.org.codehaus.jackson.map.BeanProperty; 5 | import sh.calaba.org.codehaus.jackson.map.TypeSerializer; 6 | import sh.calaba.org.codehaus.jackson.map.jsontype.TypeIdResolver; 7 | 8 | /** 9 | * @since 1.5 10 | */ 11 | public abstract class TypeSerializerBase extends TypeSerializer 12 | { 13 | protected final TypeIdResolver _idResolver; 14 | 15 | protected final BeanProperty _property; 16 | 17 | protected TypeSerializerBase(TypeIdResolver idRes, BeanProperty property) 18 | { 19 | _idResolver = idRes; 20 | _property = property; 21 | } 22 | 23 | @Override 24 | public abstract JsonTypeInfo.As getTypeInclusion(); 25 | 26 | @Override 27 | public String getPropertyName() { return null; } 28 | 29 | @Override 30 | public TypeIdResolver getTypeIdResolver() { return _idResolver; } 31 | } 32 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/actions/gestures/ClickOnScreen.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.actions.gestures; 2 | 3 | 4 | import sh.calaba.instrumentationbackend.InstrumentationBackend; 5 | import sh.calaba.instrumentationbackend.Result; 6 | import sh.calaba.instrumentationbackend.actions.Action; 7 | import android.view.Display; 8 | 9 | 10 | public class ClickOnScreen implements Action { 11 | 12 | @Override 13 | public Result execute(String... args) { 14 | Display display = InstrumentationBackend.solo.getCurrentActivity().getWindowManager().getDefaultDisplay(); 15 | 16 | float x = Float.parseFloat(args[0]); 17 | float y = Float.parseFloat(args[1]); 18 | 19 | int width = display.getWidth(); 20 | int height = display.getHeight(); 21 | 22 | InstrumentationBackend.solo.clickOnScreen((x/100)*width, (y/100)*height); 23 | return Result.successResult(); 24 | } 25 | 26 | @Override 27 | public String key() { 28 | return "click_on_screen"; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/ClearAppData2.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | import android.test.InstrumentationTestRunner; 6 | 7 | import sh.calaba.instrumentationbackend.utils.MonoUtils; 8 | 9 | /** 10 | * Deprecated to use for Android 11 and higher. Will cause a crash 11 | */ 12 | @Deprecated 13 | public class ClearAppData2 extends InstrumentationTestRunner { 14 | @Override 15 | public void onCreate(Bundle arguments) { 16 | MonoUtils.loadMono(getTargetContext()); 17 | 18 | StatusReporter statusReporter = new StatusReporter(getContext()); 19 | 20 | try { 21 | Cleaner cleaner = new Cleaner(); 22 | cleaner.clearAppData(getTargetContext()); 23 | } catch (Exception e) { 24 | statusReporter.reportFailure(e); 25 | throw new RuntimeException(e); 26 | } 27 | 28 | statusReporter.reportFinished(StatusReporter.FinishedState.SUCCESSFUL); 29 | finish(Activity.RESULT_OK, null); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/deser/std/DateDeserializer.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map.deser.std; 2 | 3 | import java.io.IOException; 4 | import java.util.Date; 5 | 6 | import sh.calaba.org.codehaus.jackson.JsonParser; 7 | import sh.calaba.org.codehaus.jackson.JsonProcessingException; 8 | import sh.calaba.org.codehaus.jackson.map.DeserializationContext; 9 | 10 | /** 11 | * Simple deserializer for handling {@link java.util.Date} values. 12 | *

13 | * One way to customize Date formats accepted is to override method 14 | * {@link DeserializationContext#parseDate} that this basic 15 | * deserializer calls. 16 | * 17 | * @since 1.9 (moved from higher-level package) 18 | */ 19 | public class DateDeserializer 20 | extends StdScalarDeserializer 21 | { 22 | public DateDeserializer() { super(Date.class); } 23 | 24 | @Override 25 | public java.util.Date deserialize(JsonParser jp, DeserializationContext ctxt) 26 | throws IOException, JsonProcessingException 27 | { 28 | return _parseDate(jp, ctxt); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/actions/device/UiautomatorTouchText.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.actions.device; 2 | 3 | import androidx.test.uiautomator.UiObject; 4 | import androidx.test.uiautomator.UiObjectNotFoundException; 5 | import androidx.test.uiautomator.UiSelector; 6 | 7 | import sh.calaba.instrumentationbackend.InstrumentationBackend; 8 | import sh.calaba.instrumentationbackend.Result; 9 | import sh.calaba.instrumentationbackend.actions.Action; 10 | 11 | public class UiautomatorTouchText implements Action { 12 | @Override 13 | public Result execute(String... args) { 14 | UiObject element = InstrumentationBackend.getUiDevice().findObject(new UiSelector().text(args[0])); 15 | try { 16 | element.click(); 17 | } catch (UiObjectNotFoundException e) { 18 | String message = e.getMessage(); 19 | return Result.failedResult(message); 20 | } 21 | return new Result(true); 22 | } 23 | 24 | @Override 25 | public String key() { 26 | return "uiautomator_touch_text"; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/query/CompletedFuture.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.query; 2 | 3 | import java.util.concurrent.ExecutionException; 4 | import java.util.concurrent.Future; 5 | import java.util.concurrent.TimeUnit; 6 | import java.util.concurrent.TimeoutException; 7 | 8 | public class CompletedFuture implements Future { 9 | private final T result; 10 | 11 | public CompletedFuture(final T result) { 12 | this.result = result; 13 | } 14 | 15 | @Override 16 | public boolean cancel(final boolean b) { 17 | return false; 18 | } 19 | 20 | @Override 21 | public boolean isCancelled() { 22 | return false; 23 | } 24 | 25 | @Override 26 | public boolean isDone() { 27 | return true; 28 | } 29 | 30 | @Override 31 | public T get() throws InterruptedException, ExecutionException { 32 | return this.result; 33 | } 34 | 35 | @Override 36 | public T get(long timeout, TimeUnit unit) throws InterruptedException, 37 | ExecutionException, TimeoutException { 38 | return get(); 39 | } 40 | } -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/ResolvableDeserializer.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map; 2 | 3 | /** 4 | * Interface used to indicate deserializers that want to do post-processing 5 | * after construction and being added to {@link DeserializerProvider}, 6 | * but before being used. This is typically used to resolve references 7 | * to other contained types; for example, bean deserializers use this 8 | * to eagerly find deserializers for contained field types. 9 | */ 10 | public interface ResolvableDeserializer 11 | { 12 | /** 13 | * Method called after {@link DeserializerProvider} has registered 14 | * the deserializer, but before it has returned it to the caller. 15 | * Called object can then resolve its dependencies to other types, 16 | * including self-references (direct or indirect). 17 | * 18 | * @param provider Provider that has constructed deserializer this method 19 | * is called on. 20 | */ 21 | public abstract void resolve(DeserializationConfig config, DeserializerProvider provider) 22 | throws JsonMappingException; 23 | } 24 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/actions/device/UiautomatorDragCoordinates.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.actions.device; 2 | 3 | import sh.calaba.instrumentationbackend.InstrumentationBackend; 4 | import sh.calaba.instrumentationbackend.Result; 5 | import sh.calaba.instrumentationbackend.actions.Action; 6 | 7 | public class UiautomatorDragCoordinates implements Action { 8 | @Override 9 | public Result execute(String... args) { 10 | 11 | Integer fromX = new Integer(args[0]); 12 | Integer fromY = new Integer(args[1]); 13 | Integer toX = new Integer(args[2]); 14 | Integer toY = new Integer(args[3]); 15 | Integer stepCount; 16 | 17 | if (args.length > 4) { 18 | stepCount = new Integer(args[4]); 19 | } else { 20 | stepCount = 40; 21 | } 22 | 23 | InstrumentationBackend.getUiDevice().drag(fromX, toX, fromY, toY, stepCount); 24 | 25 | return new Result(true); 26 | } 27 | 28 | @Override 29 | public String key() { 30 | return "uiautomator_drag_coordinates"; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/actions/device/UiautomatorTouchPartialText.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.actions.device; 2 | 3 | import androidx.test.uiautomator.UiObject; 4 | import androidx.test.uiautomator.UiObjectNotFoundException; 5 | import androidx.test.uiautomator.UiSelector; 6 | 7 | import sh.calaba.instrumentationbackend.InstrumentationBackend; 8 | import sh.calaba.instrumentationbackend.Result; 9 | import sh.calaba.instrumentationbackend.actions.Action; 10 | 11 | public class UiautomatorTouchPartialText implements Action { 12 | @Override 13 | public Result execute(String... args) { 14 | UiObject element = InstrumentationBackend.getUiDevice().findObject(new UiSelector().textContains(args[0])); 15 | try { 16 | element.click(); 17 | } catch (UiObjectNotFoundException e) { 18 | String message = e.getMessage(); 19 | return Result.failedResult(message); 20 | } 21 | return new Result(true); 22 | } 23 | 24 | @Override 25 | public String key() { 26 | return "uiautomator_touch_partial_text"; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/deser/std/TimestampDeserializer.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map.deser.std; 2 | 3 | import java.io.IOException; 4 | import java.sql.Timestamp; 5 | 6 | import sh.calaba.org.codehaus.jackson.JsonParser; 7 | import sh.calaba.org.codehaus.jackson.JsonProcessingException; 8 | import sh.calaba.org.codehaus.jackson.map.DeserializationContext; 9 | 10 | /** 11 | * Simple deserializer for handling {@link java.sql.Timestamp} values. 12 | *

13 | * One way to customize Timestamp formats accepted is to override method 14 | * {@link DeserializationContext#parseDate} that this basic 15 | * deserializer calls. 16 | * 17 | * @since 1.9 (moved from higher-level package) 18 | */ 19 | public class TimestampDeserializer 20 | extends StdScalarDeserializer 21 | { 22 | public TimestampDeserializer() { super(Timestamp.class); } 23 | 24 | @Override 25 | public java.sql.Timestamp deserialize(JsonParser jp, DeserializationContext ctxt) 26 | throws IOException, JsonProcessingException 27 | { 28 | return new Timestamp(_parseDate(jp, ctxt).getTime()); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/query/ast/UIQueryVisibility.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.query.ast; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import sh.calaba.instrumentationbackend.query.ui.UIObject; 7 | import sh.calaba.instrumentationbackend.query.ui.UIObjectView; 8 | 9 | public enum UIQueryVisibility implements UIQueryAST { 10 | ALL { 11 | @Override 12 | public List evaluateWithViews(List inputUIObjects, 13 | UIQueryDirection direction, UIQueryVisibility self) { 14 | return new ArrayList(inputUIObjects); 15 | } 16 | }, 17 | 18 | 19 | VISIBLE { 20 | @Override 21 | public List evaluateWithViews(List inputUIObjects, 22 | UIQueryDirection direction, UIQueryVisibility self) { 23 | List filtered = new ArrayList(inputUIObjects.size()); 24 | 25 | for (UIObject uiObject : UIQueryUtils.uniq(inputUIObjects)) { 26 | if (UIQueryUtils.isVisible(uiObject)) { 27 | filtered.add(uiObject); 28 | } 29 | } 30 | return filtered; 31 | } 32 | }; 33 | 34 | } 35 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/jsontype/impl/TypeIdResolverBase.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map.jsontype.impl; 2 | 3 | import sh.calaba.org.codehaus.jackson.map.jsontype.TypeIdResolver; 4 | import sh.calaba.org.codehaus.jackson.map.type.TypeFactory; 5 | import sh.calaba.org.codehaus.jackson.type.JavaType; 6 | 7 | public abstract class TypeIdResolverBase 8 | implements TypeIdResolver 9 | { 10 | protected final TypeFactory _typeFactory; 11 | 12 | /** 13 | * Common base type for all polymorphic instances handled. 14 | */ 15 | protected final JavaType _baseType; 16 | 17 | protected TypeIdResolverBase(JavaType baseType, TypeFactory typeFactory) 18 | { 19 | _baseType = baseType; 20 | _typeFactory = typeFactory; 21 | } 22 | 23 | @Override 24 | public void init(JavaType bt) { 25 | /* Standard type id resolvers do not need this; 26 | * only useful for custom ones. 27 | */ 28 | } 29 | 30 | /** 31 | * @since 1.9.4 32 | */ 33 | public String idFromBaseType() 34 | { 35 | return idFromValueAndType(null, _baseType.getRawClass()); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/annotate/JsonCachable.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map.annotate; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | import sh.calaba.org.codehaus.jackson.annotate.JacksonAnnotation; 9 | 10 | /** 11 | * Marker annotation used to denote whether given instance 12 | * (currently only used with {@link sh.calaba.org.codehaus.jackson.map.JsonDeserializer}) 13 | * can be cached. 14 | *

15 | * Default action to take in absence of annotation depends 16 | * on object using annotation; with deserializers default is 17 | * to assume instances are not cachable. 18 | * 19 | * @since 1.1 20 | */ 21 | @Target({ElementType.TYPE}) 22 | @Retention(RetentionPolicy.RUNTIME) 23 | @JacksonAnnotation 24 | public @interface JsonCachable 25 | { 26 | /** 27 | * Default value is true, giving semantics for parameterless tag instance 28 | * such that empty instance indicates that instances of annotated class 29 | * are indeed cachable. 30 | */ 31 | boolean value() default true; 32 | } 33 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/sym/Name3.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.sym; 2 | 3 | /** 4 | * Specialized implementation of PName: can be used for short Strings 5 | * that consists of 9 to 12 bytes. It's the longest special purpose 6 | * implementaion; longer ones are expressed using {@link NameN}. 7 | */ 8 | public final class Name3 9 | extends Name 10 | { 11 | final int mQuad1; 12 | final int mQuad2; 13 | final int mQuad3; 14 | 15 | Name3(String name, int hash, int q1, int q2, int q3) 16 | { 17 | super(name, hash); 18 | mQuad1 = q1; 19 | mQuad2 = q2; 20 | mQuad3 = q3; 21 | } 22 | 23 | // Implies quad length == 1, never matches 24 | @Override 25 | public boolean equals(int quad) { return false; } 26 | 27 | // Implies quad length == 2, never matches 28 | @Override 29 | public boolean equals(int quad1, int quad2) { return false; } 30 | 31 | @Override 32 | public boolean equals(int[] quads, int qlen) 33 | { 34 | return (qlen == 3) 35 | && (quads[0] == mQuad1) 36 | && (quads[1] == mQuad2) 37 | && (quads[2] == mQuad3); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/actions/preferences/ClearPreferences.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.actions.preferences; 2 | 3 | import sh.calaba.instrumentationbackend.InstrumentationBackend; 4 | import sh.calaba.instrumentationbackend.Result; 5 | import sh.calaba.instrumentationbackend.actions.Action; 6 | import android.content.SharedPreferences; 7 | 8 | /** 9 | * Allows clearing SharedPreferences. 10 | * 11 | * See Ruby API docs for more info: 12 | * https://github.com/calabash/calabash-android/blob/master/documentation/ruby_api.md 13 | * 14 | * @author Juan Delgado (juan@ustwo.co.uk) 15 | */ 16 | public class ClearPreferences implements Action { 17 | 18 | @Override 19 | public Result execute(String... args) { 20 | 21 | try{ 22 | 23 | SharedPreferences preferences = PreferencesUtils.getPreferencesFromArgs(args, InstrumentationBackend.instrumentation.getTargetContext()); 24 | preferences.edit().clear().commit(); 25 | 26 | return Result.successResult(); 27 | 28 | } catch(Exception e) { 29 | return Result.fromThrowable(e); 30 | } 31 | } 32 | 33 | @Override 34 | public String key() { 35 | return "clear_preferences"; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /azure-pipelines.yml: -------------------------------------------------------------------------------- 1 | trigger: 2 | batch: true 3 | branches: 4 | include: 5 | - master 6 | - develop 7 | 8 | variables: 9 | - name: EOCompliance-Mac 10 | value: true 11 | 12 | pr: 13 | - master 14 | - develop 15 | 16 | jobs: 17 | - job: 18 | strategy: 19 | matrix: 20 | Mojave: 21 | IMAGE_POOL: 'macOS-11' 22 | # Android Emulator is not available on Ubuntu 23 | # Ubuntu-16: 24 | # IMAGE_POOL: 'ubuntu-16.04' 25 | pool: 26 | vmImage: $(IMAGE_POOL) 27 | 28 | steps: 29 | - task: Gradle@2 30 | inputs: 31 | workingDirectory: 'server/' 32 | gradleWrapperFile: 'server/gradlew' 33 | gradleOptions: '-Xmx3072m' 34 | publishJUnitResults: false 35 | tasks: 'assembleAndroidTest' 36 | displayName: "Build TestServer.apk" 37 | 38 | - script: bin/ci/ado/install-android-sdk.sh 39 | displayName: "Install Android Sdk" 40 | 41 | - script: bin/ci/ado/start-emulator.sh 42 | displayName: "Start Emulator" 43 | 44 | # TODO: publish cucumber report 45 | # - server/integration-tests/test-report/*.xml 46 | - script: | 47 | cd server/integration-tests 48 | ./test.sh --skip-build 49 | displayName: "$(IMAGE_POOL) - Integration Tests" 50 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/query/ast/ContainsRelation.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.query.ast; 2 | 3 | public class ContainsRelation implements UIQueryASTPredicateRelation { 4 | 5 | private final boolean caseSensitive; 6 | 7 | public ContainsRelation(boolean isCaseSensitive) { 8 | super(); 9 | this.caseSensitive = isCaseSensitive; 10 | } 11 | 12 | public boolean isCaseSensitive() { 13 | return caseSensitive; 14 | } 15 | 16 | /** 17 | * Does firstValue CONTAIN secondValue? 18 | */ 19 | @Override 20 | public boolean areRelated(Object firstValue, Object secondValue) { 21 | if (firstValue == secondValue) { 22 | return true; 23 | } 24 | if (firstValue == null || secondValue == null) { 25 | return false; 26 | } 27 | if (firstValue instanceof CharSequence && secondValue instanceof CharSequence) { 28 | String firstStr = firstValue.toString(); 29 | String secondStr = secondValue.toString(); 30 | if (!isCaseSensitive()) { 31 | firstStr = firstStr.toLowerCase(); 32 | secondStr = secondStr.toLowerCase(); 33 | } 34 | return firstStr.indexOf(secondStr) != -1; 35 | } 36 | else { 37 | return false; 38 | } 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/annotate/JacksonInject.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map.annotate; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | import sh.calaba.org.codehaus.jackson.annotate.JacksonAnnotation; 9 | 10 | /** 11 | * Jackson-specific annotation used for indicating that value of 12 | * annotated property will be "injected", i.e. set based on value 13 | * configured by ObjectMapper (usually on per-call basis). 14 | * Usually property is not deserialized from JSON, although it possible 15 | * to have injected value as default and still allow optional override 16 | * from JSON. 17 | * 18 | * @since 1.9 19 | */ 20 | @Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER}) 21 | @Retention(RetentionPolicy.RUNTIME) 22 | @JacksonAnnotation 23 | public @interface JacksonInject 24 | { 25 | /** 26 | * Logical id of the value to inject; if not specified (or specified 27 | * as empty String), will use id based on declared type of property. 28 | */ 29 | public String value() default ""; 30 | } 31 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/query/ast/EndsWithRelation.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.query.ast; 2 | 3 | public class EndsWithRelation implements UIQueryASTPredicateRelation { 4 | 5 | private final boolean caseSensitive; 6 | 7 | public EndsWithRelation(boolean isCaseSensitive) { 8 | super(); 9 | this.caseSensitive = isCaseSensitive; 10 | } 11 | 12 | public boolean isCaseSensitive() { 13 | return caseSensitive; 14 | } 15 | 16 | 17 | /** 18 | * Does firstValue END WITH secondValue? 19 | */ 20 | @Override 21 | public boolean areRelated(Object firstValue, Object secondValue) { 22 | if (firstValue == secondValue) { 23 | return true; 24 | } 25 | if (firstValue == null || secondValue == null) { 26 | return false; 27 | } 28 | if (firstValue instanceof CharSequence && secondValue instanceof CharSequence) { 29 | String firstStr = firstValue.toString(); 30 | String secondStr = secondValue.toString(); 31 | if (!isCaseSensitive()) { 32 | firstStr = firstStr.toLowerCase(); 33 | secondStr = secondStr.toLowerCase(); 34 | } 35 | return firstStr.endsWith(secondStr); 36 | } 37 | else { 38 | return false; 39 | } 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/actions/view/ExecuteOnView.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.actions.view; 2 | 3 | import java.util.List; 4 | 5 | import sh.calaba.instrumentationbackend.Result; 6 | import sh.calaba.instrumentationbackend.query.Query; 7 | import sh.calaba.instrumentationbackend.query.ui.UIObject; 8 | 9 | /** 10 | * Created by john7doe on 06/01/15. 11 | */ 12 | public class ExecuteOnView { 13 | public Result execute(IOnViewAction onViewAction, String... args) { 14 | if (args.length != 1) { 15 | return Result.failedResult("Query for identifying view must be provided."); 16 | } 17 | 18 | final String message; 19 | 20 | try { 21 | Query query = new Query(args[0]); 22 | List uiObjects = query.uiObjectsForQuery(); 23 | 24 | if (uiObjects.isEmpty()) { 25 | return Result.failedResult("Query found no view(s)."); 26 | } 27 | 28 | message = onViewAction.getUIQueryMatcher(uiObjects.get(0)).call(); 29 | } catch (Exception e) { 30 | return Result.fromThrowable(e); 31 | } 32 | 33 | return new Result(true, message); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/KeyDeserializer.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map; 2 | 3 | import java.io.IOException; 4 | 5 | import sh.calaba.org.codehaus.jackson.JsonProcessingException; 6 | 7 | /** 8 | * Abstract class that defines API used for deserializing JSON content 9 | * field names into Java Map keys. These deserializers are only used 10 | * if the Map key class is not String or Object. 11 | */ 12 | public abstract class KeyDeserializer 13 | { 14 | /** 15 | * Method called to deserialize a {@link java.util.Map} key from JSON property name. 16 | */ 17 | public abstract Object deserializeKey(String key, DeserializationContext ctxt) 18 | throws IOException, JsonProcessingException; 19 | 20 | /** 21 | * This marker class is only to be used with annotations, to 22 | * indicate that no deserializer is configured. 23 | *

24 | * Specifically, this class is to be used as the marker for 25 | * annotation {@link sh.calaba.org.codehaus.jackson.map.annotate.JsonDeserialize}. 26 | * 27 | * @since 1.3 28 | */ 29 | public abstract static class None 30 | extends KeyDeserializer { } 31 | } 32 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/sym/Name2.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.sym; 2 | 3 | /** 4 | * Specialized implementation of PName: can be used for short Strings 5 | * that consists of 5 to 8 bytes. Usually this means relatively short 6 | * ascii-only names. 7 | *

8 | * The reason for such specialized classes is mostly space efficiency; 9 | * and to a lesser degree performance. Both are achieved for short 10 | * Strings by avoiding another level of indirection (via quad arrays) 11 | */ 12 | public final class Name2 13 | extends Name 14 | { 15 | final int mQuad1; 16 | 17 | final int mQuad2; 18 | 19 | Name2(String name, int hash, int quad1, int quad2) 20 | { 21 | super(name, hash); 22 | mQuad1 = quad1; 23 | mQuad2 = quad2; 24 | } 25 | 26 | @Override 27 | public boolean equals(int quad) { return false; } 28 | 29 | @Override 30 | public boolean equals(int quad1, int quad2) 31 | { 32 | return (quad1 == mQuad1) && (quad2 == mQuad2); 33 | } 34 | 35 | @Override 36 | public boolean equals(int[] quads, int qlen) 37 | { 38 | return (qlen == 2 && quads[0] == mQuad1 && quads[1] == mQuad2); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/ClearAppData3.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend; 2 | 3 | import android.os.Bundle; 4 | import android.test.InstrumentationTestRunner; 5 | 6 | import sh.calaba.instrumentationbackend.utils.MonoUtils; 7 | import sh.calaba.instrumentationbackend.utils.StringUtils; 8 | 9 | import static sh.calaba.instrumentationbackend.InstrumentationStatus.SUCCESSFUL; 10 | import static sh.calaba.instrumentationbackend.InstrumentationStatus.FAILED; 11 | 12 | public class ClearAppData3 extends InstrumentationTestRunner { 13 | 14 | private static final String DISPLAY_NAME = "ClearAppData3"; 15 | 16 | @Override 17 | public void onCreate(Bundle arguments) { 18 | MonoUtils.loadMono(getTargetContext()); 19 | 20 | try { 21 | Cleaner cleaner = new Cleaner(); 22 | cleaner.clearAppData(getTargetContext()); 23 | } catch (Exception e) { 24 | InstrumentationReport.send(this, DISPLAY_NAME, FAILED, StringUtils.toString(e)); 25 | finish(FAILED.resultCode, null); 26 | } 27 | 28 | InstrumentationReport.send(this, DISPLAY_NAME, SUCCESSFUL, null); 29 | finish(SUCCESSFUL.resultCode, null); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/annotate/JsonFilter.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map.annotate; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | import sh.calaba.org.codehaus.jackson.annotate.JacksonAnnotation; 9 | 10 | /** 11 | * Annotation used to indicate which logical filter is to be used 12 | * for filtering out properties of type (class) annotated; 13 | * association made by this annotation declaring ids of filters, 14 | * and {@link sh.calaba.org.codehaus.jackson.map.ObjectMapper} (or objects 15 | * it delegates to) providing matching filters by id. 16 | * Filters to use are of type 17 | * {@link sh.calaba.org.codehaus.jackson.map.ser.BeanPropertyFilter} and 18 | * are registered through {@link sh.calaba.org.codehaus.jackson.map.ObjectMapper} 19 | * 20 | * @since 1.7 21 | */ 22 | @Target(ElementType.TYPE) 23 | @Retention(RetentionPolicy.RUNTIME) 24 | @JacksonAnnotation 25 | public @interface JsonFilter 26 | { 27 | /** 28 | * Id of filter to use; if empty String (""), no filter is to be used. 29 | */ 30 | public String value(); 31 | } 32 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/actions/device/WaitForIdleSync.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.actions.device; 2 | 3 | import java.util.concurrent.CountDownLatch; 4 | import java.util.concurrent.TimeUnit; 5 | 6 | import sh.calaba.instrumentationbackend.InstrumentationBackend; 7 | import sh.calaba.instrumentationbackend.Result; 8 | import sh.calaba.instrumentationbackend.actions.Action; 9 | 10 | public class WaitForIdleSync implements Action { 11 | @Override 12 | public Result execute(String... args) { 13 | final CountDownLatch latch = new CountDownLatch(1); 14 | InstrumentationBackend.instrumentation.waitForIdle(new Runnable() { 15 | @Override 16 | public void run() { 17 | latch.countDown(); 18 | } 19 | }); 20 | try { 21 | latch.await(Integer.parseInt(args[0]), TimeUnit.SECONDS); 22 | } catch (InterruptedException e) { 23 | e.printStackTrace(); 24 | Thread.currentThread().interrupt(); 25 | } 26 | return new Result(latch.getCount() == 0); 27 | } 28 | 29 | @Override 30 | public String key() { 31 | return "wait_for_idle_sync"; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/actions/device/UiautomatorTextDump.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.actions.device; 2 | 3 | import androidx.test.uiautomator.By; 4 | import androidx.test.uiautomator.BySelector; 5 | import androidx.test.uiautomator.UiDevice; 6 | import androidx.test.uiautomator.UiObject2; 7 | 8 | import java.util.ArrayList; 9 | import java.util.List; 10 | 11 | import sh.calaba.instrumentationbackend.InstrumentationBackend; 12 | import sh.calaba.instrumentationbackend.Result; 13 | import sh.calaba.instrumentationbackend.actions.Action; 14 | 15 | public class UiautomatorTextDump implements Action { 16 | @Override 17 | public Result execute(String... args) { 18 | UiDevice mDevice = InstrumentationBackend.getUiDevice(); 19 | BySelector selector = By.clazz("android.widget.TextView"); 20 | List mList = mDevice.findObjects(selector); 21 | 22 | ArrayList list = new ArrayList<>(); 23 | 24 | for (UiObject2 ob : mList) { 25 | list.add(ob.getText()); 26 | } 27 | 28 | return new Result(true, list); 29 | } 30 | 31 | @Override 32 | public String key() { 33 | return "uiautomator_text_dump"; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/annotate/JsonTypeResolver.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map.annotate; 2 | 3 | import java.lang.annotation.*; 4 | 5 | import sh.calaba.org.codehaus.jackson.annotate.JacksonAnnotation; 6 | import sh.calaba.org.codehaus.jackson.map.jsontype.TypeResolverBuilder; 7 | 8 | /** 9 | * Annotation that can be used to explicitly define custom resolver 10 | * used for handling serialization and deserialization of type information, 11 | * needed for handling of polymorphic types (or sometimes just for linking 12 | * abstract types to concrete types) 13 | * 14 | * @since 1.5 15 | */ 16 | @Target({ElementType.TYPE}) 17 | @Retention(RetentionPolicy.RUNTIME) 18 | @JacksonAnnotation 19 | public @interface JsonTypeResolver 20 | { 21 | /** 22 | * Defines implementation class of {@link TypeResolverBuilder} which is used to construct 23 | * actual {@link sh.calaba.org.codehaus.jackson.map.TypeDeserializer} and {@link sh.calaba.org.codehaus.jackson.map.TypeDeserializer} 24 | * instances that handle reading and writing addition type information needed to support polymorphic 25 | * deserialization. 26 | */ 27 | public Class> value(); 28 | } 29 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/automation/CalabashAutomationEmbedded.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.automation; 2 | 3 | import android.app.Activity; 4 | import android.app.Application; 5 | import sh.calaba.instrumentationbackend.query.ast.UIQueryUtils; 6 | import sh.calaba.instrumentationbackend.query.ui.UIObjectView; 7 | 8 | import java.util.List; 9 | 10 | /* 11 | Central component. Handles automation for an application running in a single process. 12 | */ 13 | public class CalabashAutomationEmbedded implements CalabashAutomation { 14 | private final ApplicationUnderTest applicationUnderTest; 15 | 16 | public CalabashAutomationEmbedded(ApplicationUnderTest applicationUnderTest) { 17 | this.applicationUnderTest = applicationUnderTest; 18 | } 19 | 20 | @Override 21 | public Activity getCurrentActivity() { 22 | return applicationUnderTest.getCurrentActivity(); 23 | } 24 | 25 | @Override 26 | public Application getCurrentApplication() { 27 | return applicationUnderTest.getApplication(); 28 | } 29 | 30 | @Override 31 | public List getRootViews() { 32 | return UIObjectView.listOfUIObjects(UIQueryUtils.getRootViews()); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/actions/version/Version.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.actions.version; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.IOException; 5 | import java.io.InputStream; 6 | import java.io.InputStreamReader; 7 | 8 | import sh.calaba.instrumentationbackend.InstrumentationBackend; 9 | import sh.calaba.instrumentationbackend.Result; 10 | import sh.calaba.instrumentationbackend.actions.Action; 11 | 12 | public class Version implements Action { 13 | private static final String VersionPath="version"; 14 | 15 | @Override 16 | public Result execute(String... args) { 17 | String version; 18 | 19 | try { 20 | InputStream is = InstrumentationBackend.instrumentation.getContext().getResources().getAssets().open(VersionPath); 21 | BufferedReader input = new BufferedReader(new InputStreamReader(is)); 22 | version = input.readLine(); 23 | } catch (IOException e) { 24 | e.printStackTrace(); 25 | return new Result(false, e.getMessage()); 26 | } 27 | 28 | return new Result(true, version); 29 | } 30 | 31 | @Override 32 | public String key() { 33 | return "version"; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/entrypoint/ApplicationUnderTestInstrumentation.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.entrypoint; 2 | 3 | import android.app.Activity; 4 | import android.app.Application; 5 | import sh.calaba.instrumentationbackend.CalabashInstrumentation; 6 | import sh.calaba.instrumentationbackend.automation.ApplicationUnderTest; 7 | 8 | import java.lang.ref.WeakReference; 9 | import java.util.Iterator; 10 | 11 | public final class ApplicationUnderTestInstrumentation implements ApplicationUnderTest { 12 | private final CalabashInstrumentation calabashInstrumentation; 13 | 14 | public ApplicationUnderTestInstrumentation(CalabashInstrumentation calabashInstrumentation) { 15 | this.calabashInstrumentation = calabashInstrumentation; 16 | } 17 | 18 | @Override 19 | public Application getApplication() { 20 | Activity currentActivity = getCurrentActivity(); 21 | 22 | if (currentActivity != null) { 23 | return currentActivity.getApplication(); 24 | } else { 25 | return null; 26 | } 27 | } 28 | 29 | @Override 30 | public Activity getCurrentActivity() { 31 | return calabashInstrumentation.getLastActivity().get(); 32 | } 33 | } -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/actions/gestures/Swipe.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.actions.gestures; 2 | 3 | import sh.calaba.instrumentationbackend.InstrumentationBackend; 4 | import sh.calaba.instrumentationbackend.Result; 5 | import sh.calaba.instrumentationbackend.actions.Action; 6 | 7 | import com.jayway.android.robotium.solo.Solo; 8 | 9 | public class Swipe implements Action { 10 | 11 | @Override 12 | public Result execute(String... args) { 13 | String direction = args[0]; 14 | 15 | if (args.length == 1) { 16 | if(direction.equalsIgnoreCase("left")) { 17 | InstrumentationBackend.solo.scrollToSide(Solo.LEFT); 18 | return Result.successResult(); 19 | } else if(direction.equalsIgnoreCase("right")) { 20 | InstrumentationBackend.solo.scrollToSide(Solo.RIGHT); 21 | return Result.successResult(); 22 | } 23 | return Result.failedResult("Invalid direction to swipe: " + direction); 24 | } 25 | return Result.failedResult("You must provide a direction. Either 'left' or 'right'"); 26 | } 27 | 28 | @Override 29 | public String key() { 30 | return "swipe"; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/actions/preferences/GetPreferences.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.actions.preferences; 2 | 3 | import sh.calaba.instrumentationbackend.InstrumentationBackend; 4 | import sh.calaba.instrumentationbackend.Result; 5 | import sh.calaba.instrumentationbackend.actions.Action; 6 | import android.content.SharedPreferences; 7 | 8 | /** 9 | * Allows reading of SharedPreferences. 10 | * 11 | * See Ruby API docs for more info: 12 | * https://github.com/calabash/calabash-android/blob/master/documentation/ruby_api.md 13 | * 14 | * @author Juan Delgado (juan@ustwo.co.uk) 15 | */ 16 | public class GetPreferences implements Action { 17 | 18 | @Override 19 | public Result execute(String... args) { 20 | 21 | SharedPreferences preferences = null; 22 | 23 | try{ 24 | preferences = PreferencesUtils.getPreferencesFromArgs(args, InstrumentationBackend.instrumentation.getTargetContext()); 25 | } catch(Exception e){ 26 | return Result.fromThrowable(e); 27 | } 28 | 29 | Result result = Result.successResult(); 30 | PreferencesUtils.addPreferencesToResult(preferences, result); 31 | 32 | return result; 33 | } 34 | 35 | @Override 36 | public String key() { 37 | return "get_preferences"; 38 | } 39 | } -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/actions/gestures/Drag.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.actions.gestures; 2 | 3 | import sh.calaba.instrumentationbackend.InstrumentationBackend; 4 | import sh.calaba.instrumentationbackend.Result; 5 | import sh.calaba.instrumentationbackend.actions.Action; 6 | 7 | import android.util.DisplayMetrics; 8 | 9 | public class Drag implements Action { 10 | 11 | @Override 12 | public Result execute(String... args) { 13 | 14 | Float fromX = new Float(args[0]); 15 | Float toX = new Float(args[1]); 16 | Float fromY = new Float(args[2]); 17 | Float toY = new Float(args[3]); 18 | Integer stepCount = new Integer(args[4]); 19 | 20 | DisplayMetrics dm = new DisplayMetrics(); 21 | InstrumentationBackend.solo.getCurrentActivity().getWindowManager() 22 | .getDefaultDisplay().getMetrics(dm); 23 | Integer windowWidth = dm.widthPixels; 24 | Integer windowHeight = dm.heightPixels; 25 | 26 | InstrumentationBackend.solo.drag(fromX / 100 * windowWidth, 27 | toX / 100 * windowWidth, 28 | fromY / 100 * windowHeight, 29 | toY / 100 * windowHeight, 30 | stepCount); 31 | 32 | return Result.successResult(); 33 | } 34 | 35 | @Override 36 | public String key() { 37 | return "drag"; 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/json/JSONUtils.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.json; 2 | 3 | import java.io.IOException; 4 | import java.util.Map; 5 | 6 | import sh.calaba.org.codehaus.jackson.map.ObjectMapper; 7 | import sh.calaba.org.codehaus.jackson.map.SerializationConfig; 8 | import sh.calaba.org.codehaus.jackson.JsonNode; 9 | 10 | public class JSONUtils { 11 | 12 | public static String asJson(Map map) { 13 | ObjectMapper mapper = new ObjectMapper(); 14 | mapper.configure(SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS, false); 15 | try { 16 | return mapper.writeValueAsString(map); 17 | } catch (IOException e) { 18 | throw new RuntimeException("Could not convert result to json: "+map, e); 19 | } 20 | } 21 | 22 | public static ObjectMapper calabashObjectMapper() { 23 | ObjectMapper objectMapper = new ObjectMapper(); 24 | objectMapper.registerModule(new CustomAndroidModule()); 25 | 26 | return objectMapper; 27 | } 28 | 29 | public static boolean isJson(String string) { 30 | final ObjectMapper jsonMapper = new ObjectMapper(); 31 | try { 32 | jsonMapper.readValue(string, JsonNode.class); 33 | } catch (IOException e) { 34 | return false; 35 | } 36 | return true; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/actions/l10n/L10nHelper.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.actions.l10n; 2 | 3 | import android.app.Application; 4 | import sh.calaba.instrumentationbackend.InstrumentationBackend; 5 | 6 | /** 7 | * Helper to access Android L10n files. 8 | * 9 | * @author Dominik Dary 10 | * 11 | */ 12 | public class L10nHelper { 13 | /** 14 | * get the translated value based on the current active locale. 15 | * 16 | * @param l10nKey The l10n key to use 17 | * @param pckg Optional package to find the resource, defaults to the application's package if null 18 | * @return The translated value. 19 | */ 20 | public static String getValue(String l10nKey, String pckg) { 21 | Application application = InstrumentationBackend.getDefaultCalabashAutomation().getCurrentApplication(); 22 | 23 | if (application == null) { 24 | throw new RuntimeException("Application is null"); 25 | } 26 | 27 | if (pckg == null) { 28 | pckg = application.getPackageName(); 29 | } 30 | 31 | int resourceId = 32 | application 33 | .getResources() 34 | .getIdentifier(l10nKey, "string", pckg); 35 | 36 | return application.getResources().getString(resourceId); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/annotate/JsonIgnoreType.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.annotate; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * Marker annotation that indicates that all properties of annotated 10 | * type are to be ignored during serialization and deserialization. 11 | *

12 | * Note: annotation does have boolean 'value' property (which defaults 13 | * to 'true'), so that it is actually possible to override value 14 | * using mix-in annotations. 15 | * 16 | * @since 1.7 17 | */ 18 | @Target({ElementType.TYPE}) 19 | @Retention(RetentionPolicy.RUNTIME) 20 | @JacksonAnnotation 21 | public @interface JsonIgnoreType 22 | { 23 | /** 24 | * Optional argument that defines whether this annotation is active 25 | * or not. The only use for value 'false' if for overriding purposes 26 | * (which is not needed often); most likely it is needed for use 27 | * with "mix-in annotations" ("annotation overrides"). 28 | * For most cases, however, default value of "true" is just fine 29 | * and should be omitted. 30 | */ 31 | boolean value() default true; 32 | 33 | } 34 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/sym/Name1.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.sym; 2 | 3 | /** 4 | * Specialized implementation of PName: can be used for short Strings 5 | * that consists of at most 4 bytes. Usually this means short 6 | * ascii-only names. 7 | *

8 | * The reason for such specialized classes is mostly space efficiency; 9 | * and to a lesser degree performance. Both are achieved for short 10 | * Strings by avoiding another level of indirection (via quad arrays) 11 | */ 12 | public final class Name1 13 | extends Name 14 | { 15 | final static Name1 sEmptyName = new Name1("", 0, 0); 16 | 17 | final int mQuad; 18 | 19 | Name1(String name, int hash, int quad) 20 | { 21 | super(name, hash); 22 | mQuad = quad; 23 | } 24 | 25 | final static Name1 getEmptyName() { return sEmptyName; } 26 | 27 | @Override 28 | public boolean equals(int quad) 29 | { 30 | return (quad == mQuad); 31 | } 32 | 33 | @Override 34 | public boolean equals(int quad1, int quad2) 35 | { 36 | return (quad1 == mQuad) && (quad2 == 0); 37 | } 38 | 39 | @Override 40 | public boolean equals(int[] quads, int qlen) 41 | { 42 | return (qlen == 1 && quads[0] == mQuad); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/actions/gestures/ResumeApplication.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.actions.gestures; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | 6 | import sh.calaba.instrumentationbackend.InstrumentationBackend; 7 | import sh.calaba.instrumentationbackend.Result; 8 | import sh.calaba.instrumentationbackend.ResumeTaskActivity; 9 | import sh.calaba.instrumentationbackend.actions.Action; 10 | 11 | public class ResumeApplication implements Action { 12 | @Override 13 | public Result execute(String... args) { 14 | if (args.length != 1) { 15 | return Result.failedResult("This action takes one argument ([String] package)"); 16 | } 17 | 18 | String packageName = args[0]; 19 | Context context = InstrumentationBackend.instrumentation.getContext(); 20 | 21 | Intent intent = new Intent(context, ResumeTaskActivity.class); 22 | intent.putExtra(ResumeTaskActivity.EXTRA_PACKAGE_NAME, packageName); 23 | intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 24 | context.startActivity(intent); 25 | 26 | return Result.successResult(); 27 | } 28 | 29 | @Override 30 | public String key() { 31 | return "resume_application"; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/query/ast/BeginsWithRelation.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.query.ast; 2 | 3 | import android.annotation.SuppressLint; 4 | 5 | public class BeginsWithRelation implements UIQueryASTPredicateRelation { 6 | 7 | private final boolean caseSensitive; 8 | 9 | public BeginsWithRelation(boolean isCaseSensitive) { 10 | super(); 11 | this.caseSensitive = isCaseSensitive; 12 | } 13 | 14 | 15 | public boolean isCaseSensitive() { 16 | return caseSensitive; 17 | } 18 | 19 | /** 20 | * Does firstValue BEGIN WITH secondValue? 21 | */ 22 | @SuppressLint("DefaultLocale") 23 | @Override 24 | public boolean areRelated(Object firstValue, Object secondValue) { 25 | if (firstValue == secondValue) { 26 | return true; 27 | } 28 | if (firstValue == null || secondValue == null) { 29 | return false; 30 | } 31 | if (firstValue instanceof CharSequence && secondValue instanceof CharSequence) { 32 | String firstStr = firstValue.toString(); 33 | String secondStr = secondValue.toString(); 34 | if (!isCaseSensitive()) { 35 | firstStr = firstStr.toLowerCase(); 36 | secondStr = secondStr.toLowerCase(); 37 | } 38 | return firstStr.startsWith(secondStr); 39 | } 40 | else { 41 | return false; 42 | } 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/ClearPreferences.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend; 2 | 3 | import sh.calaba.instrumentationbackend.actions.preferences.PreferencesUtils; 4 | import sh.calaba.instrumentationbackend.utils.MonoUtils; 5 | 6 | import android.content.SharedPreferences; 7 | import android.os.Bundle; 8 | import android.test.InstrumentationTestRunner; 9 | import android.util.Log; 10 | 11 | /** 12 | * Allows clearing SharedPreferences. 13 | * 14 | * See Ruby API docs for more info: 15 | * https://github.com/calabash/calabash-android/blob/master/documentation/ruby_api.md 16 | * 17 | * @author Juan Delgado (juan@ustwo.co.uk) 18 | */ 19 | public class ClearPreferences extends InstrumentationTestRunner { 20 | 21 | @Override 22 | public void onCreate(Bundle arguments) { 23 | MonoUtils.loadMono(getTargetContext()); 24 | 25 | SharedPreferences preferences = null; 26 | 27 | try{ 28 | preferences = PreferencesUtils.getPreferencesFromBundle(arguments, getTargetContext()); 29 | } catch(Exception e){ 30 | e.printStackTrace(); 31 | return; 32 | } 33 | 34 | preferences.edit().clear().commit(); 35 | 36 | String logcat = arguments.getString(PreferencesUtils.BUNDLE_LOGCAT_ID); 37 | Log.d(logcat, PreferencesUtils.resultToJson(Result.successResult())); 38 | } 39 | } -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/deser/std/StdScalarDeserializer.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map.deser.std; 2 | 3 | import java.io.IOException; 4 | 5 | import sh.calaba.org.codehaus.jackson.JsonParser; 6 | import sh.calaba.org.codehaus.jackson.JsonProcessingException; 7 | import sh.calaba.org.codehaus.jackson.map.DeserializationContext; 8 | import sh.calaba.org.codehaus.jackson.map.TypeDeserializer; 9 | import sh.calaba.org.codehaus.jackson.type.JavaType; 10 | 11 | /** 12 | * Base class for deserializers that handle types that are serialized 13 | * as JSON scalars (non-structured, i.e. non-Object, non-Array, values). 14 | * 15 | * @since 1.9 (moved from higher-level package) 16 | */ 17 | public abstract class StdScalarDeserializer extends StdDeserializer 18 | { 19 | protected StdScalarDeserializer(Class vc) { 20 | super(vc); 21 | } 22 | 23 | protected StdScalarDeserializer(JavaType valueType) { 24 | super(valueType); 25 | } 26 | 27 | @Override 28 | public Object deserializeWithType(JsonParser jp, DeserializationContext ctxt, 29 | TypeDeserializer typeDeserializer) 30 | throws IOException, JsonProcessingException 31 | { 32 | return typeDeserializer.deserializeTypedFromScalar(jp, ctxt); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /server/integration-tests/03-build-test-apk.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | source log.sh 5 | 6 | banner "Building unit-tester.apk" 7 | 8 | rm -rf resources/tmp 9 | mkdir -p resources/tmp 10 | 11 | DX="${ANDROID_BUILD_TOOLS}/dx" 12 | CALABASH="${PWD}/libs/build/Calabash.jar" 13 | HAMCREST="${PWD}/libs/hamcrest-core-1.3.jar" 14 | JUNIT="${PWD}/libs/junit-4.12.jar" 15 | TESTS="${PWD}/out/CalabashIntegrationTests.jar" 16 | 17 | TARGET_APK="${PWD}/unit-tester-new.apk" 18 | 19 | cp "resources/unit-tester.apk" "resources/tmp/unit-tester.apk" 20 | info "Staged resources/unit-tester.apk to resources/tmp" 21 | pushd resources/tmp > /dev/null 22 | unzip -q "unit-tester.apk" 23 | rm "unit-tester.apk" 24 | mkdir -p assets 25 | pushd assets > /dev/null 26 | info "Installing new jars" 27 | rm -rf jars 28 | mkdir jars 29 | pushd jars > /dev/null 30 | "${DX}" --dex --output "1_Calabash.jar" "${CALABASH}" 31 | "${DX}" --dex --output "2_hamcrest-core-1.3.jar" "${HAMCREST}" 32 | "${DX}" --dex --output "3_junit-4.12.jar" "${JUNIT}" 33 | "${DX}" --dex --output "4_CalabashIntegrationTests.jar" "${TESTS}" 34 | popd > /dev/null 35 | popd > /dev/null 36 | zip -q "test.apk" -r . 37 | cp "test.apk" "${TARGET_APK}" 38 | info "Installed ${TARGET_APK}" 39 | popd > /dev/null 40 | 41 | rm -r resources/tmp 42 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/Command.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend; 2 | 3 | import java.util.Arrays; 4 | import java.util.concurrent.atomic.AtomicReference; 5 | 6 | import android.os.Looper; 7 | import sh.calaba.instrumentationbackend.actions.Action; 8 | 9 | 10 | 11 | 12 | public class Command { 13 | private String line; 14 | private String command; 15 | private String[] arguments; 16 | 17 | public void setCommand(String command) { 18 | this.command = command; 19 | } 20 | 21 | public void setArguments(String[] arguments) { 22 | this.arguments = arguments; 23 | } 24 | 25 | public String getCommand() { 26 | return command; 27 | } 28 | 29 | public String[] getArguments() { 30 | return arguments; 31 | } 32 | 33 | public void setLine(String line) { 34 | this.line = line; 35 | } 36 | 37 | public String getLine() { 38 | return line; 39 | } 40 | 41 | public String toString() { 42 | return "Command:'Line:" + getLine() + "," + getCommand() + "', arguments:'" + Arrays.toString(getArguments()) + "'"; 43 | } 44 | 45 | public Result execute() { 46 | final Action action = InstrumentationBackend.actions.lookup(getCommand()); 47 | return action.execute(getArguments()); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/actions/gestures/LongPressCoordinate.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.actions.gestures; 2 | 3 | import android.view.Display; 4 | import sh.calaba.instrumentationbackend.InstrumentationBackend; 5 | import sh.calaba.instrumentationbackend.Result; 6 | import sh.calaba.instrumentationbackend.actions.Action; 7 | 8 | /** 9 | *

10 | * Action that performs a long press on given coordinates. 11 | *

12 | *

13 | * Parameters: 14 | *

    15 | *
  • args[0]: x coordinate (float)
  • 16 | *
  • args[1]: y coordinate (float)
  • 17 | *
  • args[2]: length of the long press in millisecond (optional, integer)
  • 18 | *
19 | *

20 | */ 21 | public class LongPressCoordinate implements Action { 22 | @Override 23 | public Result execute(String... args) { 24 | float x = Float.parseFloat(args[0]); 25 | float y = Float.parseFloat(args[1]); 26 | if (args.length > 2) { 27 | int time = Integer.parseInt(args[2]); 28 | InstrumentationBackend.solo.clickLongOnScreen(x, y, time); 29 | } else { 30 | InstrumentationBackend.solo.clickLongOnScreen(x, y); 31 | } 32 | 33 | return Result.successResult(); 34 | } 35 | 36 | @Override 37 | public String key() { 38 | return "long_press_coordinate"; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /server/integration-tests/test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | source log.sh 5 | 6 | export ANDROID_PLATFORM="${ANDROID_HOME}/platforms/android-28" 7 | if [ ! -d "${ANDROID_PLATFORM}" ]; then 8 | error "Missing ${ANDROID_PLATFORM}" 9 | error "Install with Android Studio" 10 | exit 1 11 | fi 12 | 13 | export ANDROID_BUILD_TOOLS="${ANDROID_HOME}/build-tools/28.0.3" 14 | if [ ! -d "${ANDROID_BUILD_TOOLS}" ]; then 15 | error "Missing ${ANDROID_BUILD_TOOLS}" 16 | error "Install with Android Studio" 17 | exit 1 18 | fi 19 | 20 | info "Using JAVA_HOME=${JAVA_HOME}" 21 | info "Using ANDROID_HOME=${ANDROID_HOME}" 22 | info "Using ANDROID_PLATFORM=${ANDROID_PLATFORM}" 23 | info "Using ANDROID_BUILD_TOOLS=${ANDROID_BUILD_TOOLS}" 24 | 25 | # Stage calabash-android sources. Build the latest TestServer.apk 26 | # and install into the calabash-android sources. TestServer.apk 27 | # will be used later in the tests. Passing --skip-build will 28 | # skip a rebuild of the TestServer.apk 29 | ./00-install-latest-test-server.sh ${1} 30 | 31 | # Create a .jar file from Calabash sources - used to compile server unit tests. 32 | ./01-compile-calabash.sh 33 | 34 | # Create a .jar file from integration test sources. 35 | ./02-compile-tests.sh 36 | 37 | # Build unit-tester.apk 38 | ./03-build-test-apk.sh 39 | 40 | # Run the tests 41 | ./04-run-tests.sh 42 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/deser/std/ContainerDeserializerBase.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map.deser.std; 2 | 3 | import sh.calaba.org.codehaus.jackson.map.JsonDeserializer; 4 | import sh.calaba.org.codehaus.jackson.type.JavaType; 5 | 6 | /** 7 | * Intermediate base deserializer class that adds more shared accessor 8 | * so that other classes can access information about contained (value) 9 | * types 10 | * 11 | * @since 1.9 (renamed from 'sh.calaba.org.codehaus.jackson.map.deser.ContainerDeserializer') 12 | */ 13 | public abstract class ContainerDeserializerBase 14 | extends StdDeserializer 15 | { 16 | protected ContainerDeserializerBase(Class selfType) 17 | { 18 | super(selfType); 19 | } 20 | 21 | /* 22 | /********************************************************** 23 | /* Extended API 24 | /********************************************************** 25 | */ 26 | 27 | /** 28 | * Accessor for declared type of contained value elements; either exact 29 | * type, or one of its supertypes. 30 | */ 31 | public abstract JavaType getContentType(); 32 | 33 | /** 34 | * Accesor for deserializer use for deserializing content values. 35 | */ 36 | public abstract JsonDeserializer getContentDeserializer(); 37 | } 38 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/actions/gestures/DragLeaveKeyboard.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.actions.gestures; 2 | 3 | import android.util.DisplayMetrics; 4 | 5 | import sh.calaba.instrumentationbackend.InstrumentationBackend; 6 | import sh.calaba.instrumentationbackend.Result; 7 | import sh.calaba.instrumentationbackend.actions.Action; 8 | 9 | public class DragLeaveKeyboard implements Action { 10 | 11 | @Override 12 | public Result execute(String... args) { 13 | 14 | Float fromX = new Float(args[0]); 15 | Float toX = new Float(args[1]); 16 | Float fromY = new Float(args[2]); 17 | Float toY = new Float(args[3]); 18 | Integer stepCount = new Integer(args[4]); 19 | 20 | DisplayMetrics dm = new DisplayMetrics(); 21 | InstrumentationBackend.solo.getCurrentActivity().getWindowManager() 22 | .getDefaultDisplay().getMetrics(dm); 23 | Integer windowWidth = dm.widthPixels; 24 | Integer windowHeight = dm.heightPixels; 25 | 26 | InstrumentationBackend.solo.drag_without_hiding_keyboard(fromX / 100 * windowWidth, 27 | toX / 100 * windowWidth, 28 | fromY / 100 * windowHeight, 29 | toY / 100 * windowHeight, 30 | stepCount); 31 | 32 | return Result.successResult(); 33 | } 34 | 35 | @Override 36 | public String key() { 37 | return "drag_leave_keyboard"; 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/ser/std/StringSerializer.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map.ser.std; 2 | 3 | import java.io.IOException; 4 | import java.lang.reflect.Type; 5 | 6 | import sh.calaba.org.codehaus.jackson.JsonGenerationException; 7 | import sh.calaba.org.codehaus.jackson.JsonGenerator; 8 | import sh.calaba.org.codehaus.jackson.JsonNode; 9 | import sh.calaba.org.codehaus.jackson.map.SerializerProvider; 10 | import sh.calaba.org.codehaus.jackson.map.annotate.JacksonStdImpl; 11 | 12 | /** 13 | * This is the special serializer for regular {@link java.lang.String}s. 14 | *

15 | * Since this is one of "native" types, no type information is ever 16 | * included on serialization (unlike for most scalar types as of 1.5) 17 | */ 18 | @JacksonStdImpl 19 | public final class StringSerializer 20 | extends NonTypedScalarSerializerBase 21 | { 22 | public StringSerializer() { super(String.class); } 23 | 24 | @Override 25 | public void serialize(String value, JsonGenerator jgen, SerializerProvider provider) 26 | throws IOException, JsonGenerationException 27 | { 28 | jgen.writeString(value); 29 | } 30 | 31 | @Override 32 | public JsonNode getSchema(SerializerProvider provider, Type typeHint) 33 | { 34 | return createSchemaNode("string", true); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/GetPreferences.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend; 2 | 3 | import sh.calaba.instrumentationbackend.actions.preferences.PreferencesUtils; 4 | import sh.calaba.instrumentationbackend.utils.MonoUtils; 5 | 6 | import android.content.SharedPreferences; 7 | import android.os.Bundle; 8 | import android.test.InstrumentationTestRunner; 9 | import android.util.Log; 10 | 11 | /** 12 | * Allows reading of SharedPreferences. 13 | * 14 | * See Ruby API docs for more info: 15 | * https://github.com/calabash/calabash-android/blob/master/documentation/ruby_api.md 16 | * 17 | * @author Juan Delgado (juan@ustwo.co.uk) 18 | */ 19 | public class GetPreferences extends InstrumentationTestRunner { 20 | 21 | @Override 22 | public void onCreate(Bundle arguments) { 23 | MonoUtils.loadMono(getTargetContext()); 24 | 25 | SharedPreferences preferences = null; 26 | 27 | try{ 28 | preferences = PreferencesUtils.getPreferencesFromBundle(arguments, getTargetContext()); 29 | } catch(Exception e){ 30 | e.printStackTrace(); 31 | return; 32 | } 33 | 34 | Result result = Result.successResult(); 35 | PreferencesUtils.addPreferencesToResult(preferences, result); 36 | 37 | String logcat = arguments.getString(PreferencesUtils.BUNDLE_LOGCAT_ID); 38 | Log.d(logcat, PreferencesUtils.resultToJson(result)); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/annotate/JsonWriteNullProperties.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.annotate; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * Annotation that can be used to define whether object properties 10 | * that have null values are to be written out when serializing 11 | * content as JSON. This affects Bean and Map serialization. 12 | *

13 | * Annotation can be used with Classes (all instances of 14 | * given class) and Methods. 15 | *

16 | * Default value for this property is 'true', meaning that null 17 | * properties are written. 18 | *

19 | * @deprecated (since 1.6) Currently recommended annotation to use is 20 | * {@link sh.calaba.org.codehaus.jackson.map.annotate.JsonSerialize#include()} 21 | * (with values ALWAYS or NON_NULL) 22 | */ 23 | @Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD}) 24 | @Retention(RetentionPolicy.RUNTIME) 25 | @JacksonAnnotation 26 | @Deprecated 27 | public @interface JsonWriteNullProperties 28 | { 29 | /** 30 | * Whether properties for beans of annotated type will always be 31 | * written (true), or only if not null (false). 32 | */ 33 | boolean value() default true; 34 | } 35 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/ser/BeanPropertyFilter.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map.ser; 2 | 3 | import sh.calaba.org.codehaus.jackson.JsonGenerator; 4 | import sh.calaba.org.codehaus.jackson.map.SerializerProvider; 5 | 6 | /** 7 | * Interface that defines API for filter objects use (as configured 8 | * using {@link sh.calaba.org.codehaus.jackson.map.annotate.JsonFilter}) 9 | * for filtering bean properties to serialize. 10 | * 11 | * @since 1.7 12 | */ 13 | public interface BeanPropertyFilter 14 | { 15 | /** 16 | * Method called by {@link BeanSerializer} to let filter decide what to do with 17 | * given bean property value: the usual choices are to either filter out (i.e. 18 | * do nothing) or write using given {@link BeanPropertyWriter}, although filters 19 | * can choose other to do something different altogether. 20 | * 21 | * @param bean Bean of which property value to serialize 22 | * @param jgen Generator use for serializing value 23 | * @param prov Provider that can be used for accessing dynamic aspects of serialization 24 | * processing 25 | * @param writer Default bean property serializer to use 26 | */ 27 | public void serializeAsField(Object bean, JsonGenerator jgen, SerializerProvider prov, 28 | BeanPropertyWriter writer) 29 | throws Exception; 30 | } 31 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/actions/view/IsCurrentActivityFocused.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.actions.view; 2 | 3 | import sh.calaba.instrumentationbackend.InstrumentationBackend; 4 | import sh.calaba.instrumentationbackend.Result; 5 | import sh.calaba.instrumentationbackend.actions.Action; 6 | import android.app.Activity; 7 | 8 | /** 9 | * This action checks that the current activity under test has the focus. 10 | * 11 | * This is useful to run tests across different applications (for example, 12 | * your application launching the browser). Since the instrumentation can 13 | * only work with the application under test, then all we can assert is that 14 | * said application has lost the focus. 15 | * 16 | * @author Gianpiero Puleo (gianpi@ustwo.co.uk) 17 | * @author Juan Delgado (juan@ustwo.co.uk) 18 | */ 19 | @SuppressWarnings("deprecation") 20 | public class IsCurrentActivityFocused implements Action { 21 | 22 | @Override 23 | public Result execute(String... args) { 24 | 25 | Activity currentActivity = InstrumentationBackend.getCurrentActivity(); 26 | 27 | String hasFocus = "false"; 28 | 29 | if (currentActivity.hasWindowFocus()) { 30 | hasFocus = "true"; 31 | } 32 | 33 | return new Result(true, hasFocus); 34 | } 35 | 36 | @Override 37 | public String key() { 38 | return "is_current_activity_focused"; 39 | } 40 | } -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Main public API classes of the core streaming JSON 3 | * processor: most importantly {@link sh.calaba.org.codehaus.jackson.JsonFactory} 4 | * used for constructing 5 | * JSON parser ({@link sh.calaba.org.codehaus.jackson.JsonParser}) 6 | * and generator 7 | * ({@link sh.calaba.org.codehaus.jackson.JsonParser}) 8 | * instances. 9 | *

10 | * Public API of the higher-level mapping interfaces ("Mapping API") 11 | * is found from 12 | * under {@link sh.calaba.org.codehaus.jackson.map} and not included here, 13 | * except for following base interfaces: 14 | *

    15 | *
  • {@link sh.calaba.org.codehaus.jackson.JsonNode} is included 16 | *within Streaming API to support integration of the Tree Model 17 | *(which is based on JsonNode) with the basic 18 | *parsers and generators (iff using mapping-supporting factory: which 19 | *is part of Mapping API, not core) 20 | *
  • 21 | *
  • {@link sh.calaba.org.codehaus.jackson.ObjectCodec} is included so that 22 | * reference to the object capable of serializing/deserializing 23 | * Objects to/from JSON (usually, {@link sh.calaba.org.codehaus.jackson.map.ObjectMapper}) 24 | * can be exposed, without adding direct dependency to implementation. 25 | *
  • 26 | *
27 | * 28 | */ 29 | 30 | package sh.calaba.org.codehaus.jackson; 31 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/annotate/JsonTypeIdResolver.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map.annotate; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | import sh.calaba.org.codehaus.jackson.annotate.JacksonAnnotation; 9 | import sh.calaba.org.codehaus.jackson.map.jsontype.TypeIdResolver; 10 | 11 | /** 12 | * Annotation that can be used to plug a custom type identifier handler 13 | * ({@link TypeIdResolver}) 14 | * to be used by 15 | * {@link sh.calaba.org.codehaus.jackson.map.TypeSerializer}s 16 | * and {@link sh.calaba.org.codehaus.jackson.map.TypeDeserializer}s 17 | * for converting between java types and type id included in JSON content. 18 | * In simplest cases this can be a simple class with static mapping between 19 | * type names and matching classes. 20 | * 21 | * @author tatu 22 | * @since 1.5 23 | */ 24 | @Target({ElementType.TYPE}) 25 | @Retention(RetentionPolicy.RUNTIME) 26 | @JacksonAnnotation 27 | public @interface JsonTypeIdResolver 28 | { 29 | /** 30 | * Defines implementation class of {@link TypeIdResolver} to use for 31 | * converting between external type id (type name) and actual 32 | * type of object. 33 | */ 34 | public Class value(); 35 | } 36 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/ser/std/NullSerializer.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map.ser.std; 2 | 3 | import java.lang.reflect.Type; 4 | import java.io.IOException; 5 | 6 | import sh.calaba.org.codehaus.jackson.*; 7 | import sh.calaba.org.codehaus.jackson.map.*; 8 | import sh.calaba.org.codehaus.jackson.map.annotate.JacksonStdImpl; 9 | 10 | /** 11 | * This is a simple dummy serializer that will just output literal 12 | * JSON null value whenever serialization is requested. 13 | * Used as the default "null serializer" (which is used for serializing 14 | * null object references unless overridden), as well as for some 15 | * more exotic types (java.lang.Void). 16 | */ 17 | @JacksonStdImpl 18 | public class NullSerializer 19 | extends SerializerBase 20 | { 21 | public final static NullSerializer instance = new NullSerializer(); 22 | 23 | private NullSerializer() { super(Object.class); } 24 | 25 | @Override 26 | public void serialize(Object value, JsonGenerator jgen, SerializerProvider provider) 27 | throws IOException, JsonGenerationException 28 | { 29 | jgen.writeNull(); 30 | } 31 | 32 | @Override 33 | public JsonNode getSchema(SerializerProvider provider, Type typeHint) 34 | throws JsonMappingException 35 | { 36 | return createSchemaNode("null"); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/actions/device/DpToDevicePixel.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.actions.device; 2 | 3 | import android.content.Context; 4 | import android.content.res.Resources; 5 | import android.util.TypedValue; 6 | 7 | import sh.calaba.instrumentationbackend.InstrumentationBackend; 8 | import sh.calaba.instrumentationbackend.Result; 9 | import sh.calaba.instrumentationbackend.actions.Action; 10 | 11 | public class DpToDevicePixel implements Action { 12 | @Override 13 | public Result execute(String... args) { 14 | if (args.length != 1) { 15 | return Result.failedResult("This action takes one argument (float pixels)."); 16 | } 17 | 18 | float dip; 19 | 20 | try { 21 | dip = Float.valueOf(args[0]); 22 | } catch (NumberFormatException e) { 23 | return Result.failedResult("First argument is not a valid float"); 24 | } 25 | 26 | Context context = InstrumentationBackend.instrumentation.getTargetContext(); 27 | Resources resources = context.getResources(); 28 | float pixels = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dip, resources.getDisplayMetrics()); 29 | 30 | return new Result(true, Float.toString(pixels)); 31 | } 32 | 33 | @Override 34 | public String key() { 35 | return "dp_to_device_pixel"; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/annotate/JsonGetter.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.annotate; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * Marker annotation that can be used to define a non-static, 10 | * no-argument value-returning (non-void) method to be used as a "getter" 11 | * for a logical property, 12 | * as an alternative to recommended 13 | * {@link JsonProperty} annotation (which was introduced in version 1.1). 14 | *

15 | * Getter means that when serializing Object instance of class that has 16 | * this method (possibly inherited from a super class), a call is made 17 | * through the method, and return value will be serialized as value of 18 | * the property. 19 | * 20 | * @deprecated Use {@link JsonProperty} instead (deprecated since version 1.5) 21 | */ 22 | @Target(ElementType.METHOD) 23 | @Retention(RetentionPolicy.RUNTIME) 24 | @JacksonAnnotation 25 | @Deprecated 26 | public @interface JsonGetter 27 | { 28 | /** 29 | * Defines name of the logical property this 30 | * method is used to access ("get"); empty String means that 31 | * name should be derived from the underlying method (using 32 | * standard Bean name detection rules) 33 | */ 34 | String value() default ""; 35 | } 36 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/annotate/JsonSetter.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.annotate; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * Marker annotation that can be used to define a non-static, 10 | * single-argument method to be used as a "setter" for a logical property 11 | * as an alternative to recommended 12 | * {@link JsonProperty} annotation (which was introduced in version 1.1). 13 | *

14 | * Setter means that when a property with matching name is encountered in 15 | * JSON content, this method will be used to set value of the property. 16 | *

17 | * NOTE: this annotation was briefly deprecated for version 1.5; but has 18 | * since been un-deprecated to both allow for asymmetric naming (possibly 19 | * different name when reading and writing JSON), and more importantly to 20 | * allow multi-argument setter method in future. 21 | */ 22 | @Target(ElementType.METHOD) 23 | @Retention(RetentionPolicy.RUNTIME) 24 | @JacksonAnnotation 25 | public @interface JsonSetter 26 | { 27 | /** 28 | * Optional default argument that defines logical property this 29 | * method is used to modify ("set"); this is the property 30 | * name used in JSON content. 31 | */ 32 | String value() default ""; 33 | } 34 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/util/LinkedNode.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map.util; 2 | 3 | /** 4 | * Node of a forward-only linked list. 5 | * 6 | * @author tatu 7 | * 8 | * @param Type of contained object 9 | */ 10 | public final class LinkedNode 11 | { 12 | final T _value; 13 | final LinkedNode _next; 14 | 15 | public LinkedNode(T value, LinkedNode next) 16 | { 17 | _value = value; 18 | _next = next; 19 | } 20 | 21 | public LinkedNode next() { return _next; } 22 | 23 | public T value() { return _value; } 24 | 25 | /** 26 | * Convenience method that can be used to check if a linked list 27 | * with given head node (which may be null to indicate empty list) 28 | * contains given value 29 | * 30 | * @param Type argument that defines contents of the linked list parameter 31 | * @param node Head node of the linked list 32 | * @param value Value to look for 33 | * @return True if linked list contains the value, false otherwise 34 | */ 35 | public static boolean contains(LinkedNode node, ST value) 36 | { 37 | while (node != null) { 38 | if (node.value() == value) { 39 | return true; 40 | } 41 | node = node.next(); 42 | } 43 | return false; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/actions/webview/GetUrl.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.actions.webview; 2 | 3 | import sh.calaba.instrumentationbackend.Result; 4 | import sh.calaba.instrumentationbackend.actions.Action; 5 | import android.webkit.WebView; 6 | import sh.calaba.instrumentationbackend.query.ast.UIQueryUtils; 7 | 8 | import java.util.concurrent.Callable; 9 | import java.util.concurrent.ExecutionException; 10 | import java.util.concurrent.FutureTask; 11 | import java.util.concurrent.TimeUnit; 12 | 13 | public class GetUrl implements Action { 14 | 15 | @Override 16 | public Result execute(String... args) { 17 | CalabashChromeClient ccc = CalabashChromeClient.findAndPrepareWebViews().get(0); 18 | final WebView webView = ccc.getWebView(); 19 | 20 | FutureTask urlResult = new FutureTask(new Callable() { 21 | @Override 22 | public Result call() throws Exception { 23 | return new Result(true, webView.getUrl()); 24 | } 25 | }); 26 | 27 | UIQueryUtils.runOnViewThread(webView, urlResult); 28 | 29 | try { 30 | return urlResult.get(10, TimeUnit.SECONDS); 31 | } catch (Exception e) { 32 | return new Result(false, e.getMessage()); 33 | } 34 | } 35 | 36 | @Override 37 | public String key() { 38 | return "get_url"; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/annotate/JsonView.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map.annotate; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | import sh.calaba.org.codehaus.jackson.annotate.JacksonAnnotation; 9 | 10 | /** 11 | * Annotation used for indicating view(s) that the property 12 | * that is defined by method or field annotated is part of. 13 | *

14 | * An example annotation would be: 15 | *

16 |  *  \@JsonView(BasicView.class)
17 |  *
18 | * which would specify that property annotated would be included 19 | * when processing (serializing, deserializing) View identified 20 | * by BasicView.class (or its sub-class). 21 | * If multiple View class identifiers are included, property will 22 | * be part of all of them. 23 | * 24 | * @since 1.4 25 | */ 26 | 27 | @Target({ElementType.METHOD, ElementType.FIELD}) 28 | @Retention(RetentionPolicy.RUNTIME) 29 | @JacksonAnnotation 30 | public @interface JsonView { 31 | /** 32 | * View or views that annotated element is part of. Views are identified 33 | * by classes, and use expected class inheritance relationship: child 34 | * views contain all elements parent views have, for example. 35 | */ 36 | public Class[] value() default { }; 37 | } 38 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/query/ast/evaluation/UIQueryEvaluationRules.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.query.ast.evaluation; 2 | 3 | import java.util.List; 4 | 5 | import sh.calaba.instrumentationbackend.query.ast.UIQueryAST; 6 | import sh.calaba.instrumentationbackend.query.ast.UIQueryDirection; 7 | import sh.calaba.instrumentationbackend.query.ast.UIQueryVisibility; 8 | 9 | public class UIQueryEvaluationRules implements QueryEvaluationStep { 10 | private UIQueryDirection currentDirection; 11 | private UIQueryVisibility currentVisibility; 12 | 13 | public UIQueryEvaluationRules() { 14 | currentDirection = UIQueryDirection.DESCENDANT; 15 | currentVisibility = UIQueryVisibility.VISIBLE; 16 | } 17 | 18 | @Override 19 | public List step(UIQueryDirection direction) { 20 | currentDirection = direction; 21 | 22 | return null; 23 | } 24 | 25 | @Override 26 | public List step(UIQueryVisibility visibility) { 27 | currentVisibility = visibility; 28 | 29 | return null; 30 | } 31 | 32 | @Override 33 | public List step(UIQueryAST step) { 34 | return null; 35 | } 36 | 37 | public UIQueryDirection getCurrentDirection() { 38 | return currentDirection; 39 | } 40 | 41 | public UIQueryVisibility getCurrentVisibility() { 42 | return currentVisibility; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/annotate/JsonRawValue.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.annotate; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * Marker annotation that indicates that the annotated method 10 | * or field should be serialized by including literal String value 11 | * of the property as is, without quoting of characters. 12 | * This can be useful for injecting values already serialized in JSON or 13 | * passing javascript function definitions from server to a javascript client. 14 | *

15 | * Warning: the resulting JSON stream may be invalid depending on your input value. 16 | * 17 | * @since 1.7.0 18 | */ 19 | @Target( { ElementType.METHOD, ElementType.FIELD }) 20 | @Retention(RetentionPolicy.RUNTIME) 21 | @JacksonAnnotation 22 | public @interface JsonRawValue 23 | { 24 | /** 25 | * Optional argument that defines whether this annotation is active 26 | * or not. The only use for value 'false' if for overriding purposes 27 | * (which is not needed often); most likely it is needed for use 28 | * with "mix-in annotations" (aka "annotation overrides"). 29 | * For most cases, however, default value of "true" is just fine 30 | * and should be omitted. 31 | */ 32 | boolean value() default true; 33 | } 34 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/utils/CompletableFuture.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.utils; 2 | 3 | import java.util.concurrent.*; 4 | 5 | public class CompletableFuture implements Future { 6 | 7 | private final CountDownLatch latch = new CountDownLatch(1); 8 | private volatile T result = null; 9 | 10 | @Override 11 | public boolean cancel(boolean b) { 12 | return false; // indicates that task can not be cancelled 13 | } 14 | 15 | @Override 16 | public boolean isCancelled() { 17 | return false; 18 | } 19 | 20 | @Override 21 | public boolean isDone() { 22 | return latch.getCount() == 0L; 23 | } 24 | 25 | @Override 26 | public T get() throws InterruptedException { 27 | latch.await(); 28 | return result; 29 | } 30 | 31 | @Override 32 | public T get(long time, TimeUnit timeUnit) throws InterruptedException, TimeoutException { 33 | if (latch.await(time, timeUnit)) { 34 | return result; 35 | } else { 36 | throw new TimeoutException(); 37 | } 38 | } 39 | 40 | /** 41 | * Completes the future and wakes up everyone stuck in get(). 42 | * @param result 43 | * @return 44 | */ 45 | public CompletableFuture complete(T result) { 46 | this.result = result; 47 | latch.countDown(); 48 | return this; 49 | } 50 | } -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/InstrumentationReport.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend; 2 | 3 | import android.app.Instrumentation; 4 | import android.os.Bundle; 5 | import android.support.annotation.Nullable; 6 | import android.text.TextUtils; 7 | 8 | public class InstrumentationReport { 9 | 10 | public static final String REPORT_STATUS = "status"; 11 | public static final String REPORT_MESSAGE = "message"; 12 | 13 | /** 14 | * Sends current status of instrumentation 15 | * @param instr - instrumentation to send status for 16 | * @param displayName - unique name of instrumentation (recommended - simple class name) 17 | * @param status - current status of instrumentation 18 | * @param message - any additional information 19 | */ 20 | public static void send(Instrumentation instr, String displayName, 21 | InstrumentationStatus status, @Nullable String message) { 22 | Bundle results = new Bundle(); 23 | 24 | results.putString(compositeKey(displayName, REPORT_STATUS), status.name()); 25 | results.putString(compositeKey(displayName, REPORT_MESSAGE), !TextUtils.isEmpty(message) ? message : "no message"); 26 | 27 | instr.sendStatus(status.resultCode, results); 28 | } 29 | 30 | private static String compositeKey(String displayName, String key) { 31 | return displayName + "-" + key; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/query/ast/UIQueryMatcher.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.query.ast; 2 | 3 | import java.util.concurrent.Callable; 4 | 5 | import sh.calaba.instrumentationbackend.query.ui.UIObject; 6 | import sh.calaba.instrumentationbackend.query.ui.UIObjectView; 7 | import sh.calaba.instrumentationbackend.query.ui.UIObjectWebResult; 8 | 9 | public abstract class UIQueryMatcher implements Callable { 10 | private final UIObject uiObject; 11 | 12 | public UIQueryMatcher(UIObject uiObject) { 13 | this.uiObject = uiObject; 14 | } 15 | 16 | protected UIObject getUiObject() { 17 | return uiObject; 18 | } 19 | 20 | @Override 21 | final public T call() throws Exception { 22 | if (uiObject instanceof UIObjectView) { 23 | return matchForUIObject((UIObjectView) uiObject); 24 | } else if (uiObject instanceof UIObjectWebResult) { 25 | return matchForUIObject((UIObjectWebResult) uiObject); 26 | } 27 | 28 | if (uiObject == null) { 29 | throw new InvalidUIQueryException("Invalid UIObject, cannot be null"); 30 | } 31 | 32 | throw new InvalidUIQueryException("Invalid UIObject '" + uiObject.getClass() + "'"); 33 | } 34 | 35 | protected abstract T matchForUIObject(UIObjectView uiObjectView); 36 | protected abstract T matchForUIObject(UIObjectWebResult uiObjectWebResult); 37 | } 38 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/actions/text/HideSoftKeyboard.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.actions.text; 2 | 3 | import android.app.Activity; 4 | import android.content.Context; 5 | import android.view.View; 6 | import android.view.inputmethod.InputMethodManager; 7 | 8 | import sh.calaba.instrumentationbackend.InstrumentationBackend; 9 | import sh.calaba.instrumentationbackend.Result; 10 | import sh.calaba.instrumentationbackend.actions.Action; 11 | 12 | public class HideSoftKeyboard implements Action { 13 | 14 | @Override 15 | public Result execute(String... args) { 16 | Context context = InstrumentationBackend.instrumentation.getTargetContext(); 17 | InputMethodManager inputMethodManager = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); 18 | 19 | Activity activity = InstrumentationBackend.getCurrentActivity(); 20 | View view = InfoMethodUtil.getInputView(); 21 | 22 | if (view == null) { 23 | view = new View(activity); 24 | } 25 | 26 | if (inputMethodManager != null) { 27 | inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0); 28 | return Result.successResult(); 29 | } 30 | 31 | return Result.failedResult("Could not connect to input_method"); 32 | } 33 | 34 | @Override 35 | public String key() { 36 | return "hide_soft_keyboard"; 37 | } 38 | } -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/query/ui/UIObjectView.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.query.ui; 2 | 3 | import android.view.View; 4 | 5 | import java.util.ArrayList; 6 | import java.util.Collection; 7 | import java.util.List; 8 | import java.util.concurrent.Callable; 9 | import java.util.concurrent.Future; 10 | import java.util.concurrent.FutureTask; 11 | 12 | import sh.calaba.instrumentationbackend.query.ast.UIQueryUtils; 13 | 14 | public class UIObjectView implements UIObject { 15 | private View view; 16 | 17 | public UIObjectView(View view) { 18 | if (view == null) { 19 | throw new IllegalArgumentException("View cannot be null"); 20 | } 21 | 22 | this.view = view; 23 | } 24 | 25 | @Override 26 | public View getObject() { 27 | return view; 28 | } 29 | 30 | @Override 31 | public Future evaluateAsyncInMainThread(Callable callable) throws Exception { 32 | FutureTask futureTask = new FutureTask(callable); 33 | UIQueryUtils.runOnViewThread(view, futureTask); 34 | 35 | return futureTask; 36 | } 37 | 38 | public static List listOfUIObjects(Collection views) { 39 | List list = new ArrayList(views.size()); 40 | 41 | for (View view : views) { 42 | list.add(new UIObjectView(view)); 43 | } 44 | 45 | return list; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/FormatSchema.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson; 2 | 3 | /** 4 | * Simple tag interface used to mark schema objects that are used by some 5 | * {@link JsonParser} and {@link JsonGenerator} implementations to further 6 | * specify structure of expected format. 7 | * Basic JSON-based parsers and generators do not use schemas, but some data 8 | * formats (like many binary data formats like Thrift, protobuf) mandate 9 | * use of schemas. 10 | *

11 | * Since there is little commonality between schemas for different data formats, 12 | * this interface does not define much meaningful functionality for accessing 13 | * schema details; rather, specific parser and generator implementations need 14 | * to cast to schema implementations they use. This marker interface is mostly 15 | * used for tagging "some kind of schema" -- instead of passing opaque 16 | * {@link java.lang.Object} -- for documentation purposes. 17 | * 18 | * @since 1.8 19 | */ 20 | public interface FormatSchema 21 | { 22 | /** 23 | * Method that can be used to get an identifier that can be used for diagnostics 24 | * purposes, to indicate what kind of data format this schema is used for: typically 25 | * it is a short name of format itself, but it can also contain additional information 26 | * in cases where data format supports multiple types of schemas. 27 | */ 28 | public String getSchemaType(); 29 | } 30 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/deser/std/TokenBufferDeserializer.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map.deser.std; 2 | 3 | import java.io.IOException; 4 | 5 | import sh.calaba.org.codehaus.jackson.JsonParser; 6 | import sh.calaba.org.codehaus.jackson.JsonProcessingException; 7 | import sh.calaba.org.codehaus.jackson.map.DeserializationContext; 8 | import sh.calaba.org.codehaus.jackson.map.annotate.JacksonStdImpl; 9 | import sh.calaba.org.codehaus.jackson.util.TokenBuffer; 10 | 11 | /** 12 | * We also want to directly support deserialization of 13 | * {@link TokenBuffer}. 14 | *

15 | * Note that we use scalar deserializer base just because we claim 16 | * to be of scalar for type information inclusion purposes; actual 17 | * underlying content can be of any (Object, Array, scalar) type. 18 | * 19 | * @since 1.9 (moved from higher-level package) 20 | */ 21 | @JacksonStdImpl 22 | public class TokenBufferDeserializer 23 | extends StdScalarDeserializer 24 | { 25 | public TokenBufferDeserializer() { super(TokenBuffer.class); } 26 | 27 | @Override 28 | public TokenBuffer deserialize(JsonParser jp, DeserializationContext ctxt) 29 | throws IOException, JsonProcessingException 30 | { 31 | TokenBuffer tb = new TokenBuffer(jp.getCodec()); 32 | // quite simple, given that TokenBuffer is a JsonGenerator: 33 | tb.copyCurrentStructure(jp); 34 | return tb; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/ser/std/NonTypedScalarSerializerBase.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map.ser.std; 2 | 3 | import java.io.IOException; 4 | 5 | import sh.calaba.org.codehaus.jackson.JsonGenerationException; 6 | import sh.calaba.org.codehaus.jackson.JsonGenerator; 7 | import sh.calaba.org.codehaus.jackson.map.SerializerProvider; 8 | import sh.calaba.org.codehaus.jackson.map.TypeSerializer; 9 | 10 | /** 11 | * Intermediate base class for limited number of scalar types 12 | * that should never include type information. These are "native" 13 | * types that are default mappings for corresponding JSON scalar 14 | * types: {@link java.lang.String}, {@link java.lang.Integer}, 15 | * {@link java.lang.Double} and {@link java.lang.Boolean}. 16 | * 17 | * @since 1.9 (refactored from 'sh.calaba.org.codehaus.jackson.map.StdSerializers#NontTypedScalarSerializer') 18 | */ 19 | public abstract class NonTypedScalarSerializerBase 20 | extends ScalarSerializerBase 21 | { 22 | protected NonTypedScalarSerializerBase(Class t) { 23 | super(t); 24 | } 25 | 26 | @Override 27 | public final void serializeWithType(T value, JsonGenerator jgen, SerializerProvider provider, 28 | TypeSerializer typeSer) 29 | throws IOException, JsonGenerationException 30 | { 31 | // no type info, just regular serialization 32 | serialize(value, jgen, provider); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/ser/std/TimeZoneSerializer.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map.ser.std; 2 | 3 | import java.io.IOException; 4 | import java.util.TimeZone; 5 | 6 | import sh.calaba.org.codehaus.jackson.JsonGenerationException; 7 | import sh.calaba.org.codehaus.jackson.JsonGenerator; 8 | import sh.calaba.org.codehaus.jackson.map.SerializerProvider; 9 | import sh.calaba.org.codehaus.jackson.map.TypeSerializer; 10 | 11 | /** 12 | * @since 1.8 13 | */ 14 | public class TimeZoneSerializer 15 | extends ScalarSerializerBase 16 | { 17 | public final static TimeZoneSerializer instance = new TimeZoneSerializer(); 18 | 19 | public TimeZoneSerializer() { super(TimeZone.class); } 20 | 21 | @Override 22 | public void serialize(TimeZone value, JsonGenerator jgen, SerializerProvider provider) 23 | throws IOException, JsonGenerationException 24 | { 25 | jgen.writeString(value.getID()); 26 | } 27 | 28 | @Override 29 | public void serializeWithType(TimeZone value, JsonGenerator jgen, SerializerProvider provider, 30 | TypeSerializer typeSer) 31 | throws IOException, JsonGenerationException 32 | { 33 | // Better ensure we don't use specific sub-classes: 34 | typeSer.writeTypePrefixForScalar(value, jgen, TimeZone.class); 35 | serialize(value, jgen, provider); 36 | typeSer.writeTypeSuffixForScalar(value, jgen); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/JsonSerializable.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map; 2 | 3 | import java.io.IOException; 4 | 5 | import sh.calaba.org.codehaus.jackson.JsonGenerator; 6 | import sh.calaba.org.codehaus.jackson.JsonProcessingException; 7 | 8 | /** 9 | * Interface that can be implemented by objects that know how to 10 | * serialize themselves to JSON, using {@link JsonGenerator} 11 | * (and {@link SerializerProvider} if necessary). 12 | *

13 | * Note that implementing this interface binds implementing object 14 | * closely to Jackson API, and that it is often not necessary to do 15 | * so -- if class is a bean, it can be serialized without 16 | * implementing this interface. 17 | *

18 | * NOTE: as of version 1.5, this interface is missing one crucial 19 | * aspect, that of dealing with type information embedding. 20 | * Because of this, this interface is deprecated, although will be 21 | * fully supported for all 1.x releases, and will work except for 22 | * cases where polymorphic type information handling is needed for 23 | * type (in which case implementing if {@link JsonSerializableWithType} is crucial). 24 | * 25 | * @see sh.calaba.org.codehaus.jackson.map.JsonSerializableWithType 26 | * 27 | * @since 1.5 28 | */ 29 | @Deprecated 30 | public interface JsonSerializable 31 | { 32 | public void serialize(JsonGenerator jgen, SerializerProvider provider) 33 | throws IOException, JsonProcessingException; 34 | } 35 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/deser/std/JavaTypeDeserializer.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.map.deser.std; 2 | 3 | import java.io.IOException; 4 | 5 | import sh.calaba.org.codehaus.jackson.JsonParser; 6 | import sh.calaba.org.codehaus.jackson.JsonProcessingException; 7 | import sh.calaba.org.codehaus.jackson.JsonToken; 8 | import sh.calaba.org.codehaus.jackson.map.DeserializationContext; 9 | import sh.calaba.org.codehaus.jackson.type.JavaType; 10 | 11 | /** 12 | * @since 1.9 13 | */ 14 | public class JavaTypeDeserializer 15 | extends StdScalarDeserializer 16 | { 17 | public JavaTypeDeserializer() { super(JavaType.class); } 18 | 19 | @Override 20 | public JavaType deserialize(JsonParser jp, DeserializationContext ctxt) 21 | throws IOException, JsonProcessingException 22 | { 23 | JsonToken curr = jp.getCurrentToken(); 24 | // Usually should just get string value: 25 | if (curr == JsonToken.VALUE_STRING) { 26 | String str = jp.getText().trim(); 27 | if (str.length() == 0) { 28 | return getEmptyValue(); 29 | } 30 | return ctxt.getTypeFactory().constructFromCanonical(str); 31 | } 32 | // or occasionally just embedded object maybe 33 | if (curr == JsonToken.VALUE_EMBEDDED_OBJECT) { 34 | return (JavaType) jp.getEmbeddedObject(); 35 | } 36 | throw ctxt.mappingException(_valueClass); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/map/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | Contains basic mapper (conversion) functionality that 3 | allows for converting between regular streaming json content and 4 | Java objects (beans or Tree Model: support for both is via 5 | {@link sh.calaba.org.codehaus.jackson.map.ObjectMapper} class, as well 6 | as convenience methods included in 7 | {@link sh.calaba.org.codehaus.jackson.JsonParser} 8 |

9 | Object mapper will convert Json content to ant from 10 | basic Java wrapper types (Integer, Boolean, Double), 11 | Collection types (List, Map), Java Beans, 12 | Strings and nulls. 13 |

14 | Tree mapper builds dynamically typed tree of JsonNodes 15 | from Json content (and writes such trees as Json), 16 | similar to how DOM model works with xml. 17 | Main benefits over Object mapping are: 18 |

    19 |
  • No null checks are needed (dummy 20 | nodes are created as necessary to represent "missing" Object fields 21 | and Array elements) 22 |
  • 23 |
  • No type casts are usually needed: all public access methods are defined 24 | in basic JsonNode class, and when "incompatible" method (such as Array 25 | element access on, say, Boolean node) is used, returned node is 26 | virtual "missing" node. 27 |
  • 28 |
29 | Because of its dynamic nature, Tree mapping is often convenient 30 | for basic path access and tree navigation, where structure of 31 | the resulting tree is known in advance. 32 | */ 33 | 34 | package sh.calaba.org.codehaus.jackson.map; 35 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/query/ast/UIQueryVisibilityMatcher.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.query.ast; 2 | 3 | import android.view.View; 4 | 5 | import java.util.Map; 6 | 7 | import sh.calaba.instrumentationbackend.query.ViewMapper; 8 | import sh.calaba.instrumentationbackend.query.WebContainer; 9 | import sh.calaba.instrumentationbackend.query.ui.UIObject; 10 | import sh.calaba.instrumentationbackend.query.ui.UIObjectView; 11 | import sh.calaba.instrumentationbackend.query.ui.UIObjectWebResult; 12 | 13 | public class UIQueryVisibilityMatcher extends UIQueryMatcher { 14 | UIQueryVisibilityMatcher(UIObject uiObject) { 15 | super(uiObject); 16 | } 17 | 18 | @Override 19 | protected Boolean matchForUIObject(UIObjectView uiObjectView) { 20 | View view = uiObjectView.getObject(); 21 | 22 | if (view.getHeight() == 0 || view.getWidth() == 0) { 23 | return false; 24 | } 25 | 26 | return view.isShown() && UIQueryUtils.isViewSufficientlyShown(view); 27 | } 28 | 29 | @Override 30 | protected Boolean matchForUIObject(UIObjectWebResult uiObjectWebResult) { 31 | Map viewRect = uiObjectWebResult.getRect(); 32 | WebContainer webContainer = uiObjectWebResult.getWebContainer(); 33 | Map parentViewRec = ViewMapper.getRectForView(webContainer.getView()); 34 | return UIQueryUtils.isViewSufficientlyShown(viewRect, parentViewRec); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/instrumentationbackend/actions/activity/GetActivityOrientation.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.instrumentationbackend.actions.activity; 2 | 3 | import android.app.Activity; 4 | import android.content.pm.ActivityInfo; 5 | 6 | import sh.calaba.instrumentationbackend.InstrumentationBackend; 7 | import sh.calaba.instrumentationbackend.Result; 8 | import sh.calaba.instrumentationbackend.actions.Action; 9 | 10 | public class GetActivityOrientation implements Action { 11 | 12 | @Override 13 | public Result execute(String... args) { 14 | Activity activity = InstrumentationBackend.getCurrentActivity(); 15 | final int orientation = activity.getRequestedOrientation(); 16 | 17 | switch (orientation) { 18 | case ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE: 19 | return new Result(true, "landscape"); 20 | case ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE: 21 | return new Result(true, "reverse_landscape"); 22 | case ActivityInfo.SCREEN_ORIENTATION_PORTRAIT: 23 | return new Result(true, "portrait"); 24 | case ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT: 25 | return new Result(true, "reverse_portrait"); 26 | default: 27 | return Result.failedResult("Invalid orientation '" + orientation + "' for activity '" + activity + "'"); 28 | } 29 | } 30 | 31 | @Override 32 | public String key() { 33 | return "get_activity_orientation"; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/node/NullNode.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.node; 2 | 3 | import java.io.IOException; 4 | 5 | import sh.calaba.org.codehaus.jackson.*; 6 | import sh.calaba.org.codehaus.jackson.map.SerializerProvider; 7 | 8 | /** 9 | * This singleton value class is used to contain explicit JSON null 10 | * value. 11 | */ 12 | public final class NullNode 13 | extends ValueNode 14 | { 15 | // // Just need a fly-weight singleton 16 | 17 | public final static NullNode instance = new NullNode(); 18 | 19 | private NullNode() { } 20 | 21 | public static NullNode getInstance() { return instance; } 22 | 23 | @Override public JsonToken asToken() { return JsonToken.VALUE_NULL; } 24 | 25 | @Override 26 | public boolean isNull() { return true; } 27 | 28 | @Override 29 | public String asText() { 30 | return "null"; 31 | } 32 | 33 | @Override 34 | public int asInt(int defaultValue) { 35 | return 0; 36 | } 37 | @Override 38 | public long asLong(long defaultValue) { 39 | return 0L; 40 | } 41 | @Override 42 | public double asDouble(double defaultValue) { 43 | return 0.0; 44 | } 45 | 46 | @Override 47 | public final void serialize(JsonGenerator jg, SerializerProvider provider) 48 | throws IOException, JsonProcessingException 49 | { 50 | jg.writeNull(); 51 | } 52 | 53 | @Override 54 | public boolean equals(Object o) 55 | { 56 | return (o == this); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/annotate/JsonProperty.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.annotate; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * Marker annotation that can be used to define a non-static 10 | * method as a "setter" or "getter" for a logical property 11 | * (depending on its signature), 12 | * or non-static object field to be used (serialized, deserialized) as 13 | * a logical property. 14 | *

15 | * Default value ("") indicates that the field name is used 16 | * as the property name without any modifications, but it 17 | * can be specified to non-empty value to specify different 18 | * name. Property name refers to name used externally, as 19 | * the field name in Json objects. 20 | *

21 | * NOTE: since version 1.1, annotation has also been applicable 22 | * to fields (not with 1.0). 23 | *

24 | * NOTE: since version 1.2, annotation has also been applicable 25 | * to (constructor) parameters 26 | */ 27 | @Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) 28 | @Retention(RetentionPolicy.RUNTIME) 29 | @JacksonAnnotation 30 | public @interface JsonProperty 31 | { 32 | /** 33 | * Defines name of the logical property, i.e. Json object field 34 | * name to use for the property: if empty String (which is the 35 | * default), will use name of the field that is annotated. 36 | */ 37 | String value() default ""; 38 | } 39 | -------------------------------------------------------------------------------- /server/app/src/androidTest/java/sh/calaba/org/codehaus/jackson/sym/Name.java: -------------------------------------------------------------------------------- 1 | package sh.calaba.org.codehaus.jackson.sym; 2 | 3 | /** 4 | * Base class for tokenized names (key strings in objects) that have 5 | * been tokenized from byte-based input sources (like 6 | * {@link java.io.InputStream}. 7 | * 8 | * @author Tatu Saloranta 9 | */ 10 | public abstract class Name 11 | { 12 | protected final String _name; 13 | 14 | protected final int _hashCode; 15 | 16 | protected Name(String name, int hashCode) { 17 | _name = name; 18 | _hashCode = hashCode; 19 | } 20 | 21 | public String getName() { return _name; } 22 | 23 | /* 24 | /********************************************************** 25 | /* Methods for package/core parser 26 | /********************************************************** 27 | */ 28 | 29 | public abstract boolean equals(int quad1); 30 | 31 | public abstract boolean equals(int quad1, int quad2); 32 | 33 | public abstract boolean equals(int[] quads, int qlen); 34 | 35 | /* 36 | /********************************************************** 37 | /* Overridden standard methods 38 | /********************************************************** 39 | */ 40 | 41 | @Override public String toString() { return _name; } 42 | 43 | @Override public final int hashCode() { return _hashCode; } 44 | 45 | @Override public boolean equals(Object o) 46 | { 47 | // Canonical instances, can usually just do identity comparison 48 | return (o == this); 49 | } 50 | } 51 | --------------------------------------------------------------------------------