Search in sources :

Example 11 with AnalyticsContextBuilder

use of com.amazonaws.mobileconnectors.pinpoint.analytics.utils.AnalyticsContextBuilder in project aws-sdk-android by aws-amplify.

the class AnalyticsEventTest method setup.

@Before
public void setup() {
    testDeviceDetails = new MockDeviceDetails();
    PinpointContext mockContext = new AnalyticsContextBuilder().withSdkInfo(SDK_NAME, SDK_VERSION).withUniqueIdValue(UNIQUE_ID).withDeviceDetails(testDeviceDetails).withContext(RuntimeEnvironment.application.getApplicationContext()).build();
    target = AnalyticsEvent.newInstance(mockContext, SESSION_ID, SESSION_START, SESSION_END, SESSION_DURATION, TIME_STAMP, EVENT_NAME);
    assertEquals(EVENT_NAME, target.getEventType());
    assertEquals(UNIQUE_ID, target.getUniqueId());
    assertEquals(TIME_STAMP, target.getEventTimestamp());
    assertEquals(SDK_NAME, target.getSdkName());
    assertEquals(SDK_VERSION, target.getSdkVersion());
    assertEquals(0, target.getAllAttributes().size());
    assertEquals(0, target.getAllMetrics().size());
}
Also used : PinpointContext(com.amazonaws.mobileconnectors.pinpoint.internal.core.PinpointContext) MockDeviceDetails(com.amazonaws.mobileconnectors.pinpoint.internal.core.system.MockDeviceDetails) AnalyticsContextBuilder(com.amazonaws.mobileconnectors.pinpoint.analytics.utils.AnalyticsContextBuilder) Before(org.junit.Before)

Example 12 with AnalyticsContextBuilder

use of com.amazonaws.mobileconnectors.pinpoint.analytics.utils.AnalyticsContextBuilder in project aws-sdk-android by aws-amplify.

the class EventRecorderTest method setup.

@Before
public void setup() {
    MockitoAnnotations.initMocks(this);
    testDeviceDetails = new MockDeviceDetails();
    mockContext = new AnalyticsContextBuilder().withSdkInfo(SDK_NAME, SDK_VERSION).withUniqueIdValue(UNIQUE_ID).withDeviceDetails(testDeviceDetails).withContext(RuntimeEnvironment.application.getApplicationContext()).build();
    analyticsEvent = AnalyticsEvent.newInstance(mockContext, SESSION_ID, SESSION_START, SESSION_END, SESSION_DURATION, TIME_STAMP, EVENT_NAME);
    analyticsEvent.addAttribute("key1", "value1");
    analyticsEvent.addAttribute("key2", "value2");
    endpointProfile = new EndpointProfile(mockContext);
    dbUtil = new PinpointDBUtil(RuntimeEnvironment.application.getApplicationContext());
    eventRecorder = new EventRecorder(mockContext, dbUtil, submissionRunnable);
}
Also used : MockDeviceDetails(com.amazonaws.mobileconnectors.pinpoint.internal.core.system.MockDeviceDetails) EndpointProfile(com.amazonaws.mobileconnectors.pinpoint.targeting.endpointProfile.EndpointProfile) AnalyticsContextBuilder(com.amazonaws.mobileconnectors.pinpoint.analytics.utils.AnalyticsContextBuilder) Before(org.junit.Before)

Example 13 with AnalyticsContextBuilder

use of com.amazonaws.mobileconnectors.pinpoint.analytics.utils.AnalyticsContextBuilder in project aws-sdk-android by aws-amplify.

the class PinpointDBUtilTest method setup.

@Before
public void setup() {
    testDeviceDetails = new MockDeviceDetails();
    mockContext = new AnalyticsContextBuilder().withSdkInfo(SDK_NAME, SDK_VERSION).withUniqueIdValue(UNIQUE_ID).withDeviceDetails(testDeviceDetails).withContext(RuntimeEnvironment.application.getApplicationContext()).build();
    dbUtil = new PinpointDBUtil(RuntimeEnvironment.application.getApplicationContext());
}
Also used : MockDeviceDetails(com.amazonaws.mobileconnectors.pinpoint.internal.core.system.MockDeviceDetails) AnalyticsContextBuilder(com.amazonaws.mobileconnectors.pinpoint.analytics.utils.AnalyticsContextBuilder) Before(org.junit.Before)

Example 14 with AnalyticsContextBuilder

use of com.amazonaws.mobileconnectors.pinpoint.analytics.utils.AnalyticsContextBuilder in project aws-sdk-android by aws-amplify.

the class ADMNotificationClientTest method setup.

