org.apache.geode.cache.Region Java Examples

The following examples show how to use org.apache.geode.cache.Region. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JsonCacheDataImporterExporterUnitTests.java    From spring-boot-data-geode with Apache License 2.0 6 votes vote down vote up
@Test
@SuppressWarnings("unchecked")
public void doImportIntoWithNoPdxInstance() {

	Resource mockResource = mock(Resource.class);

	Region<?, ?> mockRegion = mock(Region.class);

	byte[] json = "[]".getBytes();

	doReturn(Optional.of(mockResource)).when(this.importer).getResource(eq(mockRegion), eq("classpath:"));
	doReturn(true).when(mockResource).exists();
	doReturn(json).when(this.importer).getContent(eq(mockResource));
	doReturn(new PdxInstance[0]).when(this.importer).toPdx(eq(json));

	assertThat(this.importer.doImportInto(mockRegion)).isEqualTo(mockRegion);

	verify(this.importer, times(1)).doImportInto(eq(mockRegion));
	verify(this.importer, times(1)).getResource(eq(mockRegion), eq("classpath:"));
	verify(this.importer, times(1)).getContent(eq(mockResource));
	verify(this.importer, times(1)).toPdx(eq(json));
	verify(mockResource, times(1)).exists();
	verifyNoMoreInteractions(this.importer);
	verifyNoMoreInteractions(mockResource);
	verifyNoInteractions(mockRegion);
}
 
Example #2
Source File: CacheUtilsUnitTests.java    From spring-boot-data-geode with Apache License 2.0 6 votes vote down vote up
@Test
public void isClientRegionWithClientRegionDeterminedByPoolName() {

	Region<?, ?> mockRegion = mock(Region.class);

	RegionAttributes<?, ?> mockRegionAttributes = mock(RegionAttributes.class);

	RegionService mockRegionService = mock(RegionService.class);

	doReturn(mockRegionAttributes).when(mockRegion).getAttributes();
	doReturn(mockRegionService).when(mockRegion).getRegionService();
	doReturn("TestPool").when(mockRegionAttributes).getPoolName();

	assertThat(CacheUtils.isClientRegion(mockRegion)).isTrue();
	assertThat(CacheUtils.isPeerRegion(mockRegion)).isFalse();

	verify(mockRegion, times(2)).getRegionService();
	verify(mockRegion, times(2)).getAttributes();
	verify(mockRegionAttributes, times(2)).getPoolName();
	verifyNoMoreInteractions(mockRegion, mockRegionAttributes);
	verifyNoInteractions(mockRegionService);
}
 
Example #3
Source File: Example.java    From geode-examples with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) {
  // connect to the locator using default port 10334
  ClientCache cache = new ClientCacheFactory().addPoolLocator("127.0.0.1", 10334)
      .set("log-level", "WARN").create();

  // create a local region that matches the server region
  Region<Integer, String> region =
      cache.<Integer, String>createClientRegionFactory(ClientRegionShortcut.PROXY)
          .create("example-region");

  Example example = new Example(region);
  example.insertValues(10);
  example.printValues(example.getValues());

  cache.close();
}
 
Example #4
Source File: JsonCacheDataImporterExporterIntegrationTests.java    From spring-boot-data-geode with Apache License 2.0 6 votes vote down vote up
@Bean
JsonCacheDataImporterExporter exampleRegionDataImporter() {

	return new JsonCacheDataImporterExporter() {

		@Override @SuppressWarnings("rawtypes")
		protected Optional<Resource> getResource(@NonNull Region region, String resourcePrefix) {
			return Optional.ofNullable(resourceSupplier.get());
		}

		@NonNull @Override
		Writer newWriter(@NonNull Resource resource) {
			return writerSupplier.get();
		}
	};
}
 
Example #5
Source File: Example.java    From geode-examples with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) {
  // connect to the locator in London cluster using port 10332
  ClientCache cache = new ClientCacheFactory().addPoolLocator("127.0.0.1", 10332)
      .set("log-level", "WARN").create();

  // create a local region that matches the server region
  Region<Integer, String> region =
      cache.<Integer, String>createClientRegionFactory(ClientRegionShortcut.PROXY)
          .create("example-region");

  Example example = new Example(region);
  example.insertValues(10);
  example.printValues(example.getValues());

  cache.close();
}
 
