use of org.wso2.carbon.identity.core.model.ExpressionNode in project carbon-identity-framework by wso2.
the class IdPManagementDAOTest method getIdPsSearchWithAttributesExceptionData.
@DataProvider
public Object[][] getIdPsSearchWithAttributesExceptionData() {
ExpressionNode en = new ExpressionNode();
List<ExpressionNode> expressionNodes = new ArrayList<>();
expressionNodes.add(en);
List<String> attributes = Arrays.asList("WrongAttribute");
return new Object[][] { { SAMPLE_TENANT_ID, expressionNodes, 2, 0, "ASC", "NAME", attributes } };
}
use of org.wso2.carbon.identity.core.model.ExpressionNode in project carbon-identity-framework by wso2.
the class IdPManagementDAOTest method getIdPsSearchWithAttributesData.
@DataProvider
public Object[][] getIdPsSearchWithAttributesData() {
ExpressionNode expressionNode = new ExpressionNode();
List<ExpressionNode> expressionNodesList = new ArrayList<>();
expressionNodesList.add(expressionNode);
List<String> attributes1 = Arrays.asList("id", "name", "description", "isEnabled", "image", "isPrimary");
List<String> attributes2 = Arrays.asList("homeRealmIdentifier", "isFederationHub", "certificate", "alias", "claims", "roles", "federatedAuthenticators", "provisioning");
return new Object[][] { { SAMPLE_TENANT_ID, expressionNodesList, 2, 0, "ASC", "NAME", attributes1, 2 }, { SAMPLE_TENANT_ID, expressionNodesList, 1, 1, "ASC", "NAME", attributes2, 1 }, { SAMPLE_TENANT_ID, expressionNodesList, 2, 0, "DESC", "NAME", attributes1, 2 } };
}
use of org.wso2.carbon.identity.core.model.ExpressionNode in project carbon-identity-framework by wso2.
the class IdPManagementDAOTest method testGetIdPsSearchWithExpressionNodes.
@Test(dataProvider = "getIdPsSearchWithExpressionNodesData")
public void testGetIdPsSearchWithExpressionNodes(int tenantId, List<ExpressionNode> expressionNodes, int limit, int offset, String sortOrder, String sortBy, int count, String firstIdp) throws Exception {
mockStatic(IdentityDatabaseUtil.class);
try (Connection connection = getConnection(DB_NAME)) {
when(IdentityDatabaseUtil.getDBConnection(anyBoolean())).thenReturn(connection);
when(IdentityDatabaseUtil.getDBConnection()).thenReturn(connection);
when(IdentityDatabaseUtil.getDataSource()).thenReturn(dataSourceMap.get(DB_NAME));
addTestIdps();
List<IdentityProvider> idps = idPManagementDAO.getIdPsSearch(tenantId, expressionNodes, limit, offset, sortOrder, sortBy);
assertEquals(idps.size(), count);
if (count > 0) {
assertEquals(idps.get(0).getIdentityProviderName(), firstIdp);
}
}
}
use of org.wso2.carbon.identity.core.model.ExpressionNode in project carbon-identity-framework by wso2.
the class IdPManagementDAOTest method getCountOfFilteredIdPsData.
@DataProvider
public Object[][] getCountOfFilteredIdPsData() {
ExpressionNode expressionNode1 = new ExpressionNode();
List<ExpressionNode> expressionNodesList1 = new ArrayList<>();
expressionNodesList1.add(expressionNode1);
ExpressionNode expressionNode2 = new ExpressionNode();
expressionNode2.setAttributeValue("name");
expressionNode2.setOperation("sw");
expressionNode2.setValue("test");
List<ExpressionNode> expressionNodesList2 = new ArrayList<>();
expressionNodesList2.add(expressionNode2);
return new Object[][] { { SAMPLE_TENANT_ID, expressionNodesList1, 2 }, { SAMPLE_TENANT_ID, expressionNodesList2, 2 }, { SAMPLE_TENANT_ID2, expressionNodesList1, 1 } };
}
use of org.wso2.carbon.identity.core.model.ExpressionNode in project carbon-identity-framework by wso2.
the class FilterTreeBuilder method factor.
/**
* We build the parser using the recursive descent parser technique.
*/
private void factor() throws IdentityException {
symbol = nextSymbol();
if (symbol.equals(String.valueOf(IdentityCoreConstants.Filter.NOT))) {
OperationNode not = new OperationNode(IdentityCoreConstants.Filter.NOT);
factor();
not.setRightNode(root);
root = not;
} else if (symbol.equals(String.valueOf("("))) {
expression();
// We don't care about ')'.
symbol = nextSymbol();
} else {
if (!(symbol.equals(String.valueOf(")")))) {
ExpressionNode expressionNode = new ExpressionNode();
validateAndBuildFilterExpression(symbol, expressionNode);
root = expressionNode;
symbol = nextSymbol();
} else {
throw new IdentityException("Invalid argument: Identity Provider filter name value is empty or " + "invalid symbol: " + symbol);
}
}
}
Aggregations