List of usage examples for junit.framework Assert assertFalse
static public void assertFalse(boolean condition)
From source file:org.obiba.onyx.core.service.impl.ConfigurablePasswordValidationStrategyImplTest.java
@Test public void testTurningOffUserAttributePasswordValidation() { user.setFirstName("Molly"); user.setLastName("Stephenson"); user.setLogin("fherbert"); ((AbstractPasswordLengthValidationStrategy) passwordStrategy).setMaximumSize(0); ((ConfigurablePasswordValidationStrategyImpl) passwordStrategy).setPreventUserAttributeUsage(false); List<MessageSourceResolvable> messageList = passwordStrategy.validatePassword(user, "MollyStephensonfherbert"); Assert.assertFalse(containsErrorCode(messageList, PasswordValidationErrors.CONTAINS_FIRST_NAME)); Assert.assertFalse(containsErrorCode(messageList, PasswordValidationErrors.CONTAINS_LAST_NAME)); Assert.assertFalse(containsErrorCode(messageList, PasswordValidationErrors.CONTAINS_LOGIN_NAME)); }
From source file:de.hybris.platform.util.database.TableNameDatabaseMetaDataCallbackTest.java
@Test public void testOmmitAdminTablesForCustomTablePrefix() throws MetaDataAccessException { final String TABLE_PREFIX = "FoO_"; // play around with case sensitiveness final String before = Config.getParameter("db.tableprefix"); Mockito.reset(defaultQueryProvider); Mockito.when(defaultQueryProvider.getTableName()) .thenReturn(TABLE_PREFIX + QueryProviderFactory.LOCK_TABLE); try {/*from w w w . ja v a 2 s.c o m*/ Config.setParameter("db.tableprefix", TABLE_PREFIX); createTable(dataSource, TABLE_PREFIX + QueryProviderFactory.LOCK_TABLE); // final TableNameDatabaseMetaDataCallback tablesFilterCallback = new TableNameDatabaseMetaDataCallback( defaultQueryProvider, Registry.getCurrentTenantNoFallback()) { @Override Collection<SlaveTenant> getSlaveTenants() { return allSlaves; } }; final List<String> tables = (List<String>) JdbcUtils.extractDatabaseMetaData(dataSource, tablesFilterCallback); Assert.assertFalse(tables.contains("JGROUPSPING")); // Assert.assertTrue(tables.contains(QueryProviderFactory.LOCK_TABLE)); Assert.assertFalse(tables.contains(TABLE_PREFIX + QueryProviderFactory.LOCK_TABLE)); Assert.assertFalse(tables.contains((TABLE_PREFIX + QueryProviderFactory.LOCK_TABLE).toLowerCase())); Assert.assertFalse(tables.contains((TABLE_PREFIX + QueryProviderFactory.LOCK_TABLE).toUpperCase())); } finally { Config.setParameter("db.tableprefix", before); dropTable(dataSource, TABLE_PREFIX + QueryProviderFactory.LOCK_TABLE); } }
From source file:de.hybris.platform.servicelayer.media.impl.DefaultMediaPermissionServiceIntegrationTest.java
/** * Test method for// ww w . j a v a 2 s .co m * {@link de.hybris.platform.servicelayer.media.impl.DefaultMediaPermissionService#denyReadPermission(de.hybris.platform.core.model.media.MediaModel, de.hybris.platform.core.model.security.PrincipalModel)} * . */ @Test public void testDenyPermission() { final PermissionAssignment testAssignment = new PermissionAssignment(PermissionsConstants.READ, userService.getCurrentUser(), true); final Collection<PermissionAssignment> permAssignments = permissionManagementService .getItemPermissionsForPrincipal(testMediaItem, userService.getCurrentUser()); Assert.assertFalse(permAssignments.contains(testAssignment)); mediaPermissionService.denyReadPermission(testMediaItem, userService.getCurrentUser()); final PermissionCheckResult checkResult = permissionCheckingService.checkItemPermission(testMediaItem, userService.getCurrentUser(), PermissionsConstants.READ); Assert.assertFalse(checkResult.isGranted()); }
From source file:de.clusteval.data.dataset.TestDataSetConfig.java
/** * Test method for {@link data.dataset.DataSetConfig#register()}. * /*ww w .j av a2s . c o m*/ * @throws DataSetNotFoundException * @throws NoRepositoryFoundException * @throws DataSetConfigurationException * @throws UnknownDataSetFormatException * @throws DataSetConfigNotFoundException * @throws UnknownDistanceMeasureException * @throws RegisterException * @throws UnknownDataPreprocessorException * @throws NumberFormatException * @throws IncompatibleDataSetConfigPreprocessorException * @throws UnknownRunDataStatisticException * @throws UnknownRunStatisticException * @throws UnknownDataStatisticException * @throws NoOptimizableProgramParameterException * @throws UnknownParameterOptimizationMethodException * @throws IncompatibleParameterOptimizationMethodException * @throws UnknownRProgramException * @throws UnknownProgramTypeException * @throws UnknownProgramParameterException * @throws InvalidOptimizationParameterException * @throws UnknownRunResultFormatException * @throws IncompatibleContextException * @throws RunException * @throws UnknownClusteringQualityMeasureException * @throws UnknownParameterType * @throws FileNotFoundException * @throws UnknownContextException * @throws ConfigurationException * @throws DataConfigNotFoundException * @throws DataConfigurationException * @throws GoldStandardConfigNotFoundException * @throws GoldStandardConfigurationException * @throws GoldStandardNotFoundException */ public void testRegister() throws DataSetConfigurationException, NoRepositoryFoundException, DataSetNotFoundException, UnknownDataSetFormatException, DataSetConfigNotFoundException, UnknownDistanceMeasureException, RegisterException, UnknownDataSetTypeException, NoDataSetException, NumberFormatException, UnknownDataPreprocessorException, IncompatibleDataSetConfigPreprocessorException, GoldStandardNotFoundException, GoldStandardConfigurationException, GoldStandardConfigNotFoundException, DataConfigurationException, DataConfigNotFoundException, ConfigurationException, UnknownContextException, FileNotFoundException, UnknownParameterType, UnknownClusteringQualityMeasureException, RunException, IncompatibleContextException, UnknownRunResultFormatException, InvalidOptimizationParameterException, UnknownProgramParameterException, UnknownProgramTypeException, UnknownRProgramException, IncompatibleParameterOptimizationMethodException, UnknownParameterOptimizationMethodException, NoOptimizableProgramParameterException, UnknownDataStatisticException, UnknownRunStatisticException, UnknownRunDataStatisticException { this.repositoryObject = Parser.parseFromFile(DataSetConfig.class, new File("testCaseRepository/data/datasets/configs/astral_1.dsconfig").getAbsoluteFile()); Assert.assertEquals(this.repositoryObject, this.getRepository().getRegisteredObject((DataSetConfig) this.repositoryObject)); // adding a DataSetConfig equal to another one already registered // does // not register the second object. this.repositoryObject = new DataSetConfig((DataSetConfig) this.repositoryObject); Assert.assertEquals(this.getRepository().getRegisteredObject((DataSetConfig) this.repositoryObject), this.repositoryObject); Assert.assertFalse(this.getRepository() .getRegisteredObject((DataSetConfig) this.repositoryObject) == this.repositoryObject); }
From source file:io.cloudslang.engine.queue.repositories.ExecutionQueueRepositoryTest.java
@Test public void testPollForRecoveryDuplicateMsg() { //insert to states table List<ExecutionMessage> msg = new ArrayList<>(); ExecutionMessage execMsg = generateMessage("group1", "msg1", 1); execMsg.setWorkerId("worker1"); execMsg.setStatus(ExecStatus.IN_PROGRESS); msg.add(execMsg);/*from w w w. j a v a 2 s . c om*/ executionQueueRepository.insertExecutionStates(msg); executionQueueRepository.insertExecutionQueue(msg, 1L); List<ExecutionMessage> result = executionQueueRepository.pollRecovery("worker1", 10, ExecStatus.IN_PROGRESS); Assert.assertNotNull(result); Assert.assertFalse(result.isEmpty()); Assert.assertEquals("should find only 1 msg result!, since it is the same msg, no duplication", 1, result.size()); }
From source file:org.opencastproject.distribution.download.DownloadDistributionServiceImplTest.java
@Test public void testPartialDistribution() throws Exception { // Distribute only some of the elements in the mediapackage Job job1 = service.distribute("engage-player", mp, "track-1"); Job job2 = service.distribute("engage-player", mp, "catalog-1"); Job job3 = service.distribute("oai-pmh", mp, "catalog-1"); JobBarrier jobBarrier = new JobBarrier(serviceRegistry, 500, job1, job2, job3); jobBarrier.waitForJobs();//ww w. j a v a 2 s . c o m File mpDir = new File(distributionRoot, PathSupport.path("engage-player", mp.getIdentifier().compact())); Assert.assertTrue(mpDir.exists()); File mediaDir = new File(mpDir, "track-1"); File metadataDir = new File(mpDir, "catalog-1"); File attachmentsDir = new File(mpDir, "notes"); Assert.assertTrue(mediaDir.exists()); Assert.assertTrue(metadataDir.exists()); Assert.assertFalse(attachmentsDir.exists()); Assert.assertTrue(new File(mediaDir, "media.mov").exists()); // the filenames are changed to reflect the element ID Assert.assertTrue(new File(metadataDir, "dublincore.xml").exists()); Assert.assertFalse(new File(metadataDir, "mpeg7.xml").exists()); Assert.assertFalse(new File(attachmentsDir, "attachment.txt").exists()); }
From source file:org.opencastproject.distribution.hls.HLSDistributionServiceImplTest.java
@Test public void testPartialDistribution() throws Exception { // Distribute only some of the elements in the mediapackage Job job1 = service.distribute(mp, "track-1"); // "catalog-2" and "notes" are // not to be distributed Job job2 = service.distribute(mp, "catalog-1"); // "catalog-2" and "notes" // are not to be // distributed JobBarrier jobBarrier = new JobBarrier(serviceRegistry, 500, job1, job2); jobBarrier.waitForJobs();/*ww w.java 2 s .c o m*/ File mpDir = new File(distributionRoot, mp.getIdentifier().compact()); Assert.assertTrue(mpDir.exists()); File mediaDir = new File(mpDir, "track-1"); File metadataDir = new File(mpDir, "catalog-1"); File attachmentsDir = new File(mpDir, "notes"); Assert.assertTrue(mediaDir.exists()); Assert.assertTrue(metadataDir.exists()); Assert.assertFalse(attachmentsDir.exists()); Assert.assertTrue(new File(mediaDir, "media.mov").exists()); // the filenames are changed to reflect the element ID Assert.assertTrue(new File(metadataDir, "dublincore.xml").exists()); Assert.assertFalse(new File(metadataDir, "mpeg7.xml").exists()); Assert.assertFalse(new File(attachmentsDir, "attachment.txt").exists()); }
From source file:datafu.test.pig.sessions.SessionTests.java
@Test public void sessionizeExecTest() throws Exception { Sessionize sessionize = new Sessionize("30m"); Tuple input = TupleFactory.getInstance().newTuple(1); DataBag inputBag = BagFactory.getInstance().newDefaultBag(); input.set(0, inputBag);/*from www .j a v a 2 s .co m*/ Tuple item; List<Tuple> result; DateTime dt; // test same session id inputBag.clear(); dt = new DateTime(); item = TupleFactory.getInstance().newTuple(1); item.set(0, dt.getMillis()); inputBag.add(item); item = TupleFactory.getInstance().newTuple(1); item.set(0, dt.plusMinutes(28).getMillis()); inputBag.add(item); result = toList(sessionize.exec(input)); Assert.assertEquals(2, result.size()); Assert.assertEquals(2, result.get(0).size()); Assert.assertEquals(2, result.get(1).size()); // session ids match Assert.assertTrue(result.get(0).get(1).equals(result.get(1).get(1))); // test different session id inputBag.clear(); dt = new DateTime(); item = TupleFactory.getInstance().newTuple(1); item.set(0, dt.getMillis()); inputBag.add(item); item = TupleFactory.getInstance().newTuple(1); item.set(0, dt.plusMinutes(31).getMillis()); inputBag.add(item); result = toList(sessionize.exec(input)); Assert.assertEquals(2, result.size()); Assert.assertEquals(2, result.get(0).size()); Assert.assertEquals(2, result.get(1).size()); // session ids don't match Assert.assertFalse(result.get(0).get(1).equals(result.get(1).get(1))); }
From source file:me.buom.shiro.test.AppTest.java
@Test @Repeat(times = 3, warmUp = 1)// ww w . jav a2 s.co m public void test_admin() throws Exception { URL url = new URL(baseUrl.toExternalForm() + "admin"); HttpPost method = new HttpPost(url.toURI()); String contentType = "application/json; charset=utf-8"; String entity = "lady gaga"; Header[] headers = buildHeader(ApiKey.ADMIN, method, contentType, entity); method.setHeaders(headers); method.setEntity(new StringEntity(entity, ContentType.create(contentType))); HttpResponse execute = client.execute(method); StatusLine statusLine = execute.getStatusLine(); printResponse(execute); printHeader(execute); Assert.assertFalse(statusLine.getStatusCode() != 200); }
From source file:org.openmrs.module.paperrecord.PaperRecordServiceComponentTest.java
@Test public void testPaperMedicalRecordExistsForPatientShouldReturnFalseIfWrongLocation() { // from the standard test dataset Location medicalRecordLocation = locationService.getLocation(2); // the patient with this primary identifier has a paper record identifier for location 1, but not location 2 Assert.assertFalse(paperRecordService.paperRecordExistsForPatientWithPrimaryIdentifier("6TS-4", medicalRecordLocation));/*from w ww .ja v a2s . c o m*/ }