Example #6
Source File: GeodeBackend.java    From immutables with Apache License 2.0 6 votes vote down vote up
private Session(Class<?> entityType, GeodeBackend backend) {
  this.entityType = Objects.requireNonNull(entityType, "entityType");
  GeodeSetup setup = backend.setup;
  @SuppressWarnings("unchecked")
  Region<Object, Object> region = (Region<Object, Object>) setup.regionResolver().resolve(entityType);
  this.region = region;

  KeyExtractor keyExtractor = setup.keyExtractorFactory().create(entityType);
  if (!keyExtractor.metadata().isKeyDefined()) {
    throw new IllegalArgumentException(String.format("Key on %s is required for %s", entityType, GeodeBackend.class.getSimpleName()));
  }

  this.keyExtractor = keyExtractor;
  this.queryService = setup.queryServiceResolver().resolve(region);
  this.pathNaming = backend.pathNaming;
  this.keyLookupAnalyzer = KeyLookupAnalyzer.fromExtractor(keyExtractor);
}
 
Example #7
Source File: PetClinicApplicationSmokeTests.java    From spring-boot-data-geode with Apache License 2.0 6 votes vote down vote up
@GemfireFunction(id = "AdministerPetVaccinations", optimizeForWrite = true)
public void administerPetVaccinations(FunctionContext functionContext) {

	Optional.ofNullable(functionContext)
		.filter(RegionFunctionContext.class::isInstance)
		.map(RegionFunctionContext.class::cast)
		.map(RegionFunctionContext::getDataSet)
		.map(Region::values)
		.ifPresent(pets -> pets.forEach(pet -> {

			Pet resolvePet = (Pet) pet;

			resolvePet.vaccinate();

			((RegionFunctionContext) functionContext).getDataSet().put(resolvePet.getName(), resolvePet);
		}));
}
 
Example #8
Source File: RegionPopulator.java    From geode-examples with Apache License 2.0 6 votes vote down vote up
void insertPassengers(int numberOfPassengers, Region<String, Passenger> region) {
  PrimitiveIterator.OfInt firstNameIndexes = random.ints(0, firstNames.length).iterator();
  PrimitiveIterator.OfInt lastNameIndexes = random.ints(0, lastNames.length).iterator();
  PrimitiveIterator.OfInt ages = random.ints(20, 100).iterator();
  PrimitiveIterator.OfInt flightIndexes = random.ints(0, flights.size()).iterator();
  PrimitiveIterator.OfInt milliSeconds = random.ints(0, 7 * 24 * 60 * 60 * 1000).iterator();
  while (region.sizeOnServer() < numberOfPassengers) {
    String name = firstNames[firstNameIndexes.next()] + " " + lastNames[lastNameIndexes.next()];
    if (!region.containsKey(name)) {
      final long departure = System.currentTimeMillis() + milliSeconds.next();
      final long arrival = departure + milliSeconds.next();
      Passenger passenger = new Passenger(name, ages.next(), flights.get(flightIndexes.next()),
          new Date(departure), new Date(arrival));
      region.put(passenger.getName(), passenger);
    }
  }
}
 
Example #9
Source File: JsonCacheDataImporterExporterUnitTests.java    From spring-boot-data-geode with Apache License 2.0 6 votes vote down vote up
@Test
public void getResourceFromRegionAndResourcePrefix() {

	ApplicationContext mockApplicationContext = mock(ApplicationContext.class);

	Region<?, ?> mockRegion = mock(Region.class);

	Resource mockResource = mock(Resource.class);

	doReturn(mockResource).when(mockApplicationContext).getResource(anyString());
	doReturn("Example").when(mockRegion).getName();
	doReturn(Optional.of(mockApplicationContext)).when(this.importer).getApplicationContext();

	assertThat(this.importer.getResource(mockRegion, "sftp://host/resources/").orElse(null))
		.isEqualTo(mockResource);

	verify(mockApplicationContext, times(1))
		.getResource(eq("sftp://host/resources/data-example.json"));
	verify(mockRegion, times(1)).getName();
}
 
Example #10
Source File: Example.java    From geode-examples with Apache License 2.0 6 votes vote down vote up
public void checkWords(Region<Integer, String> incomingRegion,
    Region<String, String> outgoingRegion, List<String> words) {
  int key = 0;
  for (String word : words) {
    incomingRegion.put(key++, word);
  }

  // Give the process a chance to work.
  while (outgoingRegion.sizeOnServer() < words.size()) {
    try {
      Thread.sleep(500);
    } catch (InterruptedException ie) {
      // NOP
    }
  }

  for (String candidate : outgoingRegion.keySetOnServer()) {
    System.out.println(candidate + " -> " + outgoingRegion.get(candidate));
  }
}
 
