本文整理汇总了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;未经允许,请勿转载。 |
请发表评论