Search in sources :

Example 16 with FunctionLibrary

use of org.wso2.carbon.identity.functions.library.mgt.model.FunctionLibrary in project carbon-identity-framework by wso2.

the class FunctionLibraryDAOImplTest method getFunctionLibrary.

@Test(dataProvider = "getFunctionLibraryDataProvider")
public void getFunctionLibrary(Object functionLibrary, String tenantDomain) throws SQLException, FunctionLibraryManagementException {
    try (Connection connection = DAOUtils.getConnection(DB_NAME)) {
        FunctionLibraryDAO functionLibraryDAO = new FunctionLibraryDAOImpl();
        addFunctionLibraries(functionLibraryDAO, Collections.singletonList(functionLibrary), tenantDomain);
        when(IdentityDatabaseUtil.getDBConnection(false)).thenReturn(connection);
        assertTrue(functionLibraryDAO.getFunctionLibrary(((FunctionLibrary) functionLibrary).getFunctionLibraryName(), tenantDomain) != null, "Failed to retrieve script library");
        // Clean after test
        deleteFunctionLibraries(functionLibraryDAO, Collections.singletonList(functionLibrary), tenantDomain);
    }
}
Also used : Connection(java.sql.Connection) FunctionLibraryDAO(org.wso2.carbon.identity.functions.library.mgt.dao.FunctionLibraryDAO) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) PowerMockIdentityBaseTest(org.wso2.carbon.identity.testutil.powermock.PowerMockIdentityBaseTest)

Example 17 with FunctionLibrary

use of org.wso2.carbon.identity.functions.library.mgt.model.FunctionLibrary in project carbon-identity-framework by wso2.

the class FunctionLibraryDAOImplTest method deleteFunctionLibrary.

@DataProvider(name = "deleteFunctionLibraryData")
public Object[][] deleteFunctionLibrary() {
    FunctionLibrary functionLibrary10 = new FunctionLibrary();
    functionLibrary10.setFunctionLibraryName("sample10");
    functionLibrary10.setDescription("sample10");
    functionLibrary10.setFunctionLibraryScript("samplefunction10");
    FunctionLibrary functionLibrary11 = new FunctionLibrary();
    functionLibrary11.setFunctionLibraryName("sample11");
    functionLibrary11.setDescription("sample11");
    functionLibrary11.setFunctionLibraryScript("samplefunction11");
    return new Object[][] { { functionLibrary10, SAMPLE_TENANT_DOMAIN }, { functionLibrary11, SAMPLE_TENANT_DOMAIN2 } };
}
Also used : FunctionLibrary(org.wso2.carbon.identity.functions.library.mgt.model.FunctionLibrary) DataProvider(org.testng.annotations.DataProvider)

Example 18 with FunctionLibrary

use of org.wso2.carbon.identity.functions.library.mgt.model.FunctionLibrary in project carbon-identity-framework by wso2.

the class FunctionLibraryDAOImplTest method isFunctionLibraryExistsData.

@DataProvider(name = "isFunctionLibraryExistsDataProvider")
public Object[][] isFunctionLibraryExistsData() {
    FunctionLibrary functionLibrary14 = new FunctionLibrary();
    functionLibrary14.setFunctionLibraryName("sample14");
    functionLibrary14.setDescription("sample14");
    functionLibrary14.setFunctionLibraryScript("samplefunction14");
    FunctionLibrary functionLibrary15 = new FunctionLibrary();
    functionLibrary15.setFunctionLibraryName("sample15");
    functionLibrary15.setDescription("sample15");
    functionLibrary15.setFunctionLibraryScript("samplefunction15");
    return new Object[][] { { functionLibrary14, SAMPLE_TENANT_DOMAIN }, { functionLibrary15, SAMPLE_TENANT_DOMAIN2 } };
}
Also used : FunctionLibrary(org.wso2.carbon.identity.functions.library.mgt.model.FunctionLibrary) DataProvider(org.testng.annotations.DataProvider)

Example 19 with FunctionLibrary

use of org.wso2.carbon.identity.functions.library.mgt.model.FunctionLibrary in project carbon-identity-framework by wso2.

the class FunctionLibraryDAOImplTest method updateFunctionLibraryData.

@DataProvider(name = "updateFunctionLibraryDataProvider")
public Object[][] updateFunctionLibraryData() {
    FunctionLibrary functionLibrary12 = new FunctionLibrary();
    functionLibrary12.setFunctionLibraryName("sample12");
    functionLibrary12.setDescription("sample12");
    functionLibrary12.setFunctionLibraryScript("samplefunction12");
    FunctionLibrary functionLibrary13 = new FunctionLibrary();
    functionLibrary13.setFunctionLibraryName("sample13");
    functionLibrary13.setDescription("sample13");
    functionLibrary13.setFunctionLibraryScript("samplefunction13");
    return new Object[][] { { functionLibrary12, SAMPLE_TENANT_DOMAIN }, { functionLibrary13, SAMPLE_TENANT_DOMAIN2 } };
}
Also used : FunctionLibrary(org.wso2.carbon.identity.functions.library.mgt.model.FunctionLibrary) DataProvider(org.testng.annotations.DataProvider)

Example 20 with FunctionLibrary

use of org.wso2.carbon.identity.functions.library.mgt.model.FunctionLibrary in project product-is by wso2.

the class FunctionLibraryManagementTestCase method testGetFunctionLibrary.

@Test(alwaysRun = true, description = "Test getting a Function Library")
public void testGetFunctionLibrary() {
    String functionLibraryName = "TestFunctionLibrary";
    try {
        FunctionLibrary functionLibrary = functionLibraryManagementServiceClient.getFunctionLibrary(functionLibraryName);
        Assert.assertEquals(functionLibrary.getFunctionLibraryName(), functionLibraryName, "Failed to retrieve a function library");
    } catch (AxisFault axisFault) {
        Assert.fail("Error while trying to retrieve a function library", axisFault);
    }
}
Also used : AxisFault(org.apache.axis2.AxisFault) FunctionLibrary(org.wso2.carbon.identity.functions.library.mgt.model.xsd.FunctionLibrary) ISIntegrationTest(org.wso2.identity.integration.common.utils.ISIntegrationTest) Test(org.testng.annotations.Test)

Aggregations

FunctionLibrary (org.wso2.carbon.identity.functions.library.mgt.model.FunctionLibrary)31 Test (org.testng.annotations.Test)19 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)15 PowerMockIdentityBaseTest (org.wso2.carbon.identity.testutil.powermock.PowerMockIdentityBaseTest)15 DataProvider (org.testng.annotations.DataProvider)13 FunctionLibraryManagementException (org.wso2.carbon.identity.functions.library.mgt.exception.FunctionLibraryManagementException)11 FunctionLibraryDAO (org.wso2.carbon.identity.functions.library.mgt.dao.FunctionLibraryDAO)10 Connection (java.sql.Connection)9 FunctionLibraryDAOImpl (org.wso2.carbon.identity.functions.library.mgt.dao.impl.FunctionLibraryDAOImpl)9 SQLException (java.sql.SQLException)5 AxisFault (org.apache.axis2.AxisFault)5 FunctionLibrary (org.wso2.carbon.identity.functions.library.mgt.model.xsd.FunctionLibrary)5 IOException (java.io.IOException)4 ISIntegrationTest (org.wso2.identity.integration.common.utils.ISIntegrationTest)4 PreparedStatement (java.sql.PreparedStatement)3 IdentityRuntimeException (org.wso2.carbon.identity.base.IdentityRuntimeException)3 File (java.io.File)2 ResultSet (java.sql.ResultSet)2 ArrayList (java.util.ArrayList)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1