Example #11
Source File: GeodeUtils.java    From calcite with Apache License 2.0 6 votes vote down vote up
/**
 * Obtains a proxy pointing to an existing Region on the server
 *
 * @param cache {@link GemFireCache} instance to interact with the Geode server
 * @param regionName  Name of the region to create proxy for.
 * @return Returns a Region proxy to a remote (on the Server) regions.
 */
public static synchronized Region createRegion(GemFireCache cache, String regionName) {
  Objects.requireNonNull(cache, "cache");
  Objects.requireNonNull(regionName, "regionName");
  Region region = REGION_MAP.get(regionName);
  if (region == null) {
    try {
      region = ((ClientCache) cache)
          .createClientRegionFactory(ClientRegionShortcut.PROXY)
          .create(regionName);
    } catch (IllegalStateException | RegionExistsException e) {
      // means this is a server cache (probably part of embedded testing
      // or clientCache is passed directly)
      region = cache.getRegion(regionName);
    }

    REGION_MAP.put(regionName, region);
  }

  return region;
}
 
Example #12
Source File: GeodeRegionsHealthIndicator.java    From spring-boot-data-geode with Apache License 2.0 6 votes vote down vote up
private BiConsumer<Region<?, ?>, Health.Builder> withRegionEvictionPolicyDetails() {

		return (region, builder) -> {

			if (isRegionAttributesPresent(region)) {

				EvictionAttributes evictionAttributes = region.getAttributes().getEvictionAttributes();

				if (evictionAttributes != null) {

					String regionName = region.getName();

					builder.withDetail(cacheRegionEvictionKey(regionName, "action"), String.valueOf(evictionAttributes.getAction()))
						.withDetail(cacheRegionEvictionKey(regionName, "algorithm"), String.valueOf(evictionAttributes.getAlgorithm()));

					EvictionAlgorithm evictionAlgorithm = evictionAttributes.getAlgorithm();

					// NOTE: Eviction Maximum does not apply when Eviction Algorithm is Heap LRU.
					if (evictionAlgorithm != null && !evictionAlgorithm.isLRUHeap()) {
						builder.withDetail(cacheRegionEvictionKey(regionName,"maximum"),
							evictionAttributes.getMaximum());
					}
				}
			}
		};
	}
 
Example #13
Source File: Example.java    From geode-examples with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) {
  // connect to the locator using default port 10334
  ClientCache cache = new ClientCacheFactory().addPoolLocator("127.0.0.1", 10334)
      .set("log-level", "WARN").create();

  // create a local region that matches the server region
  Region<Integer, String> region =
      cache.<Integer, String>createClientRegionFactory(ClientRegionShortcut.PROXY)
          .create("example-region");

  Example example = new Example(region);
  example.insertValues(10);
  example.printValues(example.getValues());

  cache.close();
}
 
Example #14
Source File: Example.java    From geode-examples with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) {
  // connect to the locator using default port 10334
  ClientCache cache = new ClientCacheFactory().addPoolLocator("127.0.0.1", 10334)
      .set("log-level", "WARN").create();

  Example example = new Example();

  // create a local region that matches the server region
  ClientRegionFactory<Integer, String> clientRegionFactory =
      cache.createClientRegionFactory(ClientRegionShortcut.PROXY);
  Region<Integer, String> region = clientRegionFactory.create("example-region");

  example.putEntries(region);
  cache.close();
}
 
Example #15
Source File: RegionTemplateAutoConfiguration.java    From spring-boot-data-geode with Apache License 2.0 5 votes vote down vote up
private void registerRegionTemplateBean(@NonNull ConfigurableApplicationContext applicationContext,
		@NonNull Region region, String regionTemplateBeanName) {

	Optional.of(applicationContext)
		.filter(it -> isNotBean(it, regionTemplateBeanName))
		.map(ConfigurableApplicationContext::getBeanFactory)
		.ifPresent(beanFactory -> register(newGemfireTemplate(region), regionTemplateBeanName, beanFactory));
}
 
