use of org.apache.directory.fortress.core.model.SDSet in project directory-fortress-core by apache.
the class CacheSample method loadCache.
private void loadCache() {
try {
SDSet sdSet = new SDSet();
sdSet.setType(SDSet.SDType.DYNAMIC);
sdSet.setName("");
List<SDSet> dsds = sdP.search(sdSet);
if (dsds != null) {
for (SDSet dsd : dsds) {
Set<String> members = dsd.getMembers();
if (members != null) {
for (String member : members) {
DsdCacheEntry entry = new DsdCacheEntry(member, dsd);
String key = dsd.getName() + ":" + member;
cache.put(key, entry);
LOG.info("Add DSD key: " + key + " members: " + dsd.getMembers() + " to the cache");
}
}
}
} else {
LOG.info("No records found for loading into test cache");
}
} catch (org.apache.directory.fortress.core.SecurityException se) {
String error = " static initializer caught SecurityException=" + se.getMessage() + " rc=" + se.getErrorId();
LOG.error(error);
}
}
use of org.apache.directory.fortress.core.model.SDSet in project directory-fortress-core by apache.
the class CacheSample method runTests.
void runTests() {
loadCache();
Attribute<String> member = cache.getSearchAttribute("member");
Query query = cache.createQuery();
query.includeKeys();
query.includeValues();
Set<String> roles = new HashSet<>();
roles.add("oamt17dsd1");
roles.add("oamt17dsd4");
roles.add("oamT13DSD6");
roles.add("oamT16SDR7");
query.addCriteria(member.in(roles));
Results results = query.execute();
System.out.println(" Size: " + results.size());
System.out.println("----Results-----\n");
Set<SDSet> resultSet = new HashSet<>();
for (Result result : results.all()) {
DsdCacheEntry entry = (DsdCacheEntry) result.getValue();
resultSet.add(entry.getSdSet());
}
for (SDSet sdSet : resultSet) {
LOG.info("Found SDSet: " + sdSet.getName());
}
}
use of org.apache.directory.fortress.core.model.SDSet in project directory-fortress-core by apache.
the class ReviewMgrImplTest method searchSsdSets.
/**
* @param msg
* @param srchValue
* @param sArray
*/
public static void searchSsdSets(String msg, String srchValue, String[][] sArray) {
LogUtil.logIt(msg);
try {
ReviewMgr reviewMgr = getManagedReviewMgr();
SDSet sdSet = new SDSet();
sdSet.setName(srchValue);
List<SDSet> sdSetList = reviewMgr.ssdSets(sdSet);
assertNotNull(sdSetList);
} catch (SecurityException ex) {
LOG.error("searchRoles searchSsdSets [" + srchValue + "] caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
fail(ex.getMessage());
}
}
use of org.apache.directory.fortress.core.model.SDSet in project directory-fortress-core by apache.
the class ReviewMgrImplTest method searchDsdSets.
/**
* @param msg
* @param srchValue
* @param sArray
*/
public static void searchDsdSets(String msg, String srchValue, String[][] sArray) {
LogUtil.logIt(msg);
try {
ReviewMgr reviewMgr = getManagedReviewMgr();
SDSet sdSet = new SDSet();
sdSet.setName(srchValue);
List<SDSet> sdSetList = reviewMgr.ssdSets(sdSet);
assertNotNull(sdSetList);
} catch (SecurityException ex) {
LOG.error("searchRoles searchDsdSets [" + srchValue + "] caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
fail(ex.getMessage());
}
}
use of org.apache.directory.fortress.core.model.SDSet in project directory-fortress-core by apache.
the class RoleTestData method getSDSet.
/**
* @param rle
* @return
*/
/*
public static Map<String, String> getMembers(String[] rle)
{
Map<String, String> mems = new HashMap<>();
if(org.apache.directory.fortress.core.util.attr.StringUtils.isNotEmpty(rle[MEMBERS]))
{
StringTokenizer charSetTkn = new StringTokenizer(rle[MEMBERS], TestUtils.DELIMITER_TEST_DATA);
if (charSetTkn.countTokens() > 0)
{
while (charSetTkn.hasMoreTokens())
{
String pRole = charSetTkn.nextToken();
mems.put(pRole, "");
}
}
}
return mems;
}
*/
/**
* @param ssdArry
* @return
*/
public static SDSet getSDSet(String[] ssdArry) {
SDSet ssd = new SDSet();
ssd.setName(getName(ssdArry));
ssd.setDescription(getDescription(ssdArry));
ssd.setCardinality(getCardinality(ssdArry));
ssd.setMembers(getMembers(ssdArry));
return ssd;
}
Aggregations