List of usage examples for java.lang TestProvider TestProvider
TestProvider
From source file:cc.recommenders.evaluation.distribution.calc.AbstractTaskProviderTest.java
@Before public void setup() throws IOException { Logger.reset();//from ww w . j av a 2 s.co m Logger.setCapturing(true); store = mock(ProjectFoldedUsageStore.class); Set<ICoReTypeName> types = Sets.newLinkedHashSet(); types.add(TYPE1); types.add(TYPE2); types.add(TYPE3); when(store.getTypes()).thenReturn(types); mockStore(TYPE1, true, 1, 2); mockStore(TYPE2, true, 3, 4); mockStore(TYPE3, false); output = mock(OutputUtils.class); options = Maps.newLinkedHashMap(); options.put("A", "AAAA"); options.put("B", "BBBB"); sut = new TestProvider(); }
From source file:org.apache.hadoop.hbase.io.crypto.aes.TestAES.java
@Test public void testAlternateRNG() throws Exception { Security.addProvider(new TestProvider()); Configuration conf = new Configuration(); conf.set(AES.RNG_ALGORITHM_KEY, "TestRNG"); conf.set(AES.RNG_PROVIDER_KEY, "TEST"); DefaultCipherProvider.getInstance().setConf(conf); AES aes = new AES(DefaultCipherProvider.getInstance()); assertEquals("AES did not find alternate RNG", aes.getRNG().getAlgorithm(), "TestRNG"); }
From source file:org.pentaho.big.data.kettle.plugins.pig.NoArgJobEntryPigScriptExecutor.java
private static HadoopConfigurationProvider initProvider() { try {// ww w. j a v a2s.c o m return new TestProvider(); } catch (FileSystemException e) { e.printStackTrace(); return null; } }
From source file:org.sakaiproject.user.impl.test.AuthenticatedUserProviderTest.java
private static void oneTimeSetupAfter() throws Exception { userDirectoryProvider = new TestProvider(); // This is a workaround until we can make it easier to load sakai.properties // for specific integration tests. DbUserService dbUserService = (DbUserService) getService(UserDirectoryService.class.getName()); dbUserService.setProvider(userDirectoryProvider); // Inject service so that provider can create new user records or search // for existing ones. userDirectoryProvider.setUserFactory(dbUserService); userDirectoryProvider.setUserDirectoryService(dbUserService); userDirectoryProvider.setSecurityService((SecurityService) getService(SecurityService.class.getName())); }
From source file:org.sakaiproject.user.impl.test.GetUsersByEidTest.java
public static void oneTimeSetupAfter() throws Exception { TestProvider userDirectoryProvider = new TestProvider(); // This is a workaround until we can make it easier to load sakai.properties // for specific integration tests. dbUserService = (DbUserService) getService("org.sakaiproject.user.api.UserDirectoryService"); dbUserService.setProvider(userDirectoryProvider); callCache = ((MemoryService) getService("org.sakaiproject.memory.api.MemoryService")) .getCache("org.sakaiproject.user.api.UserDirectoryService.callCache"); authzGroupService = getService(AuthzGroupService.class); threadLocalManager = getService(ThreadLocalManager.class); sessionManager = getService(SessionManager.class); // Sakai provides no way to undo a EID-to-ID mapping, and so we can't use // a normal setUp and tearDown approach to loading test data. // Act as admin since we're checking functionality rather than authz. actAsAdmin();/*from ww w. jav a 2s . co m*/ // Add two local users for honesty's sake. User user; user = dbUserService.addUser(null, LOCAL_USER_EID, "Joe", "Guest", "joe@somewhere.edu", "pw", "Student", null); mappedUserIds.add(user.getId()); // Store for later use clearUserFromServiceCaches(user.getId()); //for the search later we want a similar user user = dbUserService.addUser(null, "thisIs a search user", "Joe", "Guest", "joe@somewhere.edu", "pw", "Student", null); // The User Directory Service implementation currently includes no metadata that // distinguishes a metadata-free Sakai-managed user from a provided user, and so // no field of a full join can be safely checked to decide whether the provider // needs to be called. To make sure no erroneous assumptions get made, create a // mostly-null user record. user = dbUserService.addUser(null, LOCAL_USER_WITH_NO_METADATA_EID); mappedUserIds.add(user.getId()); // Store for later use clearUserFromServiceCaches(user.getId()); // Our interest is in testing retrieval rather than creation. Pre-load all the // EID-to-ID mappings before doing the searches. for (int providedCounter = 0; providedCounter < MAX_NUMBER_OF_SQL_PARAMETERS_IN_LIST; providedCounter++) { user = dbUserService.getUserByEid(String.valueOf(providedCounter)); mappedUserIds.add(user.getId()); // Store for later use clearUserFromServiceCaches(user.getId()); } }
From source file:org.sakaiproject.user.impl.test.RequireLocalAccountLegacyAuthenticationTest.java
private static void oneTimeSetupAfter() throws Exception { userDirectoryProvider = new TestProvider(); // This is a workaround until we can make it easier to load sakai.properties // for specific integration tests. DbUserService dbUserService = (DbUserService) getService(UserDirectoryService.class.getName()); dbUserService.setProvider(userDirectoryProvider); User user = dbUserService.addUser(null, LOCALLY_STORED_EID, "J. " + LOCALLY_STORED_EID, "de " + LOCALLY_STORED_EID, LOCALLY_STORED_EMAIL, null, "Guest", null); log.debug("addUser eid=" + LOCALLY_STORED_EID + ", id=" + user.getId()); }
From source file:org.sakaiproject.user.impl.test.UserDirectoryServiceGetTest.java
private static void oneTimeSetupAfter() throws Exception { userDirectoryProvider = new TestProvider(); // This is a workaround until we can make it easier to load sakai.properties // for specific integration tests. DbUserService dbUserService = (DbUserService) getService(UserDirectoryService.class.getName()); dbUserService.setProvider(userDirectoryProvider); // Sakai user services very helpfully lowercase input EIDs rather than leaving them alone. addUserWithEid(dbUserService, "localuser"); addUserWithEid(dbUserService, "localfromauthn"); addUserWithEid(dbUserService, "localwithproviderauthn"); addUserWithEid(dbUserService, "localwithfailedproviderauthn"); }