Example #16
Source File: Example.java    From geode-examples with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws LuceneQueryException {
  // connect to the locator using default port 10334
  ClientCache cache = new ClientCacheFactory().addPoolLocator("127.0.0.1", 10334)
      .set("log-level", "WARN").create();

  // create a local region that matches the server region
  Region<Integer, EmployeeData> region =
      cache.<Integer, EmployeeData>createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY)
          .create("example-region");

  insertValues(region);
  query(cache);
  queryNestedObject(cache);
  cache.close();
}
 
Example #17
Source File: ExampleTest.java    From geode-examples with Apache License 2.0 5 votes vote down vote up
@Test
public void testExample() throws Exception {
  Example example = new Example();

  Region<String, String> outgoingRegion = mock(Region.class);
  Region<Integer, String> incomingRegion = mock(Region.class);

  final List<String> words = Arrays.asList(new String[] {"that", "teh"});
  when(outgoingRegion.sizeOnServer()).thenReturn(words.size());
  example.checkWords(incomingRegion, outgoingRegion, words);

  verify(incomingRegion).put(eq(0), eq(words.get(0)));
  verify(incomingRegion).put(eq(1), eq(words.get(1)));
}
 
Example #18
Source File: StorageServer.java    From spring-data-examples with Apache License 2.0 5 votes vote down vote up
@Bean
public ApplicationRunner runner(CustomerRepository customerRepository, OrderRepository orderRepository,
		ProductRepository productRepository, @Qualifier("Products") Region<Long, Product> products) {
	return args -> {
		createCustomerData(customerRepository);

		createProducts(productRepository);

		createOrders(productRepository, orderRepository);

		log.info("Completed creating orders ");
	};
}
 
Example #19
Source File: JsonClientCacheDataImporterExporterIntegrationTests.java    From spring-boot-data-geode with Apache License 2.0 5 votes vote down vote up
public void assertCustomersRegion(Region<?, ?> customers) {

		assertThat(customers).isNotNull();
		assertThat(customers.getName()).isEqualTo("Customers");
		assertThat(customers.getAttributes()).isNotNull();
		assertThat(customers.getAttributes().getDataPolicy()).isEqualTo(DataPolicy.EMPTY);
		assertThat(customers).hasSize(0);
	}
 
Example #20
Source File: ClusterNotAvailableConfigurationIntegrationTests.java    From spring-boot-data-geode with Apache License 2.0 5 votes vote down vote up
private void assertRegion(Region<?, ?> region, String name, DataPolicy dataPolicy, String poolName) {

		assertThat(region).isNotNull();
		assertThat(region.getName()).isEqualTo(name);
		assertThat(region.getAttributes()).isNotNull();
		assertThat(region.getAttributes().getDataPolicy()).isEqualTo(dataPolicy);
		assertThat(region.getAttributes().getPoolName()).isEqualTo(poolName);
	}
 
Example #21
Source File: Example.java    From geode-examples with Apache License 2.0 5 votes vote down vote up
public void monitorEntries(Region<Integer, String> region) {
  while (0 < region.sizeOnServer()) {
    try {
      Thread.sleep(1000);
      System.out.println(ISO_8601_TIMESTAMP_FORMAT.format(new Date()) + "\tThe region now has "
          + region.sizeOnServer() + " entries.");
    } catch (InterruptedException ie) {
      // NOP
    }
  }
}
 
Example #22
Source File: Example.java    From geode-examples with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws NameResolutionException, TypeMismatchException,
    QueryInvocationTargetException, FunctionDomainException {
  // connect to the locator using default port 10334
  ClientCache cache = new ClientCacheFactory().addPoolLocator("127.0.0.1", 10334)
      .set("log-level", "WARN").create();

  // create a region on the server
  Region<Integer, EmployeeData> region =
      cache.<Integer, EmployeeData>createClientRegionFactory(ClientRegionShortcut.PROXY)
          .create(REGIONNAME);

  // create a set of employee data and put it into the region
  Map<Integer, EmployeeData> employees = createEmployeeData();
  region.putAll(employees);

  // count the values in the region
  int inserted = region.keySetOnServer().size();
  System.out.println(String.format("Counted %d keys in region %s", inserted, region.getName()));

  // fetch and print all values in the region (without using a query)
  region.keySetOnServer().forEach(key -> System.out.println(region.get(key)));

  // do a set of queries, printing the results of each query
  doQueries(cache);

  cache.close();
}
 
