use of org.wso2.carbon.identity.functions.library.mgt.model.FunctionLibrary in project carbon-identity-framework by wso2.
the class FunctionLibraryManagementServiceTest method updateFunctionLibraryData.
@DataProvider(name = "updateFunctionLibraryDataProvider")
public Object[][] updateFunctionLibraryData() {
FunctionLibrary functionLibrary11 = new FunctionLibrary();
functionLibrary11.setFunctionLibraryName("sample11");
functionLibrary11.setDescription("sample11");
functionLibrary11.setFunctionLibraryScript("function samplefunction11(){}");
FunctionLibrary functionLibrary12 = new FunctionLibrary();
functionLibrary12.setFunctionLibraryName("sample12");
functionLibrary12.setDescription("sample12");
functionLibrary12.setFunctionLibraryScript("function samplefunction12(){}");
FunctionLibrary functionLibrary13 = new FunctionLibrary();
functionLibrary13.setFunctionLibraryName("sample13");
functionLibrary13.setDescription("sample13");
functionLibrary13.setFunctionLibraryScript("function samplefunction13(){}");
FunctionLibrary functionLibrary14 = new FunctionLibrary();
functionLibrary14.setFunctionLibraryName("sample14");
functionLibrary14.setDescription("sample14");
functionLibrary14.setFunctionLibraryScript("function samplefunction14(){}");
return new Object[][] { { functionLibrary11, SAMPLE_TENANT_DOMAIN }, { functionLibrary12, SAMPLE_TENANT_DOMAIN2 }, { functionLibrary13, SAMPLE_TENANT_DOMAIN }, { functionLibrary14, SAMPLE_TENANT_DOMAIN2 } };
}
use of org.wso2.carbon.identity.functions.library.mgt.model.FunctionLibrary in project carbon-identity-framework by wso2.
the class FunctionLibraryDAOImplTest method listFunctionLibraries.
@Test(dataProvider = "listFunctionLibraryDataProvider")
public void listFunctionLibraries(List<Object> functionLibraries, String tenantDomain) throws FunctionLibraryManagementException {
try (Connection connection = DAOUtils.getConnection(DB_NAME)) {
FunctionLibraryDAO functionLibraryDAO = new FunctionLibraryDAOImpl();
addFunctionLibraries(functionLibraryDAO, functionLibraries, tenantDomain);
when(IdentityDatabaseUtil.getDBConnection(false)).thenReturn(connection);
List<FunctionLibrary> functionLibrariesList = functionLibraryDAO.listFunctionLibraries(tenantDomain);
assertTrue(functionLibrariesList != null && functionLibrariesList.size() != 0, "Failed to retrieve script libraries.");
// Clean after test
deleteFunctionLibraries(functionLibraryDAO, functionLibraries, tenantDomain);
} catch (SQLException e) {
log.error("SQLException");
}
}
use of org.wso2.carbon.identity.functions.library.mgt.model.FunctionLibrary in project carbon-identity-framework by wso2.
the class FunctionLibraryDAOImplTest method listFunctionLibrariesData.
@DataProvider(name = "listFunctionLibraryDataProvider")
public Object[][] listFunctionLibrariesData() {
FunctionLibrary functionLibrary4 = new FunctionLibrary();
functionLibrary4.setFunctionLibraryName("sample4");
functionLibrary4.setDescription("sample4");
functionLibrary4.setFunctionLibraryScript("samplefunction4");
FunctionLibrary functionLibrary5 = new FunctionLibrary();
functionLibrary5.setFunctionLibraryName("sample5");
functionLibrary5.setDescription("sample5");
functionLibrary5.setFunctionLibraryScript("samplefunction5");
FunctionLibrary functionLibrary6 = new FunctionLibrary();
functionLibrary6.setFunctionLibraryName("sample6");
functionLibrary6.setDescription("sample6");
functionLibrary6.setFunctionLibraryScript("samplefunction6");
FunctionLibrary functionLibrary7 = new FunctionLibrary();
functionLibrary7.setFunctionLibraryName("sample7");
functionLibrary7.setDescription("sample7");
functionLibrary7.setFunctionLibraryScript("samplefunction7");
return new Object[][] { { Arrays.asList(functionLibrary4, functionLibrary5), SAMPLE_TENANT_DOMAIN }, { Arrays.asList(functionLibrary6, functionLibrary7), SAMPLE_TENANT_DOMAIN2 } };
}
use of org.wso2.carbon.identity.functions.library.mgt.model.FunctionLibrary in project carbon-identity-framework by wso2.
the class FunctionLibraryDAOImplTest method updateFunctionLibrary.
@Test(dataProvider = "updateFunctionLibraryDataProvider")
public void updateFunctionLibrary(Object functionLibrary, String tenantDomain) throws SQLException, FunctionLibraryManagementException {
try (Connection connection1 = DAOUtils.getConnection(DB_NAME);
Connection connection2 = DAOUtils.getConnection(DB_NAME)) {
FunctionLibraryDAO functionLibraryDAO = new FunctionLibraryDAOImpl();
addFunctionLibraries(functionLibraryDAO, Collections.singletonList(functionLibrary), tenantDomain);
FunctionLibrary funLib = (FunctionLibrary) functionLibrary;
String oldName = funLib.getFunctionLibraryName();
funLib.setFunctionLibraryName("updatedName");
when(IdentityDatabaseUtil.getDBConnection()).thenReturn(connection1);
functionLibraryDAO.updateFunctionLibrary(oldName, funLib, tenantDomain);
when(IdentityDatabaseUtil.getDBConnection(false)).thenReturn(connection2);
assertNotNull(functionLibraryDAO.getFunctionLibrary(funLib.getFunctionLibraryName(), tenantDomain), "Failed to update script library.");
// Clean after test
deleteFunctionLibraries(functionLibraryDAO, Collections.singletonList(functionLibrary), tenantDomain);
}
}
use of org.wso2.carbon.identity.functions.library.mgt.model.FunctionLibrary in project carbon-identity-framework by wso2.
the class FunctionLibraryDAOImplTest method getFunctionLibraryData.
@DataProvider(name = "getFunctionLibraryDataProvider")
public Object[][] getFunctionLibraryData() {
FunctionLibrary functionLibrary8 = new FunctionLibrary();
functionLibrary8.setFunctionLibraryName("sample8");
functionLibrary8.setDescription("sample8");
functionLibrary8.setFunctionLibraryScript("samplefunction8");
FunctionLibrary functionLibrary9 = new FunctionLibrary();
functionLibrary9.setFunctionLibraryName("sample9");
functionLibrary9.setDescription("sample9");
functionLibrary9.setFunctionLibraryScript("samplefunction9");
return new Object[][] { { functionLibrary8, SAMPLE_TENANT_DOMAIN }, { functionLibrary9, SAMPLE_TENANT_DOMAIN2 } };
}
Aggregations