当前位置: 首页>>代码示例>>Java>>正文


Java OwnCloudClientManagerFactory类代码示例

本文整理汇总了Java中com.owncloud.android.lib.common.OwnCloudClientManagerFactory的典型用法代码示例。如果您正苦于以下问题:Java OwnCloudClientManagerFactory类的具体用法?Java OwnCloudClientManagerFactory怎么用?Java OwnCloudClientManagerFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


OwnCloudClientManagerFactory类属于com.owncloud.android.lib.common包,在下文中一共展示了OwnCloudClientManagerFactory类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: execute

import com.owncloud.android.lib.common.OwnCloudClientManagerFactory; //导入依赖的package包/类
/**
 * Synchronously executes the remote operation on the received ownCloud account.
 * 
 * Do not call this method from the main thread.
 * 
 * This method should be used whenever an ownCloud account is available, instead of
 * {@link #execute(OwnCloudClient)}.
 * 
 * @param account   ownCloud account in remote ownCloud server to reach during the
 *                  execution of the operation.
 * @param context   Android context for the component calling the method.
 * @return          Result of the operation.
 */
public RemoteOperationResult execute(Account account, Context context) {
    if (account == null)
        throw new IllegalArgumentException("Trying to execute a remote operation with a NULL " +
                "Account");
    if (context == null)
        throw new IllegalArgumentException("Trying to execute a remote operation with a NULL " +
                "Context");
    mAccount = account;
    mContext = context.getApplicationContext();
    try {
    	OwnCloudAccount ocAccount = new OwnCloudAccount(mAccount, mContext);
        mClient = OwnCloudClientManagerFactory.getDefaultSingleton().
        		getClientFor(ocAccount, mContext);
    } catch (Exception e) {
        Log_OC.e(TAG, "Error while trying to access to " + mAccount.name, e);
        return new RemoteOperationResult(e);
    }
    return run(mClient);
}
 
开发者ID:PicFrame,项目名称:picframe,代码行数:33,代码来源:RemoteOperation.java

示例2: testSetDefaultPolicy

import com.owncloud.android.lib.common.OwnCloudClientManagerFactory; //导入依赖的package包/类
public void testSetDefaultPolicy() {
	OwnCloudClientManagerFactory.setDefaultPolicy(Policy.SINGLE_SESSION_PER_ACCOUNT);
	Policy defaultPolicy = OwnCloudClientManagerFactory.getDefaultPolicy();
	assertEquals("SINGLE_SESSION_PER_ACCOUNT not set", 
			Policy.SINGLE_SESSION_PER_ACCOUNT, defaultPolicy);
	
	OwnCloudClientManagerFactory.setDefaultPolicy(Policy.ALWAYS_NEW_CLIENT);
	defaultPolicy = OwnCloudClientManagerFactory.getDefaultPolicy();
	assertEquals("ALWAYS_NEW_CLIENT not set", Policy.ALWAYS_NEW_CLIENT, defaultPolicy);
	
	try {
		OwnCloudClientManagerFactory.setDefaultPolicy(null);
		throw new AssertionFailedError("Accepted NULL parameter");
		
	} catch(Exception e) {
		assertTrue("Unexpected exception when setting default policy null", 
				(e instanceof IllegalArgumentException));
	}
	defaultPolicy = OwnCloudClientManagerFactory.getDefaultPolicy();
	assertEquals("ALWAYS_NEW_CLIENT changed after setting null", 
			Policy.ALWAYS_NEW_CLIENT, defaultPolicy);
	
}
 
开发者ID:PicFrame,项目名称:picframe,代码行数:24,代码来源:OwnCloudClientManagerFactoryTest.java

示例3: testGetDefaultSingleton

import com.owncloud.android.lib.common.OwnCloudClientManagerFactory; //导入依赖的package包/类
public void testGetDefaultSingleton() {
	OwnCloudClientManager mgr = OwnCloudClientManagerFactory.getDefaultSingleton();
	assertNotNull("Returned NULL default singleton", mgr);
	assertTrue("Default singleton does not implement default policy", 
			mgr instanceof SimpleFactoryManager);
	
	OwnCloudClientManager mgr2 = OwnCloudClientManagerFactory.getDefaultSingleton();
	assertSame("Not singleton", mgr, mgr2);
	
	OwnCloudClientManagerFactory.setDefaultPolicy(Policy.SINGLE_SESSION_PER_ACCOUNT);
	mgr = OwnCloudClientManagerFactory.getDefaultSingleton();
	assertNotNull("Returned NULL default singleton", mgr);
	assertTrue("Default singleton does not implement default policy", 
			mgr instanceof SingleSessionManager);
	
	mgr2 = OwnCloudClientManagerFactory.getDefaultSingleton();
	assertSame("Not singleton", mgr, mgr2);
}
 
