Example usage for com.liferay.portal.kernel.test.util TestPropsValues getCompanyId

List of usage examples for com.liferay.portal.kernel.test.util TestPropsValues getCompanyId

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.test.util TestPropsValues getCompanyId.

Prototype

public static long getCompanyId() throws PortalException 

Source Link

Usage

From source file:com.liferay.adaptive.media.image.internal.configuration.test.AMImageAddConfigurationTest.java

License:Open Source License

@Test
public void testAddConfigurationEntryWithBlankDescription() throws Exception {

    Map<String, String> properties = new HashMap<>();

    properties.put("max-height", "100");
    properties.put("max-width", "100");

    _amImageConfigurationHelper.addAMImageConfigurationEntry(TestPropsValues.getCompanyId(), "one",
            StringPool.BLANK, "1", properties);

    Optional<AMImageConfigurationEntry> amImageConfigurationEntryOptional = _amImageConfigurationHelper
            .getAMImageConfigurationEntry(TestPropsValues.getCompanyId(), "1");

    Assert.assertTrue(amImageConfigurationEntryOptional.isPresent());

    AMImageConfigurationEntry amImageConfigurationEntry = amImageConfigurationEntryOptional.get();

    Assert.assertEquals(StringPool.BLANK, amImageConfigurationEntry.getDescription());
}

From source file:com.liferay.adaptive.media.image.internal.configuration.test.AMImageAddConfigurationTest.java

License:Open Source License

@Test
public void testAddConfigurationEntryWithBlankMaxHeight() throws Exception {
    Map<String, String> properties = new HashMap<>();

    properties.put("max-height", "");
    properties.put("max-width", "100");

    _amImageConfigurationHelper.addAMImageConfigurationEntry(TestPropsValues.getCompanyId(), "one", "desc", "1",
            properties);//from  w  w w  . ja v  a  2  s .com

    Optional<AMImageConfigurationEntry> amImageConfigurationEntryOptional = _amImageConfigurationHelper
            .getAMImageConfigurationEntry(TestPropsValues.getCompanyId(), "1");

    Assert.assertTrue(amImageConfigurationEntryOptional.isPresent());

    AMImageConfigurationEntry amImageConfigurationEntry = amImageConfigurationEntryOptional.get();

    Map<String, String> actualProperties = amImageConfigurationEntry.getProperties();

    Assert.assertEquals("0", actualProperties.get("max-height"));
    Assert.assertEquals("100", actualProperties.get("max-width"));
}

From source file:com.liferay.adaptive.media.image.internal.configuration.test.AMImageAddConfigurationTest.java

License:Open Source License

@Test(expected = AMImageConfigurationException.RequiredWidthOrHeightException.class)
public void testAddConfigurationEntryWithBlankMaxHeightAndBlankMaxWidth() throws Exception {

    Map<String, String> properties = new HashMap<>();

    properties.put("max-height", "");
    properties.put("max-width", "");

    _amImageConfigurationHelper.addAMImageConfigurationEntry(TestPropsValues.getCompanyId(), "one", "desc", "1",
            properties);/*from  w  w w  .j  a  v  a2s .  c  o m*/
}

From source file:com.liferay.adaptive.media.image.internal.configuration.test.AMImageAddConfigurationTest.java

License:Open Source License

@Test(expected = AMImageConfigurationException.RequiredWidthOrHeightException.class)
public void testAddConfigurationEntryWithBlankMaxHeightAndZeroMaxWidth() throws Exception {

    Map<String, String> properties = new HashMap<>();

    properties.put("max-height", "");
    properties.put("max-width", "0");

    _amImageConfigurationHelper.addAMImageConfigurationEntry(TestPropsValues.getCompanyId(), "one", "desc", "1",
            properties);/*w  w  w  .j ava  2 s .  co  m*/
}

From source file:com.liferay.adaptive.media.image.internal.configuration.test.AMImageAddConfigurationTest.java

License:Open Source License

