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());
}
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);
}
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());
}
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);
}
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);
}
Aggregations