Search in sources :

Example 1 with MockSystem

use of com.amazonaws.mobileconnectors.pinpoint.internal.core.system.MockSystem in project aws-sdk-android by aws-amplify.

the class AWSErsLocaleTestBase method setupForRepeatedTestCase.

@Override
public void setupForRepeatedTestCase() {
    Context mockAndroidContext = new ContextWithPermissions(new Activity());
    AWSCredentialsProvider provider = new AWSCredentialsProvider() {

        AWSCredentials creds = new AnonymousAWSCredentials();

        @Override
        public AWSCredentials getCredentials() {
            return creds;
        }

        @Override
        public void refresh() {
        }
    };
    mockConfiguration = mock(AndroidPreferencesConfiguration.class);
    PinpointConfiguration options = new PinpointConfiguration(mockAndroidContext, UNIQUE_ID, Regions.US_EAST_1, ChannelType.GCM, provider);
    context = new AnalyticsContextBuilder().withSdkInfo(SDK_NAME, SDK_VERSION).withUniqueIdValue(UNIQUE_ID).withContext(RuntimeEnvironment.application.getApplicationContext()).withSystem(new MockSystem("HELLO.world")).withConfiguration(mockConfiguration).build();
    AnalyticsClient analyticsClient = new AnalyticsClient(context);
    TargetingClient targetingClient = new TargetingClient(context);
    context.setAnalyticsClient(analyticsClient);
    context.setTargetingClient(targetingClient);
    SessionClient isc = new SessionClient(context);
    PinpointConfiguration config = new PinpointConfiguration(mockAndroidContext, UNIQUE_ID, Regions.US_EAST_1, ChannelType.GCM, provider);
    instance = new PinpointManager(config);
}
Also used : Context(android.content.Context) PinpointContext(com.amazonaws.mobileconnectors.pinpoint.internal.core.PinpointContext) SessionClient(com.amazonaws.mobileconnectors.pinpoint.analytics.SessionClient) AnalyticsContextBuilder(com.amazonaws.mobileconnectors.pinpoint.analytics.utils.AnalyticsContextBuilder) ContextWithPermissions(com.amazonaws.mobileconnectors.pinpoint.analytics.utils.ContextWithPermissions) Activity(android.app.Activity) AnonymousAWSCredentials(com.amazonaws.auth.AnonymousAWSCredentials) MockSystem(com.amazonaws.mobileconnectors.pinpoint.internal.core.system.MockSystem) AnonymousAWSCredentials(com.amazonaws.auth.AnonymousAWSCredentials) AWSCredentials(com.amazonaws.auth.AWSCredentials) AnalyticsClient(com.amazonaws.mobileconnectors.pinpoint.analytics.AnalyticsClient) TargetingClient(com.amazonaws.mobileconnectors.pinpoint.targeting.TargetingClient) AndroidPreferencesConfiguration(com.amazonaws.mobileconnectors.pinpoint.internal.core.configuration.AndroidPreferencesConfiguration) AWSCredentialsProvider(com.amazonaws.auth.AWSCredentialsProvider)

Example 2 with MockSystem

use of com.amazonaws.mobileconnectors.pinpoint.internal.core.system.MockSystem 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 3 with MockSystem

use of com.amazonaws.mobileconnectors.pinpoint.internal.core.system.MockSystem 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 4 with MockSystem

use of com.amazonaws.mobileconnectors.pinpoint.internal.core.system.MockSystem 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 5 with MockSystem

use of com.amazonaws.mobileconnectors.pinpoint.internal.core.system.MockSystem 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)

Aggregations

AnalyticsContextBuilder (com.amazonaws.mobileconnectors.pinpoint.analytics.utils.AnalyticsContextBuilder)6 MockSystem (com.amazonaws.mobileconnectors.pinpoint.internal.core.system.MockSystem)6 Context (android.content.Context)5 AnalyticsClient (com.amazonaws.mobileconnectors.pinpoint.analytics.AnalyticsClient)5 PinpointContext (com.amazonaws.mobileconnectors.pinpoint.internal.core.PinpointContext)5 Before (org.junit.Before)5 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 AndroidPreferencesConfiguration (com.amazonaws.mobileconnectors.pinpoint.internal.core.configuration.AndroidPreferencesConfiguration)1 TargetingClient (com.amazonaws.mobileconnectors.pinpoint.targeting.TargetingClient)1