use of android.test.suitebuilder.annotation.Suppress in project 360-Engine-for-Android by 360.
the class HeartbeatSenderThreadTest method testStopConnection.
@Suppress
@MediumTest
public void testStopConnection() {
DataOutputStream dos = new DataOutputStream(new ByteArrayOutputStream());
MockTcpConnectionThread connThread = new MockTcpConnectionThread(new DecoderThread(), null);
MockHeartbeatSenderThread hbSender = new MockHeartbeatSenderThread(connThread, null, // QUICKFIX: Not sure about this value
null);
hbSender.setOutputStream(dos);
hbSender.startConnection();
try {
Thread.sleep(500);
} catch (Exception e) {
}
hbSender.stopConnection();
try {
Thread.sleep(1000);
} catch (Exception e) {
}
assertNotNull(hbSender.getConnectionThread());
if (null != hbSender.getConnectionThread()) {
assertFalse(hbSender.getConnectionThread().isAlive());
try {
dos.write(1);
fail("Should not be able to write here!");
} catch (IOException e) {
assertTrue(true);
}
}
}
use of android.test.suitebuilder.annotation.Suppress in project 360-Engine-for-Android by 360.
the class ResponseReaderThreadTest method testStartConnection.
@Suppress
@MediumTest
public void testStartConnection() {
DecoderThread decoder = new DecoderThread();
MockTcpConnectionThread mockThread = new MockTcpConnectionThread(decoder, null);
MockResponseReaderThread respReader = new MockResponseReaderThread(mockThread, decoder, // QUICKFIX: Not sure about this value
null);
MockOTAInputStream mIs = new MockOTAInputStream(new ByteArrayInputStream(new byte[] { 1, 2, 3, 4, 5 }));
respReader.setInputStream(new BufferedInputStream(mIs));
assertNull(respReader.getConnectionThread());
respReader.startConnection();
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
}
assertNotNull(respReader.getConnectionThread());
if (null != respReader.getConnectionThread()) {
assertTrue(respReader.getConnectionThread().isAlive());
}
assertTrue(respReader.getIsConnectionRunning());
}
use of android.test.suitebuilder.annotation.Suppress in project 360-Engine-for-Android by 360.
the class ContactSyncEngineTest method testAutoSyncTimer.
/**
* Checks that nothing is scheduled before the first time sync has been
* completed.
*/
@Suppress
public void testAutoSyncTimer() {
Log.i(LOG_TAG, "**** testAutoSyncTimer() begin ****");
final IEngineEventCallback engineEventCallback = new HelperClasses.EngineCallbackBase() {
@Override
public void onUiEvent(ServiceUiRequest event, int request, int status, Object data) {
Log.i(LOG_TAG, "onUiEvent: " + event + ", " + request + ", " + status + ", " + data);
}
};
final ProcessorFactory factory = new ProcessorFactory() {
@Override
public BaseSyncProcessor create(int type, IContactSyncCallback callback, DatabaseHelper dbHelper) {
Log.i(LOG_TAG, "create(), type=" + type);
return new DummySyncProcessor(mContactSyncEngine, null);
}
};
minimalEngineSetup(engineEventCallback, factory);
// set the connection to be fine
NetworkAgent.setAgentState(NetworkAgent.AgentState.CONNECTED);
// should be equal to -1 because first time sync has not been yet
// started
assertEquals(-1, mContactSyncEngine.getNextRunTime());
mContactSyncEngine.run();
assertEquals(-1, mContactSyncEngine.getNextRunTime());
mContactSyncEngine.run();
assertEquals(-1, mContactSyncEngine.getNextRunTime());
Log.i(LOG_TAG, "**** testAutoSyncTimer() end ****");
}
use of android.test.suitebuilder.annotation.Suppress in project 360-Engine-for-Android by 360.
the class ContactSyncEngineTest method testFirstTimeSync_dummyReplies.
/**
* Verifies that the first time sync can perform correctly with dummy
* replies doing no modifications.
*/
@Suppress
public // Breaks tests.
void testFirstTimeSync_dummyReplies() {
Log.i(LOG_TAG, "**** testFirstTimeSync_dummyReplies ****");
final FirstTimeSyncFrameworkHandler handler = new FirstTimeSyncFrameworkHandler();
setUpContactSyncEngineTestFramework(handler, null);
handler.setContactSyncEngine(mContactSyncEngine);
NetworkAgent.setAgentState(AgentState.CONNECTED);
mContactSyncEngine.addUiStartFullSync();
ServiceStatus status = mEngineTester.waitForEvent();
Log.d(LOG_TAG, "AFTER waitForEvent()");
assertEquals(ServiceStatus.SUCCESS, status);
}
use of android.test.suitebuilder.annotation.Suppress in project 360-Engine-for-Android by 360.
the class ContactSyncEngineTest method testUiRequestCompleteEvent_serverSync.
/**
* Verifies that server sync completes correctly.
*/
@Suppress
public // Breaks tests.
void testUiRequestCompleteEvent_serverSync() {
Log.i(LOG_TAG, "**** testUiRequestCompleteEvent_serverSync() begin ****");
final UiEventCall uiEventCall = new UiEventCall();
final IEngineEventCallback engineEventCallback = new HelperClasses.EngineCallbackBase() {
@Override
public void onUiEvent(ServiceUiRequest event, int request, int status, Object data) {
Log.i(LOG_TAG, "onUiEvent: " + event + ", " + request + ", " + status + ", " + data);
uiEventCall.event = event.ordinal();
uiEventCall.request = request;
uiEventCall.status = status;
uiEventCall.data = data;
}
};
final ProcessorFactory factory = new ProcessorFactory() {
@Override
public BaseSyncProcessor create(int type, IContactSyncCallback callback, DatabaseHelper dbHelper) {
Log.i(LOG_TAG, "create(), type=" + type);
return new DummySyncProcessor(mContactSyncEngine, null);
}
};
minimalEngineSetup(engineEventCallback, factory);
NetworkAgent.setAgentState(NetworkAgent.AgentState.CONNECTED);
long nextRuntime = mContactSyncEngine.getNextRunTime();
// should be equal to -1 because first time sync has not been yet
// started
assertEquals(-1, nextRuntime);
// set the connection to be fine
NetworkAgent.setAgentState(AgentState.CONNECTED);
// ask for a full sync
mContactSyncEngine.addUiStartFullSync();
nextRuntime = mContactSyncEngine.getNextRunTime();
assertEquals(0, nextRuntime);
mContactSyncEngine.run();
// check that first time sync is completed
assertEquals(ServiceUiRequest.UI_REQUEST_COMPLETE.ordinal(), uiEventCall.event);
assertEquals(uiEventCall.status, ServiceStatus.SUCCESS.ordinal());
// check that first time sync is completed
assertEquals(ServiceUiRequest.UI_REQUEST_COMPLETE.ordinal(), uiEventCall.event);
assertEquals(uiEventCall.status, ServiceStatus.SUCCESS.ordinal());
Log.i(LOG_TAG, "**** testUiRequestCompleteEvent_serverSync() end ****");
}
Aggregations