use of org.candlepin.jackson.ProductCachedSerializationModule in project candlepin by candlepin.
the class InstalledProductStatusCalculatorTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
translator = new StandardTranslator(this.consumerTypeCurator, this.environmentCurator, this.ownerCurator);
// Load the default production rules:
InputStream is = this.getClass().getResourceAsStream(RulesCurator.DEFAULT_RULES_FILE);
Rules rules = new Rules(Util.readFile(is));
Locale locale = new Locale("en_US");
when(rulesCuratorMock.getUpdated()).thenReturn(new Date());
when(rulesCuratorMock.getRules()).thenReturn(rules);
when(cacheProvider.get()).thenReturn(cache);
this.provider = new JsRunnerProvider(rulesCuratorMock, cacheProvider);
i18n = I18nFactory.getI18n(getClass(), "org.candlepin.i18n.Messages", locale, I18nFactory.FALLBACK);
RulesObjectMapper objectMapper = new RulesObjectMapper(new ProductCachedSerializationModule(productCurator));
this.complianceRules = new ComplianceRules(provider.get(), this.entCurator, new StatusReasonMessageGenerator(i18n), eventSink, this.consumerCurator, this.consumerTypeCurator, objectMapper, translator);
this.consumerEnricher = new ConsumerEnricher(this.complianceRules, this.ownerProductCurator);
}
use of org.candlepin.jackson.ProductCachedSerializationModule in project candlepin by candlepin.
the class JsonProviderTest method dateFormat.
// This is kind of silly - basically just testing an initial setting...
@Test
public void dateFormat() {
JsonProvider provider = new JsonProvider(config, new ProductCachedSerializationModule(productCurator));
boolean datesAsTimestamps = isEnabled(provider, SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
assertFalse(datesAsTimestamps);
}
use of org.candlepin.jackson.ProductCachedSerializationModule in project candlepin by candlepin.
the class ImporterTest method init.
@Before
public void init() throws URISyntaxException, IOException {
mapper = TestSyncUtils.getTestSyncUtils(new MapConfiguration(new HashMap<String, String>() {
{
put(ConfigProperties.FAIL_ON_UNKNOWN_IMPORT_PROPERTIES, "false");
}
}));
i18n = I18nFactory.getI18n(getClass(), Locale.US, I18nFactory.FALLBACK);
config = new CandlepinCommonTestConfig();
pc = Mockito.mock(ProductCurator.class);
ec = Mockito.mock(EntitlementCurator.class);
this.environmentCurator = Mockito.mock(EnvironmentCurator.class);
ProductCachedSerializationModule productCachedModule = new ProductCachedSerializationModule(pc);
su = new SyncUtils(config, productCachedModule);
PrintStream ps = new PrintStream(new File(this.getClass().getClassLoader().getResource("version.properties").toURI()));
ps.println("version=0.0.3");
ps.println("release=1");
ps.close();
mockJsPath = new File(folder.getRoot(), "empty.js").getPath();
this.mockSubReconciler = Mockito.mock(SubscriptionReconciler.class);
this.consumerTypeCurator = Mockito.mock(ConsumerTypeCurator.class);
oc = mock(OwnerCurator.class);
this.translator = new StandardTranslator(this.consumerTypeCurator, this.environmentCurator, this.oc);
}
use of org.candlepin.jackson.ProductCachedSerializationModule in project candlepin by candlepin.
the class ExporterTest method setUp.
@Before
public void setUp() {
ctc = mock(ConsumerTypeCurator.class);
mockEnvironmentCurator = mock(EnvironmentCurator.class);
oc = mock(OwnerCurator.class);
me = new MetaExporter();
translator = new StandardTranslator(ctc, mockEnvironmentCurator, oc);
ce = new ConsumerExporter(translator);
cte = new ConsumerTypeExporter(translator);
rc = mock(RulesCurator.class);
re = new RulesExporter(rc);
ece = new EntitlementCertExporter();
ecsa = mock(EntitlementCertServiceAdapter.class);
pe = new ProductExporter(translator);
psa = mock(ProductServiceAdapter.class);
pce = new ProductCertExporter();
ec = mock(EntitlementCurator.class);
ee = new EntitlementExporter(translator);
pki = mock(PKIUtility.class);
config = new CandlepinCommonTestConfig();
exportRules = mock(ExportRules.class);
pprov = mock(PrincipalProvider.class);
dvc = mock(DistributorVersionCurator.class);
dve = new DistributorVersionExporter();
cdnc = mock(CdnCurator.class);
cdne = new CdnExporter();
pc = mock(ProductCurator.class);
ProductCachedSerializationModule productCachedModule = new ProductCachedSerializationModule(pc);
su = new SyncUtils(config, productCachedModule);
exportExtensionAdapter = mock(ExportExtensionAdapter.class);
when(exportRules.canExport(any(Entitlement.class))).thenReturn(Boolean.TRUE);
}
use of org.candlepin.jackson.ProductCachedSerializationModule in project candlepin by candlepin.
the class TestSyncUtils method getTestSyncUtils.
public static ObjectMapper getTestSyncUtils(Configuration config) {
ProductCurator mockProductCurator = Mockito.mock(ProductCurator.class);
ProductCachedSerializationModule productCachedModule = new ProductCachedSerializationModule(mockProductCurator);
return new SyncUtils(config, productCachedModule).getObjectMapper();
}
Aggregations