co.verisoft.fw.store.StoreManager Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of test-api Show documentation
Show all versions of test-api Show documentation
VeriSoft framework for testing web and mobile applications. junit 5 Module
The newest version!
/*
* (C) Copyright 2023 VeriSoft (http://www.verisoft.co)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package co.verisoft.fw.store;
import lombok.Synchronized;
import lombok.ToString;
import lombok.extern.slf4j.Slf4j;
import java.util.HashMap;
import java.util.Map;
/**
* Global thread safe storage for objects. It is implemented as a singletone.
* Example:
* The following example is taken from the Store unit test, and provides a basic use of the store.
* This example uses GLOBAL store, however similar code can be applied to LOCAL_THREAD store.
*
* {@code
* String name = "Nir";
* StoreManager.getStore(StoreType.GLOBAL).putValueInStore("NIR", name);
* String receivedName = StoreManager.getStore(StoreType.GLOBAL).getValueFromStore("NIR");
* Assertions.assertEquals(name, receivedName, "Should have retrieved from store");
* }
*
*
* @author Nir Gallner
* @see Store
* @see StoreImp
* @see StoreType
* @since 0.0.2 (Jan 2022)
*/
@ToString
@Slf4j
public class StoreManager {
private static final Map
© 2015 - 2025 Weber Informatics LLC | Privacy Policy