@Test public void testLoadKeysetFromStoreOrCreateEmptyOne() throws Exception { KeyStoreOperations ops = new KeyStoreOperations(storage, keySetJsonReader, keySetJsonWriter); KeySet keySet = ops.loadKeysetFormStoreOrCreateEmptyOne(TestDto.class, "user", "UC_LSIT"); assertEquals(0, keySet.getKeys().size()); keySet.createKey("Key1"); keySet.createKey("Key2"); keySet.createKey("Key3"); storage.setItem(keySet.createKeyCollectionKey(), keySetJsonWriter.toJson(keySet)); keySet = ops.loadKeysetFormStoreOrCreateEmptyOne(TestDto.class, "user", "UC_LSIT"); assertEquals(3, keySet.getKeys().size()); assertTrue(keySet.getKeys().contains("user_de.swm.gwt.client.mobile.keystore.impl.TestDto_UC_LSIT_Key1")); assertTrue(keySet.getKeys().contains("user_de.swm.gwt.client.mobile.keystore.impl.TestDto_UC_LSIT_Key2")); assertTrue(keySet.getKeys().contains("user_de.swm.gwt.client.mobile.keystore.impl.TestDto_UC_LSIT_Key3")); }
@Override public KeySet loadKeysetFormStoreOrCreateEmptyOne(Class<?> forClass, String uuid, String useCase) { KeySet emptyKeySet = new KeySet(forClass, uuid, useCase); String keysetFormStoreAsJsonString = localStorage.getItem(emptyKeySet.createKeyCollectionKey()); if (keysetFormStoreAsJsonString != null) { return keyset_reader.read(keysetFormStoreAsJsonString); } return emptyKeySet; }
KeyStoreOperations implements IKeyStoreOperations { @Override public KeySet loadKeysetFormStoreOrCreateEmptyOne(Class<?> forClass, String uuid, String useCase) { KeySet emptyKeySet = new KeySet(forClass, uuid, useCase); String keysetFormStoreAsJsonString = localStorage.getItem(emptyKeySet.createKeyCollectionKey()); if (keysetFormStoreAsJsonString != null) { return keyset_reader.read(keysetFormStoreAsJsonString); } return emptyKeySet; } }
KeyStoreOperations implements IKeyStoreOperations { @Override public KeySet loadKeysetFormStoreOrCreateEmptyOne(Class<?> forClass, String uuid, String useCase) { KeySet emptyKeySet = new KeySet(forClass, uuid, useCase); String keysetFormStoreAsJsonString = localStorage.getItem(emptyKeySet.createKeyCollectionKey()); if (keysetFormStoreAsJsonString != null) { return keyset_reader.read(keysetFormStoreAsJsonString); } return emptyKeySet; } KeyStoreOperations(IStorage localStorage, JsonReader<KeySet> keyset_reader,
							  JsonWriter<KeySet> keyset_writer); }
KeyStoreOperations implements IKeyStoreOperations { @Override public KeySet loadKeysetFormStoreOrCreateEmptyOne(Class<?> forClass, String uuid, String useCase) { KeySet emptyKeySet = new KeySet(forClass, uuid, useCase); String keysetFormStoreAsJsonString = localStorage.getItem(emptyKeySet.createKeyCollectionKey()); if (keysetFormStoreAsJsonString != null) { return keyset_reader.read(keysetFormStoreAsJsonString); } return emptyKeySet; } KeyStoreOperations(IStorage localStorage, JsonReader<KeySet> keyset_reader,
							  JsonWriter<KeySet> keyset_writer); @Override List<T> getDTOList(String userID, String useCase, Class<T> forClass, JsonReader<T> jsonReader); @Override List<T> getDTOListAndDeleteIt(String userID, String useCase, Class<T> forClass, JsonReader<T> jsonReader); @Override List<T> getDTOList(KeyCollection keyCollection, JsonReader<T> jsonReader); @Override void removeDTOList(KeyCollection keyCollection); @Override List<T> getDTOListAndDeleteIt(KeyCollection keyCollection, JsonReader<T> jsonReader); @Override void updateDTO(T toUpdate, KeySet keySet, String oid, JsonWriter<T> jsonWriter); @Override void deleteDTO(KeySet keySet, String oidToDelete, JsonWriter<T> jsonWriter); @Override void updateOrCreateDTOList(List<T> toUpdate, KeySet keySet, JsonWriter<T> jsonWriter, List<Long> oids); @Override KeySet loadKeysetFormStoreOrCreateEmptyOne(Class<?> forClass, String uuid, String useCase); @Override void createList(List<T> toUpdate, KeySet keySet, JsonWriter<T> jsonWriter); }
KeyStoreOperations implements IKeyStoreOperations { @Override public KeySet loadKeysetFormStoreOrCreateEmptyOne(Class<?> forClass, String uuid, String useCase) { KeySet emptyKeySet = new KeySet(forClass, uuid, useCase); String keysetFormStoreAsJsonString = localStorage.getItem(emptyKeySet.createKeyCollectionKey()); if (keysetFormStoreAsJsonString != null) { return keyset_reader.read(keysetFormStoreAsJsonString); } return emptyKeySet; } KeyStoreOperations(IStorage localStorage, JsonReader<KeySet> keyset_reader,
							  JsonWriter<KeySet> keyset_writer); @Override List<T> getDTOList(String userID, String useCase, Class<T> forClass, JsonReader<T> jsonReader); @Override List<T> getDTOListAndDeleteIt(String userID, String useCase, Class<T> forClass, JsonReader<T> jsonReader); @Override List<T> getDTOList(KeyCollection keyCollection, JsonReader<T> jsonReader); @Override void removeDTOList(KeyCollection keyCollection); @Override List<T> getDTOListAndDeleteIt(KeyCollection keyCollection, JsonReader<T> jsonReader); @Override void updateDTO(T toUpdate, KeySet keySet, String oid, JsonWriter<T> jsonWriter); @Override void deleteDTO(KeySet keySet, String oidToDelete, JsonWriter<T> jsonWriter); @Override void updateOrCreateDTOList(List<T> toUpdate, KeySet keySet, JsonWriter<T> jsonWriter, List<Long> oids); @Override KeySet loadKeysetFormStoreOrCreateEmptyOne(Class<?> forClass, String uuid, String useCase); @Override void createList(List<T> toUpdate, KeySet keySet, JsonWriter<T> jsonWriter);  }