Search in sources :

Example 1 with NetworkAgent

use of com.vodafone360.people.service.agent.NetworkAgent in project 360-Engine-for-Android by 360.

the class RemoteService method onCreate.

/**
 * Creation of RemoteService. Loads properties (i.e. supported features,
 * server URLs etc) from SettingsManager. Creates IPeopleServiceImpl,
 * NetworkAgent. Connects ConnectionManager creating Connection thread(s)
 * and DecoderThread 'Kicks' worker thread.
 */
@Override
public void onCreate() {
    LogUtils.logV("RemoteService.onCreate()");
    SettingsManager.loadProperties(this);
    mIPeopleServiceImpl = new PeopleServiceImpl(this, this);
    mNetworkAgent = new NetworkAgent(this, this, this);
    // Create NativeContactsApi here to access Application Context
    NativeContactsApi.createInstance(getApplicationContext());
    EngineManager.createEngineManager(this, mIPeopleServiceImpl);
    mNetworkAgent.onCreate();
    mIPeopleServiceImpl.setNetworkAgent(mNetworkAgent);
    /**
     * The service has now been fully initialised. *
     */
    mIsStarted = true;
    kickWorkerThread();
    final MainApplication mainApp = (MainApplication) getApplication();
    mainApp.setServiceInterface(mIPeopleServiceImpl);
    if (VersionUtils.is2XPlatform()) {
        mAccountsObjectsHolder = new NativeAccountObjectsHolder(((MainApplication) getApplication()));
    }
    final UserDataProtection userDataProtection = new UserDataProtection(this, mainApp.getDatabase());
    userDataProtection.performStartupChecks();
}
Also used : NetworkAgent(com.vodafone360.people.service.agent.NetworkAgent) UserDataProtection(com.vodafone360.people.service.utils.UserDataProtection) MainApplication(com.vodafone360.people.MainApplication)

Example 2 with NetworkAgent

use of com.vodafone360.people.service.agent.NetworkAgent in project 360-Engine-for-Android by 360.

the class UpgradeEngineTest method setUp.

// private NetworkAgent mAgent;
@Override
protected void setUp() throws Exception {
    // TODO Auto-generated method stub
    super.setUp();
    SettingsManager.loadProperties(getContext());
    SettingsManager.setProperty(Settings.UPGRADE_CHECK_URL_KEY, UPGRADE_URL_DUMMY);
    // mAgent = new NetworkAgent(null, null, null);
    mUpgradeEngine = new UpgradeEngine(getContext(), this);
}
Also used : UpgradeEngine(com.vodafone360.people.engine.upgrade.UpgradeEngine)

Example 3 with NetworkAgent

use of com.vodafone360.people.service.agent.NetworkAgent in project 360-Engine-for-Android by 360.

the class RemoteServiceTest method testGetNetworkAgent.

/**
 * Test getNetworkAgent() from RemoteService.
 */
@MediumTest
public final void testGetNetworkAgent() {
    /**
     * Setup test preconditions (i.e. remoteService running). *
     */
    startService(new Intent(getContext(), RemoteService.class));
    RemoteService remoteService = getService();
    assertNotNull("RemoteService should not be NULL", remoteService);
    /**
     * Perform test (i.e. disconnect). *
     */
    NetworkAgent networkAgent = remoteService.getNetworkAgent();
    /**
     * Test NetworkAgent object. *
     */
    assertNotNull("NetworkAgent should not be NULL", networkAgent);
    assertEquals("NetworkAgent RoamingDeviceSetting should be FALSE", false, networkAgent.getRoamingDeviceSetting());
    assertEquals("NetworkAgent RoamingNotificationType should be ROAMING_DIALOG_GLOBAL_OFF", NetworkAgent.ROAMING_DIALOG_GLOBAL_OFF, networkAgent.getRoamingNotificationType());
    assertEquals("NetworkAgent AgentState should be CONNECTED", AgentState.CONNECTED, NetworkAgent.getAgentState());
}
Also used : NetworkAgent(com.vodafone360.people.service.agent.NetworkAgent) RemoteService(com.vodafone360.people.service.RemoteService) Intent(android.content.Intent) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Aggregations

NetworkAgent (com.vodafone360.people.service.agent.NetworkAgent)2 Intent (android.content.Intent)1 MediumTest (android.test.suitebuilder.annotation.MediumTest)1 MainApplication (com.vodafone360.people.MainApplication)1 UpgradeEngine (com.vodafone360.people.engine.upgrade.UpgradeEngine)1 RemoteService (com.vodafone360.people.service.RemoteService)1 UserDataProtection (com.vodafone360.people.service.utils.UserDataProtection)1