• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ContentUsageImpl类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: setUp

import org.alfresco.repo.usage.ContentUsageImpl; //导入依赖的package包/类
@Override
protected void setUp() throws Exception
{
    super.setUp();
    MockitoAnnotations.initMocks(this);

    ApplicationContext ctx = getServer().getApplicationContext();
    this.authenticationService = (MutableAuthenticationService)ctx.getBean("AuthenticationService");
    this.authenticationComponent = (AuthenticationComponent)ctx.getBean("authenticationComponent");
    this.personService = (PersonService)ctx.getBean("PersonService");
    this.userNameMatcherImpl = (UserNameMatcherImpl)ctx.getBean("userNameMatcher");
    this.nodeService = (NodeService)ctx.getBean("NodeService");
    this.contentService = (ContentService)ctx.getBean("contentService");
    this.userUsageTrackingComponent = (UserUsageTrackingComponent)ctx.getBean("userUsageTrackingComponent");
    this.contentUsage = (ContentUsageImpl)ctx.getBean("contentUsageImpl");
    this.transactionService = (TransactionService) ctx.getBean("TransactionService");

	serviceRegistry = (ServiceDescriptorRegistry) ctx.getBean("ServiceRegistry");
	serviceRegistry.setMockSearchService(mockSearchService);
    when(mockSearchService.query(any())).thenReturn(mockSearchServiceQueryResultSet);
    when(mockSearchServiceQueryResultSet.getNodeRefs()).thenReturn(dummySearchServiceQueryNodeRefs);

    // enable usages
    contentUsage.setEnabled(true);
    contentUsage.init();
    userUsageTrackingComponent.setEnabled(true);
    userUsageTrackingComponent.init();
    userUsageTrackingComponent.bootstrapInternal();

    this.authenticationComponent.setSystemUserAsCurrentUser();

    // Create users
    createUser(USER_ONE);
    createUser(USER_TWO);
    createUser(USER_THREE);
    
    // Do tests as user one
    this.authenticationComponent.setCurrentUser(USER_ONE);
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:40,代码来源:PersonServiceTest.java


示例2: testFtpQuotaAndFtp

import org.alfresco.repo.usage.ContentUsageImpl; //导入依赖的package包/类
/**
 * Test a quota failue exception over FTP.
 * A file should not exist after a create and quota exception. 
 */
public void testFtpQuotaAndFtp() throws Exception
{
    // Enable usages
    ContentUsageImpl contentUsage = (ContentUsageImpl)applicationContext.getBean("contentUsageImpl");
    contentUsage.setEnabled(true);
    contentUsage.init();
    UserUsageTrackingComponent userUsageTrackingComponent = (UserUsageTrackingComponent)applicationContext.getBean("userUsageTrackingComponent");
    userUsageTrackingComponent.setEnabled(true);
    userUsageTrackingComponent.bootstrapInternal();
    
    final String TEST_DIR="/Alfresco/User Homes/" + USER_THREE;
 
    FTPClient ftpOne = connectClient();
    try
    {
        int reply = ftpOne.getReplyCode();

        if (!FTPReply.isPositiveCompletion(reply))
        {
            fail("FTP server refused connection.");
        }
            
        boolean login = ftpOne.login(USER_THREE, PASSWORD_THREE);
        assertTrue("user three login not successful", login);
                    
        boolean success = ftpOne.changeWorkingDirectory("Alfresco");
        assertTrue("user three unable to cd to Alfreco", success);
        success = ftpOne.changeWorkingDirectory("User*Homes");
        assertTrue("user one unable to cd to User*Homes", success);
        success = ftpOne.changeWorkingDirectory(USER_THREE);
        assertTrue("user one unable to cd to " + USER_THREE, success);
        
        /**
         * Create a file as user three which is bigger than the quota
         */
        String FILE3_CONTENT_3="test file 3 content that needs to be greater than 100 bytes to result in a quota exception being thrown";
        String FILE1_NAME = "test.docx";

        // Should not be success
        success = ftpOne.appendFile(FILE1_NAME , new ByteArrayInputStream(FILE3_CONTENT_3.getBytes("UTF-8")));
        assertFalse("user one can ignore quota", success);
            
        boolean deleted = ftpOne.deleteFile(FILE1_NAME);
        assertFalse("quota exception expected", deleted);
        
        logger.debug("test done");
                 
    } 
    finally
    {
        // Disable usages
        contentUsage.setEnabled(false);
        contentUsage.init();
        userUsageTrackingComponent.setEnabled(false);
        userUsageTrackingComponent.bootstrapInternal();
        
        
        ftpOne.dele(TEST_DIR);
        if(ftpOne != null)
        {
            ftpOne.disconnect();
        }
    }       

}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:70,代码来源:FTPServerTest.java


示例3: setContentUsageImpl

import org.alfresco.repo.usage.ContentUsageImpl; //导入依赖的package包/类
/**
 * When all behaviour is disabled it is necessary to use {@link ContentUsageImpl}
 * directly to update user usage. An instance of this class (with ID
 * <code>importerComponentWithBehaviour</code>) that does not disable
 * behaviours is also defined in the system - in that case it should not reference
 * the {@link ContentUsageImpl} collaborator.
 * 
 * @param contentUsageImpl the contentUsageImpl to set
 */
public void setContentUsageImpl(ContentUsageImpl contentUsageImpl)
{
    this.contentUsageImpl = contentUsageImpl;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:14,代码来源:ImporterComponent.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java StreamJoinAnalysisResult类代码示例发布时间:2022-05-16
下一篇:
Java BohnetHelper类代码示例发布时间:2022-05-16
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap