コード例 #1
0
  /** Configure export query with specific product export criteria. */
  private void setUpExportContextWithProductExportCriteria() {
    exportConfiguration = new ExportConfiguration();

    ExporterConfiguration exporterConfiguration = new ExporterConfiguration();
    List<OptionalExporterConfiguration> optionalExporterConfigurationList =
        new ArrayList<OptionalExporterConfiguration>();

    OptionalExporterConfiguration optionalExporterConfiguration =
        new OptionalExporterConfiguration();
    optionalExporterConfiguration.setType(JobType.PRODUCTASSOCIATION);
    List<ConfigurationOption> options = new ArrayList<ConfigurationOption>();
    ConfigurationOption option = new ConfigurationOption();
    option.setKey(ProductExporterImpl.DIRECT_ONLY);
    option.setValue(Boolean.TRUE.toString());
    options.add(option);
    optionalExporterConfiguration.setOptions(options);
    optionalExporterConfigurationList.add(optionalExporterConfiguration);

    exporterConfiguration.setOptionalExporterConfigurationList(optionalExporterConfigurationList);
    exportConfiguration.setExporterConfiguration(exporterConfiguration);

    searchConfiguration = new SearchConfiguration();
    searchConfiguration.setEpQLQuery(SPECIFIC_QUERY);
    exportContext = new ExportContext(exportConfiguration, searchConfiguration);
    exportContext.setDependencyRegistry(new DependencyRegistry(new ArrayList<Class<?>>()));
    exportContext.setSummary(new SummaryImpl());
  }
コード例 #2
0
  /**
   * Check that during initialization exporter prepares the list of UidPk for products to be
   * exported.
   */
  @Test
  public void testExporterInitializationWithRetrieveAllProductsQuery() throws Exception {
    final long uid = PRODUCT_UID;
    final List<Long> productUidPkList = new ArrayList<Long>();
    productUidPkList.add(uid);

    exportConfiguration = new ExportConfiguration();

    ExporterConfiguration exporterConfiguration = new ExporterConfiguration();
    List<OptionalExporterConfiguration> optionalExporterConfigurationList =
        new ArrayList<OptionalExporterConfiguration>();

    OptionalExporterConfiguration optionalExporterConfiguration =
        new OptionalExporterConfiguration();
    optionalExporterConfiguration.setType(JobType.PRODUCTASSOCIATION);
    List<ConfigurationOption> options = new ArrayList<ConfigurationOption>();
    ConfigurationOption option = new ConfigurationOption();
    option.setKey(ProductExporterImpl.DIRECT_ONLY);
    option.setValue(Boolean.TRUE.toString());
    options.add(option);
    optionalExporterConfiguration.setOptions(options);
    optionalExporterConfigurationList.add(optionalExporterConfiguration);

    exporterConfiguration.setOptionalExporterConfigurationList(optionalExporterConfigurationList);
    exportConfiguration.setExporterConfiguration(exporterConfiguration);

    searchConfiguration = new SearchConfiguration();
    searchConfiguration.setEpQLQuery(QUERY);
    exportContext = new ExportContext(exportConfiguration, searchConfiguration);
    exportContext.setDependencyRegistry(new DependencyRegistry(new ArrayList<Class<?>>()));
    exportContext.setSummary(new SummaryImpl());

    context.checking(
        new Expectations() {
          {
            oneOf(mockImportExportSearcher).searchUids(searchConfiguration, EPQueryType.PRODUCT);
            will(returnValue(productUidPkList));
          }
        });

    productExporter.initialize(exportContext);
  }