Skip to content

Commit

Permalink
Merge pull request #27 from adobe/staging
Browse files Browse the repository at this point in the history
Staging to main for 2.0.1 release
  • Loading branch information
rymorale authored Jul 11, 2023
2 parents a8e5c69 + 02357d3 commit 8f2a39f
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
# Gradle files
.gradle/
build/
code/.gradle/
code/gradle/

# Generated files
bin/
Expand Down
2 changes: 1 addition & 1 deletion code/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ android.useAndroidX=true
moduleProjectName=target
moduleName=target
moduleAARName=target-phone-release.aar
moduleVersion=2.0.0
moduleVersion=2.0.1

mavenRepoName=AdobeMobileTargetSdk
mavenRepoDescription=Adobe Experience Platform Target extension for the Adobe Experience Platform Mobile SDK
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

public class TargetTestConstants {

static final String EXTENSION_VERSION = "2.0.0";
static final String EXTENSION_VERSION = "2.0.1";

public final static class EventType {
public static final String TARGET = "com.adobe.eventType.target";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -425,10 +425,9 @@ String extractMboxContent(final JSONObject mboxJson) {
if (optionType.equals(TargetJson.HTML)) {
optionContent = option.optString(TargetJson.Option.CONTENT, "");
} else if (optionType.equals(TargetJson.JSON)) {
final JSONObject contentJSON = option.optJSONObject(TargetJson.Option.CONTENT);

if (contentJSON != null) {
optionContent = contentJSON.toString();
final Object content = option.opt(TargetJson.Option.CONTENT);
if (content != null) {
optionContent = content.toString();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class Target {

static final String LOG_TAG = "Target";
private static final String CLASS_NAME = "Target";
static final String EXTENSION_VERSION = "2.0.0";
static final String EXTENSION_VERSION = "2.0.1";

static final class EventName {
static final String PREFETCH_REQUEST = "TargetPrefetchRequest";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ public void test_getFriendlyName() {
public void test_getVersion() {
// test
final String extensionVersion = extension.getVersion();
assertEquals("getVersion should return the correct extension version.", "2.0.0", extensionVersion);
assertEquals("getVersion should return the correct extension version.", "2.0.1", extensionVersion);
}

//**********************************************************************************************
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,42 @@ public void testExtractMboxContent_Happy() throws Exception {
assertEquals("AAA", extractMboxContent);
}

@Test
public void testExtractMboxContent_JsonArrayContent() throws Exception {
// setup
String serverResponse = "{\n" +
" \"index\" : \"1\" , \n" +
" \"options\" : [{\n" +
" \"content\" : [\"one\", \"two\", \"three\"] , \n" +
" \"type\" : \"json\"" +
" }]\n" +
"}";
// test
JSONObject jsonObject = new JSONObject(serverResponse);
String extractMboxContent = responseParser.extractMboxContent(jsonObject);
// verify
assertNotNull(extractMboxContent);
assertEquals("[\"one\",\"two\",\"three\"]", extractMboxContent);
}

@Test
public void testExtractMboxContent_MixedJsonArrayContent() throws Exception {
// setup
String serverResponse = "{\n" +
" \"index\" : \"1\" , \n" +
" \"options\" : [{\n" +
" \"content\" : [[\"one\", 1], true, 23] , \n" +
" \"type\" : \"json\"" +
" }]\n" +
"}";
// test
JSONObject jsonObject = new JSONObject(serverResponse);
String extractMboxContent = responseParser.extractMboxContent(jsonObject);
// verify
assertNotNull(extractMboxContent);
assertEquals("[[\"one\",1],true,23]", extractMboxContent);
}

@Test
public void testExtractMboxContentHappy_For_StringContent() throws Exception {
// setup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public void teardown() {
public void test_extensionVersion() {
// test
final String extensionVersion = Target.extensionVersion();
assertEquals("extensionVersion API should return the correct version string.", "2.0.0",
assertEquals("extensionVersion API should return the correct version string.", "2.0.1",
extensionVersion);
}

Expand Down

0 comments on commit 8f2a39f

Please sign in to comment.