/** * Copyright (c) 2000-present Liferay, Inc. All rights reserved. * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. */ package com.liferay.message.boards.social.test; import com.liferay.arquillian.extension.junit.bridge.junit.Arquillian; import com.liferay.message.boards.kernel.model.MBCategoryConstants; import com.liferay.message.boards.kernel.model.MBMessage; import com.liferay.message.boards.kernel.model.MBThread; import com.liferay.message.boards.kernel.service.MBMessageLocalServiceUtil; import com.liferay.message.boards.kernel.service.MBThreadLocalServiceUtil; import com.liferay.portal.kernel.service.ServiceContext; import com.liferay.portal.kernel.test.rule.AggregateTestRule; import com.liferay.portal.kernel.test.rule.Sync; import com.liferay.portal.kernel.test.rule.SynchronousDestinationTestRule; import com.liferay.portal.kernel.test.util.RandomTestUtil; import com.liferay.portal.kernel.test.util.ServiceContextTestUtil; import com.liferay.portal.kernel.test.util.TestPropsValues; import com.liferay.portal.test.rule.LiferayIntegrationTestRule; import com.liferay.social.kernel.model.SocialActivityConstants; import org.junit.ClassRule; import org.junit.Rule; import org.junit.runner.RunWith; /** * @author Zsolt Berentey */ @RunWith(Arquillian.class) @Sync public class MBThreadActivityInterpreterTest extends BaseMBSocialActivityInterpreterTestCase { @ClassRule @Rule public static final AggregateTestRule aggregateTestRule = new AggregateTestRule( new LiferayIntegrationTestRule(), SynchronousDestinationTestRule.INSTANCE); @Override protected void addActivities() throws Exception { ServiceContext serviceContext = ServiceContextTestUtil.getServiceContext( group.getGroupId(), TestPropsValues.getUserId()); MBMessage message = MBMessageLocalServiceUtil.addMessage( TestPropsValues.getUserId(), RandomTestUtil.randomString(), group.getGroupId(), MBCategoryConstants.DEFAULT_PARENT_CATEGORY_ID, RandomTestUtil.randomString(), RandomTestUtil.randomString(), serviceContext); _threadId = message.getThreadId(); } @Override protected int[] getActivityTypes() { return new int[] { SocialActivityConstants.TYPE_MOVE_TO_TRASH, SocialActivityConstants.TYPE_RESTORE_FROM_TRASH }; } @Override protected String getClassName() { return MBThread.class.getName(); } @Override protected boolean isSupportsRename(String className) { return false; } @Override protected void moveModelsToTrash() throws Exception { MBThreadLocalServiceUtil.moveThreadsToTrash( group.getGroupId(), TestPropsValues.getUserId()); } @Override protected void renameModels() throws Exception { } @Override protected void restoreModelsFromTrash() throws Exception { MBThreadLocalServiceUtil.restoreThreadFromTrash( TestPropsValues.getUserId(), _threadId); } private long _threadId; }