/** * 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.portal.upgrade.v7_0_3; import com.liferay.portal.kernel.model.Organization; import com.liferay.portal.kernel.service.OrganizationLocalServiceUtil; import com.liferay.portal.kernel.test.rule.AggregateTestRule; import com.liferay.portal.kernel.test.rule.DeleteAfterTestRun; import com.liferay.portal.kernel.test.util.OrganizationTestUtil; import com.liferay.portal.kernel.util.ArrayUtil; import com.liferay.portal.test.rule.LiferayIntegrationTestRule; import com.liferay.portal.util.PropsValues; import java.util.List; import org.junit.Assert; import org.junit.ClassRule; import org.junit.Rule; import org.junit.Test; /** * @author Manuel de la Peña */ public class UpgradeOrganizationTest { @ClassRule @Rule public static final AggregateTestRule aggregateTestRule = new LiferayIntegrationTestRule(); @Test public void testUpgrade() throws Exception { _organization = OrganizationTestUtil.addOrganization(); _organization.setType("regular-organization"); OrganizationLocalServiceUtil.updateOrganization(_organization); _upgradeOrganization.upgrade(); List<Organization> organizations = OrganizationLocalServiceUtil.getOrganizations(-1, -1); for (Organization organization : organizations) { Assert.assertTrue( ArrayUtil.contains( PropsValues.ORGANIZATIONS_TYPES, organization.getType())); } } @DeleteAfterTestRun private Organization _organization; private final UpgradeOrganization _upgradeOrganization = new UpgradeOrganization(); }