@Test(expected = AMImageConfigurationException.RequiredWidthOrHeightException.class)
public void testAddConfigurationEntryWithBlankMaxHeightOnly() throws Exception {

    Map<String, String> properties = new HashMap<>();

    properties.put("max-height", "");

    _amImageConfigurationHelper.addAMImageConfigurationEntry(TestPropsValues.getCompanyId(), "one", "desc", "1",
            properties);//ww  w  .  j  a  v  a 2 s  .  com
}

From source file:com.liferay.adaptive.media.image.internal.configuration.test.AMImageAddConfigurationTest.java

License:Open Source License

@Test
public void testAddConfigurationEntryWithBlankMaxWidth() throws Exception {
    Map<String, String> properties = new HashMap<>();

    properties.put("max-height", "100");
    properties.put("max-width", "");

    _amImageConfigurationHelper.addAMImageConfigurationEntry(TestPropsValues.getCompanyId(), "one", "desc", "1",
            properties);//from w  w  w  .j  a va 2  s.co  m

    Optional<AMImageConfigurationEntry> amImageConfigurationEntryOptional = _amImageConfigurationHelper
            .getAMImageConfigurationEntry(TestPropsValues.getCompanyId(), "1");

    Assert.assertTrue(amImageConfigurationEntryOptional.isPresent());

    AMImageConfigurationEntry amImageConfigurationEntry = amImageConfigurationEntryOptional.get();

    Map<String, String> actualProperties = amImageConfigurationEntry.getProperties();

    Assert.assertEquals("100", actualProperties.get("max-height"));
    Assert.assertEquals("0", actualProperties.get("max-width"));
}

From source file:com.liferay.adaptive.media.image.internal.configuration.test.AMImageAddConfigurationTest.java

License:Open Source License

@Test(expected = AMImageConfigurationException.RequiredWidthOrHeightException.class)
public void testAddConfigurationEntryWithBlankMaxWidthOnly() throws Exception {

    Map<String, String> properties = new HashMap<>();

    properties.put("max-width", "");

    _amImageConfigurationHelper.addAMImageConfigurationEntry(TestPropsValues.getCompanyId(), "one", "desc", "1",
            properties);/*from   ww  w.j  a  v a 2 s .c om*/
}

From source file:com.liferay.adaptive.media.image.internal.configuration.test.AMImageAddConfigurationTest.java

License:Open Source License

@Test(expected = AMImageConfigurationException.InvalidNameException.class)
public void testAddConfigurationEntryWithBlankName() throws Exception {
    Map<String, String> properties = new HashMap<>();

    properties.put("max-height", "100");
    properties.put("max-width", "100");

    _amImageConfigurationHelper.addAMImageConfigurationEntry(TestPropsValues.getCompanyId(), StringPool.BLANK,
            "desc", "1", properties);
}

From source file:com.liferay.adaptive.media.image.internal.configuration.test.AMImageAddConfigurationTest.java

License:Open Source License

@Test(expected = AMImageConfigurationException.InvalidUuidException.class)
public void testAddConfigurationEntryWithBlankUuid() throws Exception {
    Map<String, String> properties = new HashMap<>();

    properties.put("max-height", "100");
    properties.put("max-width", "100");

    _amImageConfigurationHelper.addAMImageConfigurationEntry(TestPropsValues.getCompanyId(), "one", "desc",
            StringPool.BLANK, properties);
}

From source file:com.liferay.adaptive.media.image.internal.configuration.test.AMImageAddConfigurationTest.java

License:Open Source License

@Test
public void testAddConfigurationEntryWithColonSemicolonDescription() throws Exception {

    Map<String, String> properties = new HashMap<>();

    properties.put("max-height", "100");

    _amImageConfigurationHelper.addAMImageConfigurationEntry(TestPropsValues.getCompanyId(), "one",
            "desc:;desc", "1", properties);

    Optional<AMImageConfigurationEntry> amImageConfigurationEntryOptional = _amImageConfigurationHelper
            .getAMImageConfigurationEntry(TestPropsValues.getCompanyId(), "1");

    Assert.assertTrue(amImageConfigurationEntryOptional.isPresent());

    AMImageConfigurationEntry amImageConfigurationEntry = amImageConfigurationEntryOptional.get();

    Assert.assertEquals("desc:;desc", amImageConfigurationEntry.getDescription());
}