Search in sources :

Example 6 with AnalyticsContextBuilder

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

the class FCMNotificationClientTest 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.GCM);
}
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 7 with AnalyticsContextBuilder

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

the class GCMNotificationClientTest method setup.

@Before
public void setup() {
    MockitoAnnotations.initMocks(this);
    Context roboContext = ApplicationProvider.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.GCM);
}
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 8 with AnalyticsContextBuilder

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

the class SessionClientTest method setup.

@Before
public void setup() {
    MockitoAnnotations.initMocks(this);
    this.mockPinpointContext = new AnalyticsContextBuilder().withSdkInfo(SDK_NAME, SDK_VERSION).withUniqueIdValue(UNIQUE_ID).withConfiguration(mockConfiguration).withContext(RuntimeEnvironment.application.getApplicationContext()).withSystem(new MockSystem("SESSION_CLIENT.test")).build();
    when(mockPinpointContext.getAnalyticsClient()).thenReturn(mockAnalyticsClient);
    when(mockPinpointContext.getTargetingClient()).thenReturn(mockTargetingClient);
    when(mockPinpointContext.getConfiguration()).thenReturn(mockConfiguration);
    when(mockPinpointContext.getPinpointConfiguration()).thenReturn(mockPinpointConfiguration);
    target = new SessionClient(mockPinpointContext);
    System.out.print(target.toString());
}
Also used : AnalyticsContextBuilder(com.amazonaws.mobileconnectors.pinpoint.analytics.utils.AnalyticsContextBuilder) MockSystem(com.amazonaws.mobileconnectors.pinpoint.internal.core.system.MockSystem) Before(org.junit.Before)

Example 9 with AnalyticsContextBuilder

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

the class GooglePlayMonetizationEventBuilderTest method setup.

@Before
public void setup() {
    MockitoAnnotations.initMocks(this);
    when(mockConfiguration.optString("versionKey", "ver")).thenReturn("ver");
    when(mockConfiguration.optBoolean("isAnalyticsEnabled", true)).thenReturn(true);
    PinpointContext mockContext = new AnalyticsContextBuilder().withConfiguration(mockConfiguration).withContext(RuntimeEnvironment.application.getApplicationContext()).build();
    target = new AnalyticsClient(mockContext);
    AnalyticsEvent testEvent = target.createEvent(MonetizationEventBuilder.PURCHASE_EVENT_NAME);
    when(mockEventClient.createEvent(MonetizationEventBuilder.PURCHASE_EVENT_NAME)).thenReturn(testEvent);
}
Also used : AnalyticsEvent(com.amazonaws.mobileconnectors.pinpoint.analytics.AnalyticsEvent) PinpointContext(com.amazonaws.mobileconnectors.pinpoint.internal.core.PinpointContext) AnalyticsClient(com.amazonaws.mobileconnectors.pinpoint.analytics.AnalyticsClient) AnalyticsContextBuilder(com.amazonaws.mobileconnectors.pinpoint.analytics.utils.AnalyticsContextBuilder) Before(org.junit.Before)

Example 10 with AnalyticsContextBuilder

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

the class AnalyticsClientTest method setup.

@Before
public void setup() {
    MockitoAnnotations.initMocks(this);
    when(mockConfiguration.optString("versionKey", "ver")).thenReturn("ver");
    when(mockConfiguration.optBoolean("isAnalyticsEnabled", true)).thenReturn(true);
    PinpointContext mockContext = new AnalyticsContextBuilder().withSdkInfo(SDK_NAME, SDK_VERSION).withUniqueIdValue(UNIQUE_ID).withConfiguration(mockConfiguration).withContext(RuntimeEnvironment.application.getApplicationContext()).build();
    eventRecorder = EventRecorder.newInstance(mockContext, dbUtil);
    target = new AnalyticsClient(mockContext);
    target.setEventRecorder(eventRecorder);
}
Also used : PinpointContext(com.amazonaws.mobileconnectors.pinpoint.internal.core.PinpointContext) AnalyticsContextBuilder(com.amazonaws.mobileconnectors.pinpoint.analytics.utils.AnalyticsContextBuilder) 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