use of org.wso2.carbon.identity.functions.library.mgt.model.FunctionLibrary in project carbon-identity-framework by wso2.
the class FunctionLibraryManagementServiceTest method testAlreadyExistFunctionLibrary.
@Test(dataProvider = "tesAlreadyExistFunctionLibraryDataProvider")
public void testAlreadyExistFunctionLibrary(Object functionLibrary, String tenantDomain) {
FunctionLibraryDAOImpl functionLibraryDAO = PowerMockito.mock(FunctionLibraryDAOImpl.class);
try {
PowerMockito.whenNew(FunctionLibraryDAOImpl.class).withNoArguments().thenReturn(functionLibraryDAO);
when(functionLibraryDAO.getFunctionLibrary(((FunctionLibrary) functionLibrary).getFunctionLibraryName(), tenantDomain)).thenReturn((FunctionLibrary) functionLibrary);
FunctionLibraryManagementService functionLibraryManagementService = FunctionLibraryManagementServiceImpl.getInstance();
functionLibraryManagementService.createFunctionLibrary((FunctionLibrary) functionLibrary, tenantDomain);
assertEquals(functionLibraryManagementService.getFunctionLibrary(((FunctionLibrary) functionLibrary).getFunctionLibraryName(), tenantDomain).getFunctionLibraryName(), ((FunctionLibrary) functionLibrary).getFunctionLibraryName());
} catch (FunctionLibraryManagementException e) {
assertEquals(e.getMessage(), "Already a script library available with the name: " + ((FunctionLibrary) functionLibrary).getFunctionLibraryName() + ".");
} catch (Exception e) {
fail("Exception", e);
}
}
use of org.wso2.carbon.identity.functions.library.mgt.model.FunctionLibrary in project carbon-identity-framework by wso2.
the class FunctionLibraryManagementServiceTest method getFunctionLibraryData.
@DataProvider(name = "getFunctionLibraryDataProvider")
public Object[][] getFunctionLibraryData() {
FunctionLibrary functionLibrary9 = new FunctionLibrary();
functionLibrary9.setFunctionLibraryName("sample9");
functionLibrary9.setDescription("sample9");
functionLibrary9.setFunctionLibraryScript("function samplefunction9(){}");
FunctionLibrary functionLibrary10 = new FunctionLibrary();
functionLibrary10.setFunctionLibraryName("sample10");
functionLibrary10.setDescription("sample10");
functionLibrary10.setFunctionLibraryScript("function samplefunction10(){}");
return new Object[][] { { functionLibrary9, SAMPLE_TENANT_DOMAIN }, { functionLibrary10, null } };
}
use of org.wso2.carbon.identity.functions.library.mgt.model.FunctionLibrary in project carbon-identity-framework by wso2.
the class FunctionLibraryManagementServiceTest method testFunctionLibraryNameRequiredDataProvider.
@DataProvider(name = "testFunctionLibraryNameRequiredDataProvider")
public Object[][] testFunctionLibraryNameRequiredDataProvider() {
FunctionLibrary functionLibrary20 = new FunctionLibrary();
functionLibrary20.setFunctionLibraryName(null);
functionLibrary20.setDescription("sample18");
functionLibrary20.setFunctionLibraryScript("function samplefunction20(){}");
return new Object[][] { { functionLibrary20, SAMPLE_TENANT_DOMAIN2 } };
}
use of org.wso2.carbon.identity.functions.library.mgt.model.FunctionLibrary in project carbon-identity-framework by wso2.
the class FunctionLibraryManagementServiceTest method listFunctionLibrariesData.
@DataProvider(name = "listFunctionLibraryDataProvider")
public Object[][] listFunctionLibrariesData() {
FunctionLibrary functionLibrary6 = new FunctionLibrary();
functionLibrary6.setFunctionLibraryName("sample6");
functionLibrary6.setDescription("sample6");
functionLibrary6.setFunctionLibraryScript("function samplefunction6(){}");
FunctionLibrary functionLibrary7 = new FunctionLibrary();
functionLibrary7.setFunctionLibraryName("sample7");
functionLibrary7.setDescription("sample7");
functionLibrary7.setFunctionLibraryScript("function samplefunction7(){}");
FunctionLibrary functionLibrary8 = new FunctionLibrary();
functionLibrary8.setFunctionLibraryName("sample8");
functionLibrary8.setDescription("sample8");
functionLibrary8.setFunctionLibraryScript("function samplefunction8(){}");
return new Object[][] { { Arrays.asList(functionLibrary6, functionLibrary7, functionLibrary8), SAMPLE_TENANT_DOMAIN } };
}
use of org.wso2.carbon.identity.functions.library.mgt.model.FunctionLibrary in project carbon-identity-framework by wso2.
the class FunctionLibraryManagementServiceTest method createFunctionLibraryData.
@DataProvider(name = "createFunctionLibraryDataProvider")
public Object[][] createFunctionLibraryData() {
FunctionLibrary functionLibrary1 = new FunctionLibrary();
functionLibrary1.setFunctionLibraryName("sample1");
functionLibrary1.setDescription("sample1");
functionLibrary1.setFunctionLibraryScript("function samplefunction1(){}");
FunctionLibrary functionLibrary2 = new FunctionLibrary();
functionLibrary2.setFunctionLibraryName("sample2");
functionLibrary2.setDescription("sample2");
functionLibrary2.setFunctionLibraryScript("function samplefunction2(){}");
FunctionLibrary functionLibrary3 = new FunctionLibrary();
functionLibrary3.setFunctionLibraryName("sample3");
functionLibrary3.setDescription("sample3");
functionLibrary3.setFunctionLibraryScript("function samplefunction3(){}");
FunctionLibrary functionLibrary4 = new FunctionLibrary();
functionLibrary4.setFunctionLibraryName("sample4");
functionLibrary4.setDescription("sample4");
functionLibrary4.setFunctionLibraryScript("function samplefunction4(){}");
FunctionLibrary functionLibrary5 = new FunctionLibrary();
functionLibrary5.setFunctionLibraryName("sample5");
functionLibrary5.setDescription("sample5");
functionLibrary5.setFunctionLibraryScript("function samplefunction5(){}");
return new Object[][] { { functionLibrary1, SAMPLE_TENANT_DOMAIN }, { functionLibrary2, SAMPLE_TENANT_DOMAIN }, { functionLibrary3, SAMPLE_TENANT_DOMAIN2 }, { functionLibrary4, SAMPLE_TENANT_DOMAIN2 }, { functionLibrary5, SAMPLE_TENANT_DOMAIN2 } };
}
Aggregations