Search in sources :

Example 1 with EnvironmentCurator

use of org.candlepin.model.EnvironmentCurator in project candlepin by candlepin.

the class ProductExporterTest method testProductExport.

@Test
public void testProductExport() throws IOException {
    ObjectMapper mapper = TestSyncUtils.getTestSyncUtils(new MapConfiguration(new HashMap<String, String>() {

        {
            put(ConfigProperties.FAIL_ON_UNKNOWN_IMPORT_PROPERTIES, "false");
        }
    }));
    ProductExporter exporter = new ProductExporter(new StandardTranslator(new ConsumerTypeCurator(), new EnvironmentCurator(), new OwnerCurator()));
    StringWriter writer = new StringWriter();
    Owner owner = TestUtil.createOwner("Example-Corporation");
    Product product = TestUtil.createProduct("my-id", "product name");
    exporter.export(mapper, writer, product);
    String s = writer.toString();
    assertTrue(s.contains("\"name\":\"product name\""));
    assertTrue(s.contains("\"id\":\"my-id\""));
    assertTrue(s.contains("\"productContent\":[]"));
    assertTrue(s.contains("\"attributes\":[]"));
    assertTrue(s.contains("\"multiplier\":1"));
}
Also used : OwnerCurator(org.candlepin.model.OwnerCurator) Owner(org.candlepin.model.Owner) ConsumerTypeCurator(org.candlepin.model.ConsumerTypeCurator) StringWriter(java.io.StringWriter) HashMap(java.util.HashMap) MapConfiguration(org.candlepin.common.config.MapConfiguration) Product(org.candlepin.model.Product) EnvironmentCurator(org.candlepin.model.EnvironmentCurator) StandardTranslator(org.candlepin.dto.StandardTranslator) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Test(org.junit.Test)

Example 2 with EnvironmentCurator

use of org.candlepin.model.EnvironmentCurator in project candlepin by candlepin.

the class SubscriptionReconcilerTest method init.

@Before
public void init() {
    this.owner = new Owner();
    this.reconciler = new SubscriptionReconciler(this.poolCurator);
    this.translator = new StandardTranslator(new ConsumerTypeCurator(), new EnvironmentCurator(), new OwnerCurator());
    i18n = I18nFactory.getI18n(getClass(), Locale.US, I18nFactory.FALLBACK);
    this.importer = new EntitlementImporter(certSerialCurator, cdnCurator, i18n, pc, ec, translator);
}
Also used : OwnerCurator(org.candlepin.model.OwnerCurator) Owner(org.candlepin.model.Owner) ConsumerTypeCurator(org.candlepin.model.ConsumerTypeCurator) EnvironmentCurator(org.candlepin.model.EnvironmentCurator) StandardTranslator(org.candlepin.dto.StandardTranslator) Before(org.junit.Before)

Aggregations

StandardTranslator (org.candlepin.dto.StandardTranslator)2 ConsumerTypeCurator (org.candlepin.model.ConsumerTypeCurator)2 EnvironmentCurator (org.candlepin.model.EnvironmentCurator)2 Owner (org.candlepin.model.Owner)2 OwnerCurator (org.candlepin.model.OwnerCurator)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 StringWriter (java.io.StringWriter)1 HashMap (java.util.HashMap)1 MapConfiguration (org.candlepin.common.config.MapConfiguration)1 Product (org.candlepin.model.Product)1 Before (org.junit.Before)1 Test (org.junit.Test)1