Example #23
Source File: Example.java    From geode-examples with Apache License 2.0 5 votes vote down vote up
public Set<Integer> getPrimes(Region<Integer, String> region, Execution execution) {
  Set<Integer> primes = new HashSet<>();

  for (Integer key : (Iterable<Integer>) () -> IntStream.rangeClosed(1, maximum).iterator()) {
    region.put(key, key.toString());
  }

  ResultCollector<Integer, List> results = execution.execute(PrimeNumber.ID);
  primes.addAll(results.getResult());
  System.out.println("The primes in the range from 1 to " + maximum + " are:\n" + primes);
  return primes;
}
 
Example #24
Source File: AbstractCacheDataImporterExporterUnitTests.java    From spring-boot-data-geode with Apache License 2.0 5 votes vote down vote up
@Test
@SuppressWarnings("unchecked")
public void importIntoWhenEnvironmentActiveProfilesDoesNotContainImportActiveProfilesWillNotCallDoImportInto() {

	Region<?, ?> mockRegion = mock(Region.class);

	Predicate<Region<?, ?>> mockPredicate = mock(Predicate.class);

	Environment mockEnvironment =
		withImportActiveProfiles(enableImport(mock(Environment.class)), "DEV,TEST");

	AbstractCacheDataImporterExporter importer = callRealMethodsFor(mockAbstractCacheDataImporterExporter());

	doReturn(Optional.of(mockEnvironment)).when(importer).getEnvironment();
	doReturn(new String[0]).doReturn(toArray("PROD")).when(mockEnvironment).getActiveProfiles();
	doReturn(mockPredicate).when(importer).getRegionPredicate();
	doReturn(true).when(mockPredicate).test(eq(mockRegion));

	assertThat(importer.importInto(mockRegion)).isEqualTo(mockRegion);
	assertThat(importer.importInto(mockRegion)).isEqualTo(mockRegion);

	verify(importer, times(2)).getEnvironment();
	verify(importer, times(2)).isImportEnabled(eq(mockEnvironment));
	verify(importer, times(2)).getRegionPredicate();
	verify(importer, times(2)).isImportProfilesActive(eq(mockEnvironment));
	verify(importer, never()).doImportInto(eq(mockRegion));
	verify(mockEnvironment, times(2)).getActiveProfiles();
	verify(mockEnvironment, times(1)).getDefaultProfiles();
	verify(mockEnvironment, times(2))
		.getProperty(eq(AbstractCacheDataImporterExporter.CACHE_DATA_IMPORT_ENABLED_PROPERTY_NAME),
			eq(Boolean.class), eq(AbstractCacheDataImporterExporter.DEFAULT_CACHE_DATA_IMPORT_ENABLED));
	verify(mockEnvironment, times(2))
		.getProperty(eq(AbstractCacheDataImporterExporter.CACHE_DATA_IMPORT_ACTIVE_PROFILES_PROPERTY_NAME),
			eq(AbstractCacheDataImporterExporter.DEFAULT_CACHE_DATA_IMPORT_ACTIVE_PROFILES));
	verify(mockPredicate, times(2)).test(eq(mockRegion));
	verifyNoMoreInteractions(mockEnvironment, mockPredicate);
	verifyNoInteractions(mockRegion);
}
 
Example #25
Source File: CacheUtilsUnitTests.java    From spring-boot-data-geode with Apache License 2.0 5 votes vote down vote up
@Test
public void isClientRegionWithRegionHavingNoRegionAttributes() {

	Region<?, ?> mockRegion = mock(Region.class);

	doReturn(null).when(mockRegion).getAttributes();
	doReturn(null).when(mockRegion).getRegionService();

	assertThat(CacheUtils.isClientRegion(mockRegion)).isFalse();
	assertThat(CacheUtils.isPeerRegion(mockRegion)).isTrue();

	verify(mockRegion, times(2)).getRegionService();
	verify(mockRegion, times(2)).getAttributes();
	verifyNoMoreInteractions(mockRegion);
}
 
Example #26
Source File: ExampleTest.java    From geode-examples with Apache License 2.0 5 votes vote down vote up
@Test
public void testExample() throws Exception {
  Example example = new Example();

  Region<String, String> region = mock(Region.class);
  when(region.put(eq("666-66-6666"), any())).thenThrow(new CacheWriterException());
  when(region.put(eq("8675309"), any())).thenThrow(new CacheWriterException());
  when(region.put(eq("999-000-0000"), any())).thenThrow(new CacheWriterException());

  assertEquals(Arrays.asList(new String[] {"Bart Simpson", "Raymond Babbitt"}),
      example.getValidNames(region));
}
 
