@Test void save() throws ComponentLookupException { assertTrue(this.manager.save(toSet()).isEmpty()); assertTrue(this.manager.save(toSet("noentry")).isEmpty()); assertTrue(this.manager.save(toSet("entry11", "entry12", "entry2")).isEmpty()); register(this.storeEmpty); assertTrue(this.manager.save(toSet()).isEmpty()); assertTrue(this.manager.save(toSet("noentry")).isEmpty()); assertTrue(this.manager.save(toSet("entry11", "entry12", "entry2")).isEmpty()); register(this.storeEmpty, this.store1); assertTrue(this.manager.save(toSet()).isEmpty()); assertTrue(this.manager.save(toSet("noentry")).isEmpty()); assertEquals(toMap("entry11", "value11"), this.manager.save(toSet("entry11"))); assertEquals(toMap("entry11", "value11", "entry12", "value12"), this.manager.save(toSet("entry11", "entry12"))); register(this.storeEmpty, this.store1, this.store2); assertTrue(this.manager.save(toSet()).isEmpty()); assertTrue(this.manager.save(toSet("noentry")).isEmpty()); assertEquals(toMap("entry11", "value11"), this.manager.save(toSet("entry11"))); assertEquals(toMap("entry11", "value11", "entry12", "value12"), this.manager.save(toSet("entry11", "entry12"))); assertEquals(toMap("entry11", "value11", "entry12", "value12"), this.manager.save(toSet("entry11", "entry12"))); assertEquals(toMap("entry11", "value11", "entry12", "value12", "entry2", "value2"), this.manager.save(toSet("entry11", "entry12", "entry2"))); }
@Override public Map<String, Serializable> save(Collection<String> entries) throws ComponentLookupException { if (entries == null) { return null; } Map<String, Serializable> context; if (!entries.isEmpty()) { context = new HashMap<>(); List<ContextStore> stores = this.componentManager.getInstanceList(ContextStore.class); for (ContextStore store : stores) { store.save(context, entries); } } else { context = Collections.emptyMap(); } return context; }
DefaultContextStoreManager implements ContextStoreManager { @Override public Map<String, Serializable> save(Collection<String> entries) throws ComponentLookupException { if (entries == null) { return null; } Map<String, Serializable> context; if (!entries.isEmpty()) { context = new HashMap<>(); List<ContextStore> stores = this.componentManager.getInstanceList(ContextStore.class); for (ContextStore store : stores) { store.save(context, entries); } } else { context = Collections.emptyMap(); } return context; } }
DefaultContextStoreManager implements ContextStoreManager { @Override public Map<String, Serializable> save(Collection<String> entries) throws ComponentLookupException { if (entries == null) { return null; } Map<String, Serializable> context; if (!entries.isEmpty()) { context = new HashMap<>(); List<ContextStore> stores = this.componentManager.getInstanceList(ContextStore.class); for (ContextStore store : stores) { store.save(context, entries); } } else { context = Collections.emptyMap(); } return context; }  }
DefaultContextStoreManager implements ContextStoreManager { @Override public Map<String, Serializable> save(Collection<String> entries) throws ComponentLookupException { if (entries == null) { return null; } Map<String, Serializable> context; if (!entries.isEmpty()) { context = new HashMap<>(); List<ContextStore> stores = this.componentManager.getInstanceList(ContextStore.class); for (ContextStore store : stores) { store.save(context, entries); } } else { context = Collections.emptyMap(); } return context; }  @Override Collection<String> getSupportedEntries(); @Override Map<String, Serializable> save(Collection<String> entries); @Override void restore(Map<String, Serializable> contextStore); }
DefaultContextStoreManager implements ContextStoreManager { @Override public Map<String, Serializable> save(Collection<String> entries) throws ComponentLookupException { if (entries == null) { return null; } Map<String, Serializable> context; if (!entries.isEmpty()) { context = new HashMap<>(); List<ContextStore> stores = this.componentManager.getInstanceList(ContextStore.class); for (ContextStore store : stores) { store.save(context, entries); } } else { context = Collections.emptyMap(); } return context; }  @Override Collection<String> getSupportedEntries(); @Override Map<String, Serializable> save(Collection<String> entries); @Override void restore(Map<String, Serializable> contextStore);  }