开发者ID:PicFrame,项目名称:picframe,代码行数:19,代码来源:OwnCloudClientManagerFactoryTest.java

示例4: testNewDefaultOwnCloudClientManager

import com.owncloud.android.lib.common.OwnCloudClientManagerFactory; //导入依赖的package包/类
public void testNewDefaultOwnCloudClientManager() {
	OwnCloudClientManager mgr = OwnCloudClientManagerFactory.newDefaultOwnCloudClientManager();
	assertNotNull("Returned NULL default manager", mgr);
	assertTrue("New manager does not implement default policy", 
			mgr instanceof SimpleFactoryManager);
	assertNotSame("Not new instance", 
			mgr, OwnCloudClientManagerFactory.getDefaultSingleton());
	assertNotSame("Not new instance", 
			mgr, OwnCloudClientManagerFactory.newDefaultOwnCloudClientManager());
	
	OwnCloudClientManagerFactory.setDefaultPolicy(Policy.SINGLE_SESSION_PER_ACCOUNT);
	mgr = OwnCloudClientManagerFactory.newDefaultOwnCloudClientManager();
	assertNotNull("Returned NULL default manager", mgr);
	assertTrue("New manager does not implement default policy", 
			mgr instanceof SingleSessionManager);
	assertNotSame("Not new instance", 
			mgr, OwnCloudClientManagerFactory.getDefaultSingleton());
	assertNotSame("Not new instance", 
			mgr, OwnCloudClientManagerFactory.newDefaultOwnCloudClientManager());
	
}
 
开发者ID:PicFrame,项目名称:picframe,代码行数:22,代码来源:OwnCloudClientManagerFactoryTest.java

示例5: testGetDefaultPolicy

import com.owncloud.android.lib.common.OwnCloudClientManagerFactory; //导入依赖的package包/类
public void testGetDefaultPolicy() {
	Policy defaultPolicy = OwnCloudClientManagerFactory.getDefaultPolicy();
	assertNotNull("Returned null value", defaultPolicy);
	assertTrue("Returned unknown value", 
					(Policy.ALWAYS_NEW_CLIENT.equals(defaultPolicy) ||
					(Policy.SINGLE_SESSION_PER_ACCOUNT.equals(defaultPolicy))));
}
 
开发者ID:PicFrame,项目名称:picframe,代码行数:8,代码来源:OwnCloudClientManagerFactoryTest.java

示例6: testNewOwnCloudClientManager

import com.owncloud.android.lib.common.OwnCloudClientManagerFactory; //导入依赖的package包/类
public void testNewOwnCloudClientManager() {
	OwnCloudClientManager mgr = OwnCloudClientManagerFactory.
			newOwnCloudClientManager(Policy.ALWAYS_NEW_CLIENT);
	
	assertNotNull("Returned NULL manager", mgr);
	assertTrue("New manager does not implement policy ALWAYS_NEW_CLIENT", 
			mgr instanceof SimpleFactoryManager);
	assertNotSame("Not new instance", 
			mgr, OwnCloudClientManagerFactory.getDefaultSingleton());
	assertNotSame("Not new instance", 
			mgr, OwnCloudClientManagerFactory.newDefaultOwnCloudClientManager());
	assertNotSame("Not new instance", 
			mgr, OwnCloudClientManagerFactory.newOwnCloudClientManager(
					Policy.ALWAYS_NEW_CLIENT));
	
	
	OwnCloudClientManager mgr2 = OwnCloudClientManagerFactory.
			newOwnCloudClientManager(Policy.SINGLE_SESSION_PER_ACCOUNT);
	
	assertNotNull("Returned NULL manager", mgr2);
	assertTrue("New manager does not implement policy SINGLE_SESSION_PER_ACCOUNT", 
			mgr2 instanceof SingleSessionManager);
	assertNotSame("Not new instance", 
			mgr2, OwnCloudClientManagerFactory.getDefaultSingleton());
	assertNotSame("Not new instance", 
			mgr2, OwnCloudClientManagerFactory.newDefaultOwnCloudClientManager());
	assertNotSame("Not new instance", 
			mgr2, OwnCloudClientManagerFactory.newOwnCloudClientManager(
					Policy.SINGLE_SESSION_PER_ACCOUNT));
}
 
开发者ID:PicFrame,项目名称:picframe,代码行数:31,代码来源:OwnCloudClientManagerFactoryTest.java

示例7: setUp

import com.owncloud.android.lib.common.OwnCloudClientManagerFactory; //导入依赖的package包/类
@Override
protected void setUp() {
	OwnCloudClientManagerFactory.setDefaultPolicy(Policy.ALWAYS_NEW_CLIENT);
}
 
开发者ID:PicFrame,项目名称:picframe,代码行数:5,代码来源:OwnCloudClientManagerFactoryTest.java


注:本文中的com.owncloud.android.lib.common.OwnCloudClientManagerFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。