/** * 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.exportimport.trash.test; import com.liferay.arquillian.extension.junit.bridge.junit.Arquillian; import com.liferay.exportimport.kernel.configuration.ExportImportConfigurationConstants; import com.liferay.exportimport.kernel.model.ExportImportConfiguration; import com.liferay.exportimport.kernel.service.ExportImportConfigurationLocalServiceUtil; import com.liferay.exportimport.trash.test.util.ExportImportConfigurationTestUtil; import com.liferay.portal.kernel.model.BaseModel; import com.liferay.portal.kernel.model.Group; 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.TestPropsValues; import com.liferay.portal.test.rule.LiferayIntegrationTestRule; import com.liferay.trash.test.util.BaseTrashHandlerTestCase; import org.junit.ClassRule; import org.junit.Rule; import org.junit.runner.RunWith; /** * @author Levente Hudak */ @RunWith(Arquillian.class) @Sync public class ExportImportConfigurationTrashHandlerTest extends BaseTrashHandlerTestCase { @ClassRule @Rule public static final AggregateTestRule aggregateTestRule = new AggregateTestRule( new LiferayIntegrationTestRule(), SynchronousDestinationTestRule.INSTANCE); @Override protected BaseModel<?> addBaseModelWithWorkflow( BaseModel<?> parentBaseModel, ServiceContext serviceContext) throws Exception { Group group = (Group)parentBaseModel; return ExportImportConfigurationTestUtil.addExportImportConfiguration( group.getGroupId(), ExportImportConfigurationConstants.TYPE_EXPORT_LAYOUT); } @Override protected BaseModel<?> getBaseModel(long primaryKey) throws Exception { return ExportImportConfigurationLocalServiceUtil. getExportImportConfiguration(primaryKey); } @Override protected Class<?> getBaseModelClass() { return ExportImportConfiguration.class; } @Override protected int getNotInTrashBaseModelsCount(BaseModel<?> parentBaseModel) throws Exception { return ExportImportConfigurationLocalServiceUtil. getExportImportConfigurationsCount( (Long)parentBaseModel.getPrimaryKeyObj()); } @Override protected String getUniqueTitle(BaseModel<?> baseModel) { return null; } @Override protected void moveBaseModelToTrash(long primaryKey) throws Exception { ExportImportConfigurationLocalServiceUtil. moveExportImportConfigurationToTrash( TestPropsValues.getUserId(), primaryKey); } }