Example #27
Source File: AbstractCacheDataImporterExporter.java    From spring-boot-data-geode with Apache License 2.0 5 votes vote down vote up
/**
 * Imports data into the given {@link Region}.
 *
 * @param region {@link Region} to import data into.
 * @return the given {@link Region}.
 * @see org.apache.geode.cache.Region
 * @see #isImportEnabled(Environment)
 * @see #getRegionPredicate()
 */
@NonNull @Override
public Region importInto(@NonNull Region region) {

	Assert.notNull(region, "Region must not be null");

	boolean importEnabled = getEnvironment()
		.filter(this::isImportEnabled)
		.filter(environment -> getRegionPredicate().test(region))
		.filter(this::isImportProfilesActive)
		.isPresent();

	return importEnabled ? doImportInto(region) : region;
}
 
Example #28
Source File: CacheDataExporter.java    From spring-boot-data-geode with Apache License 2.0 5 votes vote down vote up
/**
 * Exports any data contained in a {@link Region} on destruction.
 *
 * @param bean {@link Object} bean to evaluate.
 * @param beanName {@link String} containing the name of the bean.
 * @throws BeansException if exporting data from a {@link Region} fails!
 * @see org.apache.geode.cache.Region
 * @see #exportFrom(Region)
 */
@Override
default void postProcessBeforeDestruction(Object bean, String beanName) throws BeansException {

	if (bean instanceof Region) {
		exportFrom((Region) bean);
	}
	else if (bean instanceof ResolvableRegionFactoryBean) {
		exportFrom(((ResolvableRegionFactoryBean) bean).getRegion());
	}
}
 
Example #29
Source File: GetAllOptimizationTest.java    From immutables with Apache License 2.0 5 votes vote down vote up
@Override
public Region<?, ?> resolve(Class<?> entityType) {
  Region<?, ?> region = delegate.resolve(entityType);
  return (Region<?, ?>) Proxy.newProxyInstance(getClass().getClassLoader(),
          new Class[] {Region.class},
          new MethodInterceptor(region));
}
 
Example #30
Source File: JsonCacheDataImporterExporterUnitTests.java    From spring-boot-data-geode with Apache License 2.0 5 votes vote down vote up
@Test
@SuppressWarnings("unchecked")
public void doImportIntoPutsPdxIntoRegionForJson() {

	Resource mockResource = mock(Resource.class);

	Region<Integer, PdxInstance> mockRegion = mock(Region.class);

	PdxInstance mockPdxInstanceOne = mock(PdxInstance.class);
	PdxInstance mockPdxInstanceTwo = mock(PdxInstance.class);

	byte[] json = "[{ \"name\": \"Jon Doe\"}, { \"name\": \"Jane Doe\" }]".getBytes();

	doReturn(Optional.of(mockResource)).when(this.importer).getResource(eq(mockRegion),eq("classpath:"));
	doReturn(true).when(mockResource).exists();
	doReturn(json).when(this.importer).getContent(eq(mockResource));
	doReturn(ArrayUtils.asArray(mockPdxInstanceOne, mockPdxInstanceTwo)).when(this.importer).toPdx(eq(json));
	doReturn(1).when(this.importer).resolveKey(eq(mockPdxInstanceOne));
	doReturn(2).when(this.importer).resolveKey(eq(mockPdxInstanceTwo));

	assertThat(this.importer.doImportInto(mockRegion)).isEqualTo(mockRegion);

	verify(this.importer, times(1)).getResource(eq(mockRegion), eq("classpath:"));
	verify(this.importer, times(1)).getContent(eq(mockResource));
	verify(this.importer, times(1)).toPdx(eq(json));
	verify(this.importer, times(1)).resolveKey(eq(mockPdxInstanceOne));
	verify(this.importer, times(1)).postProcess(eq(mockPdxInstanceOne));
	verify(this.importer, times(1)).resolveValue(eq(mockPdxInstanceOne));
	verify(this.importer, times(1)).resolveKey(eq(mockPdxInstanceTwo));
	verify(this.importer, times(1)).postProcess(eq(mockPdxInstanceTwo));
	verify(this.importer, times(1)).resolveValue(eq(mockPdxInstanceTwo));
	verify(mockResource, times(1)).exists();
	verify(mockRegion, times(1)).put(eq(1), eq(mockPdxInstanceOne));
	verify(mockRegion, times(1)).put(eq(2), eq(mockPdxInstanceTwo));
}