@Before
public void setup() {
    MockitoAnnotations.initMocks(this);
    final Context roboContext = RuntimeEnvironment.application.getApplicationContext();
    spiedRoboContext = Mockito.spy(roboContext);
    mockPinpointContext = new AnalyticsContextBuilder().withSystem(new MockSystem("JIMMY_CRACKED_CORN.and")).withConfiguration(mockConfiguration).withContext(spiedRoboContext).build();
    analyticsClient = new AnalyticsClient(mockPinpointContext);
    Whitebox.setInternalState(analyticsClient, "eventRecorder", mockEventRecorder);
    when(mockConfiguration.optBoolean("isAnalyticsEnabled", true)).thenReturn(true);
    when(mockPinpointContext.getAnalyticsClient()).thenReturn(analyticsClient);
    // target.setSessionClient(new SessionClient(mockContext, mockEventClient, mockTargetingClient,
    // new TestSessionStore(), false));
    when(mockPinpointContext.getTargetingClient()).thenReturn(mockTargetingClient);
    when(mockPinpointContext.getConfiguration()).thenReturn(mockConfiguration);
    when(mockPinpointContext.getPinpointConfiguration()).thenReturn(mockPinpointConfiguration);
    target = NotificationClient.createClient(mockPinpointContext, ChannelType.ADM);
}
Also used : Context(android.content.Context) PinpointContext(com.amazonaws.mobileconnectors.pinpoint.internal.core.PinpointContext) AnalyticsClient(com.amazonaws.mobileconnectors.pinpoint.analytics.AnalyticsClient) AnalyticsContextBuilder(com.amazonaws.mobileconnectors.pinpoint.analytics.utils.AnalyticsContextBuilder) MockSystem(com.amazonaws.mobileconnectors.pinpoint.internal.core.system.MockSystem) Before(org.junit.Before)

Example 15 with AnalyticsContextBuilder

use of com.amazonaws.mobileconnectors.pinpoint.analytics.utils.AnalyticsContextBuilder in project aws-sdk-android by aws-amplify.

the class BaiduNotificationClientTest method setup.

@Before
public void setup() {
    MockitoAnnotations.initMocks(this);
    final Context roboContext = RuntimeEnvironment.application.getApplicationContext();
    spiedRoboContext = Mockito.spy(roboContext);
    mockPinpointContext = new AnalyticsContextBuilder().withSystem(new MockSystem("JIMMY_CRACKED_CORN.and")).withConfiguration(mockConfiguration).withContext(spiedRoboContext).build();
    analyticsClient = new AnalyticsClient(mockPinpointContext);
    Whitebox.setInternalState(analyticsClient, "eventRecorder", mockEventRecorder);
    when(mockConfiguration.optBoolean("isAnalyticsEnabled", true)).thenReturn(true);
    when(mockPinpointContext.getAnalyticsClient()).thenReturn(analyticsClient);
    // target.setSessionClient(new SessionClient(mockContext, mockEventClient, mockTargetingClient,
    // new TestSessionStore(), false));
    when(mockPinpointContext.getTargetingClient()).thenReturn(mockTargetingClient);
    when(mockPinpointContext.getConfiguration()).thenReturn(mockConfiguration);
    when(mockPinpointContext.getPinpointConfiguration()).thenReturn(mockPinpointConfiguration);
    target = NotificationClient.createClient(mockPinpointContext, ChannelType.BAIDU);
}
Also used : Context(android.content.Context) PinpointContext(com.amazonaws.mobileconnectors.pinpoint.internal.core.PinpointContext) AnalyticsClient(com.amazonaws.mobileconnectors.pinpoint.analytics.AnalyticsClient) AnalyticsContextBuilder(com.amazonaws.mobileconnectors.pinpoint.analytics.utils.AnalyticsContextBuilder) MockSystem(com.amazonaws.mobileconnectors.pinpoint.internal.core.system.MockSystem) Before(org.junit.Before)

Aggregations

AnalyticsContextBuilder (com.amazonaws.mobileconnectors.pinpoint.analytics.utils.AnalyticsContextBuilder)19 Before (org.junit.Before)16 PinpointContext (com.amazonaws.mobileconnectors.pinpoint.internal.core.PinpointContext)14 AnalyticsClient (com.amazonaws.mobileconnectors.pinpoint.analytics.AnalyticsClient)10 MockSystem (com.amazonaws.mobileconnectors.pinpoint.internal.core.system.MockSystem)6 Context (android.content.Context)5 AnalyticsEvent (com.amazonaws.mobileconnectors.pinpoint.analytics.AnalyticsEvent)5 MockDeviceDetails (com.amazonaws.mobileconnectors.pinpoint.internal.core.system.MockDeviceDetails)5 AndroidPreferencesConfiguration (com.amazonaws.mobileconnectors.pinpoint.internal.core.configuration.AndroidPreferencesConfiguration)2 EndpointProfile (com.amazonaws.mobileconnectors.pinpoint.targeting.endpointProfile.EndpointProfile)2 Activity (android.app.Activity)1 AWSCredentials (com.amazonaws.auth.AWSCredentials)1 AWSCredentialsProvider (com.amazonaws.auth.AWSCredentialsProvider)1 AnonymousAWSCredentials (com.amazonaws.auth.AnonymousAWSCredentials)1 SessionClient (com.amazonaws.mobileconnectors.pinpoint.analytics.SessionClient)1 ContextWithPermissions (com.amazonaws.mobileconnectors.pinpoint.analytics.utils.ContextWithPermissions)1 AndroidDeviceDetails (com.amazonaws.mobileconnectors.pinpoint.internal.core.system.AndroidDeviceDetails)1 TargetingClient (com.amazonaws.mobileconnectors.pinpoint.targeting.TargetingClient)1 Test (org.junit.Test)1