use of org.apache.commons.lang3.builder.ToStringStyleTest.Person in project flow by vaadin.
the class BinderTest method readBean_converterThrows_exceptionHandlerSet_bindingExceptionIsThrown.
@Test(expected = BindingException.class)
public void readBean_converterThrows_exceptionHandlerSet_bindingExceptionIsThrown() {
TestTextField testField = new TestTextField();
setExceptionHandler();
binder.forField(testField).withConverter(Converter.<String, String>from(name -> {
throw new NullPointerException();
}, name -> name)).bind(Person::getFirstName, Person::setFirstName).read(new Person());
}
use of org.apache.commons.lang3.builder.ToStringStyleTest.Person in project cas by apereo.
the class PrincipalAttributeRepositoryFetcher method retrieve.
/**
* Retrieve person attributes.
*
* @return the map
*/
public Map<String, List<Object>> retrieve() {
var filter = IPersonAttributeDaoFilter.alwaysChoose();
if (!activeAttributeRepositoryIdentifiers.isEmpty()) {
val repoIdsArray = activeAttributeRepositoryIdentifiers.toArray(ArrayUtils.EMPTY_STRING_ARRAY);
LOGGER.trace("Active attribute repository identifiers [{}]", activeAttributeRepositoryIdentifiers);
filter = dao -> Arrays.stream(dao.getId()).anyMatch(daoId -> daoId.equalsIgnoreCase(IPersonAttributeDao.WILDCARD) || StringUtils.equalsAnyIgnoreCase(daoId, repoIdsArray) || StringUtils.equalsAnyIgnoreCase(IPersonAttributeDao.WILDCARD, repoIdsArray));
}
val query = new LinkedHashMap<String, Object>();
if (currentPrincipal != null) {
query.put("principal", currentPrincipal.getId());
query.putAll(currentPrincipal.getAttributes());
}
query.putAll(queryAttributes);
query.put("username", principalId.trim());
LOGGER.debug("Fetching person attributes for query [{}]", query);
val people = attributeRepository.getPeople(query, filter);
if (people == null || people.isEmpty()) {
LOGGER.warn("No person records were fetched from attribute repositories for [{}]", query);
return new HashMap<>(0);
}
if (people.size() > 1) {
LOGGER.warn("Multiple records were found for [{}] from attribute repositories for query [{}]. The records are [{}], " + "and CAS will only pick the first person record from the results.", principalId, query, people);
}
val person = people.iterator().next();
LOGGER.debug("Retrieved person [{}] from attribute repositories for query [{}]", person, query);
return person.getAttributes();
}
use of org.apache.commons.lang3.builder.ToStringStyleTest.Person in project sqlg by pietermartin.
the class TestBulkWithin method testBulkWithinVertexCompileStep.
@Test
public void testBulkWithinVertexCompileStep() throws InterruptedException {
StopWatch stopWatch = new StopWatch();
stopWatch.start();
if (this.sqlgGraph.getSqlDialect().supportsBatchMode()) {
this.sqlgGraph.tx().normalBatchModeOn();
}
Vertex god = this.sqlgGraph.addVertex(T.label, "God");
List<String> uuids = new ArrayList<>();
for (int i = 0; i < 100; i++) {
String uuid = UUID.randomUUID().toString();
uuids.add(uuid);
Vertex person = this.sqlgGraph.addVertex(T.label, "Person", "idNumber", uuid);
god.addEdge("creator", person);
}
this.sqlgGraph.tx().commit();
stopWatch.stop();
System.out.println(stopWatch.toString());
stopWatch.reset();
stopWatch.start();
testBulkWithinVertexCompileStep_assert(this.sqlgGraph, god, uuids);
if (this.sqlgGraph1 != null) {
Thread.sleep(SLEEP_TIME);
testBulkWithinVertexCompileStep_assert(this.sqlgGraph1, god, uuids);
}
stopWatch.stop();
System.out.println(stopWatch.toString());
}
use of org.apache.commons.lang3.builder.ToStringStyleTest.Person in project sqlg by pietermartin.
the class TestBulkWithin method testBulkWithinWithPercentageInJoinProperties.
@Test
public void testBulkWithinWithPercentageInJoinProperties() throws InterruptedException {
StopWatch stopWatch = new StopWatch();
stopWatch.start();
if (this.sqlgGraph.getSqlDialect().supportsBatchMode()) {
this.sqlgGraph.tx().normalBatchModeOn();
}
Vertex god = this.sqlgGraph.addVertex(T.label, "God");
List<String> uuids = new ArrayList<>();
for (int i = 0; i < 100; i++) {
String uuid = UUID.randomUUID().toString();
uuids.add("\"BLRNC5->CXC4030052~%%%~FAJ1211373~%%%~2015-07-19~%%%~9999-12-31~%%%~Enabled~%%%~Licensed~%%%~Improved~%%%~compressed~%%%~mode~%%%~handling.~%%%~Restricted:~%%%~\"\"Partial.~%%%~Feature~%%%~is~%%%~restricted~%%%~in~%%%~RNC~%%%~W12B~%%%~SW.~%%%~RNC~%%%~W13.0.1.1~%%%~or~%%%~later~%%%~SW~%%%~is~%%%~required~%%%~in~%%%~order~%%%~to~%%%~run~%%%~this~%%%~feature.~%%%~For~%%%~RBS~%%%~W12.1.2.2/~%%%~W13.0.0.0~%%%~or~%%%~later~%%%~is~%%%~required.~%%%~OSS-RC~%%%~12.2~%%%~or~%%%~later~%%%~is~%%%~required.\"\".~%%%~GA:~%%%~W13A\"" + uuid);
Vertex person = this.sqlgGraph.addVertex(T.label, "Person", "idNumber", "\"BLRNC5->CXC4030052~%%%~FAJ1211373~%%%~2015-07-19~%%%~9999-12-31~%%%~Enabled~%%%~Licensed~%%%~Improved~%%%~compressed~%%%~mode~%%%~handling.~%%%~Restricted:~%%%~\"\"Partial.~%%%~Feature~%%%~is~%%%~restricted~%%%~in~%%%~RNC~%%%~W12B~%%%~SW.~%%%~RNC~%%%~W13.0.1.1~%%%~or~%%%~later~%%%~SW~%%%~is~%%%~required~%%%~in~%%%~order~%%%~to~%%%~run~%%%~this~%%%~feature.~%%%~For~%%%~RBS~%%%~W12.1.2.2/~%%%~W13.0.0.0~%%%~or~%%%~later~%%%~is~%%%~required.~%%%~OSS-RC~%%%~12.2~%%%~or~%%%~later~%%%~is~%%%~required.\"\".~%%%~GA:~%%%~W13A\"" + uuid);
god.addEdge("creator", person);
}
this.sqlgGraph.tx().commit();
stopWatch.stop();
System.out.println(stopWatch.toString());
stopWatch.reset();
stopWatch.start();
testBulkWithinWithPercentageInJoinProperties_assert(this.sqlgGraph, uuids);
if (this.sqlgGraph1 != null) {
Thread.sleep(SLEEP_TIME);
testBulkWithinWithPercentageInJoinProperties_assert(this.sqlgGraph1, uuids);
}
stopWatch.stop();
System.out.println(stopWatch.toString());
}
use of org.apache.commons.lang3.builder.ToStringStyleTest.Person in project sqlg by pietermartin.
the class TestBulkWithin method testBulkWithinMultipleHasContainers.
@Test
public void testBulkWithinMultipleHasContainers() throws InterruptedException {
StopWatch stopWatch = new StopWatch();
stopWatch.start();
if (this.sqlgGraph.getSqlDialect().supportsBatchMode()) {
this.sqlgGraph.tx().normalBatchModeOn();
}
Vertex god = this.sqlgGraph.addVertex(T.label, "God");
Vertex person1 = this.sqlgGraph.addVertex(T.label, "Person", "idNumber", 1, "name", "pete");
god.addEdge("creator", person1);
Vertex person2 = this.sqlgGraph.addVertex(T.label, "Person", "idNumber", 2, "name", "pete");
god.addEdge("creator", person2);
Vertex person3 = this.sqlgGraph.addVertex(T.label, "Person", "idNumber", 3, "name", "john");
god.addEdge("creator", person3);
Vertex person4 = this.sqlgGraph.addVertex(T.label, "Person", "idNumber", 4, "name", "pete");
god.addEdge("creator", person4);
Vertex person5 = this.sqlgGraph.addVertex(T.label, "Person", "idNumber", 5, "name", "pete");
god.addEdge("creator", person5);
Vertex person6 = this.sqlgGraph.addVertex(T.label, "Person", "idNumber", 6, "name", "pete");
god.addEdge("creator", person6);
Vertex person7 = this.sqlgGraph.addVertex(T.label, "Person", "idNumber", 7, "name", "pete");
god.addEdge("creator", person7);
Vertex person8 = this.sqlgGraph.addVertex(T.label, "Person", "idNumber", 8, "name", "pete");
god.addEdge("creator", person8);
Vertex person9 = this.sqlgGraph.addVertex(T.label, "Person", "idNumber", 9, "name", "pete");
god.addEdge("creator", person9);
Vertex person10 = this.sqlgGraph.addVertex(T.label, "Person", "idNumber", 10, "name", "pete");
god.addEdge("creator", person10);
this.sqlgGraph.tx().commit();
stopWatch.stop();
System.out.println(stopWatch.toString());
stopWatch.reset();
stopWatch.start();
testBulkWithinMultipleHasContrainers_assert(this.sqlgGraph);
if (this.sqlgGraph1 != null) {
Thread.sleep(SLEEP_TIME);
testBulkWithinMultipleHasContrainers_assert(this.sqlgGraph);
}
stopWatch.stop();
System.out.println(stopWatch.toString());
}
Aggregations