List of usage examples for junit.framework Assert assertFalse
static public void assertFalse(boolean condition)
From source file:com.smartitengineering.util.rest.client.jersey.cache.CustomResolverBasedCacheableClientTest.java
@Test public void testHead() { WebResource r = getClient(new DefaultApacheHttpClientConfig()) .resource(getUri().path(Resources.METHOD_PATH).build()); ClientResponse cr = r.head();//from w w w . j a v a 2s.co m Assert.assertFalse(cr.hasEntity()); cr.close(); }
From source file:at.tugraz.ist.akm.test.webservice.server.SimpleWebServerTest.java
License:asdf
public void testStartSecureServer() { logDebug("testStartSecureServer"); mServerConfig.isHttpsEnabled = true; mServerConfig.isUserAuthEnabled = false; mServerConfig.password = "asdf"; mServerConfig.port = 8888;//from w w w .j a v a 2 s . co m mServerConfig.protocolName = "https"; mServerConfig.username = "huaba"; SharedPreferencesProvider serverConfig = new SharedPreferencesProvider(mContext); String keystorePassword = "foobar64"; serverConfig.setKeyStorePassword(keystorePassword); String keystoreFilePath = new String(mContext.getFilesDir().getPath().toString() + "/" + mContext.getResources().getString(R.string.preferences_keystore_store_filename)); try { serverConfig.close(); } catch (Throwable e) { logError("failed closing server config"); } ApplicationKeyStore appKeystore = new ApplicationKeyStore(); appKeystore.loadKeystore(keystorePassword, keystoreFilePath); try { appKeystore.close(); } catch (Throwable e) { logError("failed closing application keystore"); } try { startServer(true); Assert.assertTrue(mWebserver.isRunning()); } catch (Exception ex) { ex.printStackTrace(); Assert.fail(ex.getMessage()); } stopServer(); Assert.assertFalse(mWebserver.isRunning()); try { mWebserver.close(); } catch (Throwable e) { logError("failed closing webserver", e); } }
From source file:de.hybris.platform.util.database.TableNameDatabaseMetaDataCallbackTest.java
@Test public void testDropAllMyNonPrefixedTablesLeaveOthersWithPrefixes() throws MetaDataAccessException { final String currentPrefix = getTablePrefix(drop1Tenant); Assume.assumeTrue(org.apache.commons.lang.StringUtils.isBlank(currentPrefix));// empty prefix final String otherPrefix = getTablePrefix(drop2Tenant); final String yetAnotherPrefix = getTablePrefix(drop3Tenant); createTable(dataSource, "foo"); createTable(dataSource, "bar"); createTable(dataSource, "boo"); createTable(dataSource, otherPrefix + "foo"); createTable(dataSource, otherPrefix + "bar"); createTable(dataSource, otherPrefix + "boo"); createTable(dataSource, yetAnotherPrefix + "foo"); createTable(dataSource, yetAnotherPrefix + "bar"); createTable(dataSource, yetAnotherPrefix + "boo"); final TableNameDatabaseMetaDataCallback tablesFilterCallback = new TableNameDatabaseMetaDataCallback( defaultQueryProvider, drop1Tenant) { @Override//w w w. j ava 2 s. c om Collection<SlaveTenant> getSlaveTenants() { return allSlaves; } @Override Tenant getMasterTenant() { // just to have different table prefix return drop3Tenant; } }; final List<String> tables = (List<String>) JdbcUtils.extractDatabaseMetaData(dataSource, tablesFilterCallback); Assert.assertTrue(containsIgnoreCase(currentPrefix + "foo", tables)); Assert.assertTrue(containsIgnoreCase(currentPrefix + "bar", tables)); Assert.assertTrue(containsIgnoreCase(currentPrefix + "boo", tables)); Assert.assertFalse(containsIgnoreCase(otherPrefix + "foo", tables)); Assert.assertFalse(containsIgnoreCase(otherPrefix + "bar", tables)); Assert.assertFalse(containsIgnoreCase(otherPrefix + "boo", tables)); Assert.assertFalse(containsIgnoreCase(yetAnotherPrefix + "foo", tables)); Assert.assertFalse(containsIgnoreCase(yetAnotherPrefix + "bar", tables)); Assert.assertFalse(containsIgnoreCase(yetAnotherPrefix + "boo", tables)); testOmmitAdminTables(); }
From source file:BQJDBC.QueryResultTest.Timeouttest.java
@Test public void QueryResultTest05() { final String sql = "SELECT word FROM publicdata:samples.shakespeare WHERE word=\"huzzah\""; final String description = "The word \"huzzah\" NOTE: It doesn't appear in any any book, so it returns with a null #WHERE"; this.logger.info("Test number: 05"); this.logger.info("Running query:" + sql); java.sql.ResultSet Result = null; try {// w ww .java 2s . c o m Result = Timeouttest.con.createStatement().executeQuery(sql); this.logger.debug(Result.getMetaData().getColumnCount()); } catch (SQLException e) { this.logger.error("SQLexception" + e.toString()); Assert.fail("SQLException" + e.toString()); } Assert.assertNotNull(Result); this.logger.debug(description); try { if (Result.getType() != ResultSet.TYPE_FORWARD_ONLY) Assert.assertFalse(Result.first()); } catch (SQLException e) { this.logger.error("SQLexception" + e.toString()); Assert.fail(e.toString()); } }
From source file:opennlp.tools.util.Span.java
/** * Test for {@link Span#startsWith(Span)}. *//* w w w . j av a 2s. c o m*/ public void testStartsWith() { Span a = new Span(10, 50); Span b = new Span(10, 12); Assert.assertTrue(a.startsWith(a)); Assert.assertTrue(a.startsWith(b)); Assert.assertFalse(b.startsWith(a)); }
From source file:com.ebay.cloud.cms.query.service.QueryPaginationByIdTest.java
@Test public void testService02() { QueryContext tempContext = newQueryContext(RAPTOR_REPO, RAPTOR_MAIN_BRANCH_ID); tempContext.setAllowFullTableScan(true); tempContext.setPaginationMode(PaginationMode.ID_BASED); QueryCursor cursor = tempContext.getCursor(); cursor.setJoinCursorValues(Arrays.<String>asList(null, null, null, null)); cursor.setLimits(new int[] { 0, 12, 0 }); IQueryResult result = queryService.query("ApplicationService.services{@name}.runsOn{@name}", tempContext); List<IEntity> services = (List<IEntity>) result.getEntities(); Assert.assertEquals(10, services.size()); Assert.assertEquals("srp-app:Raptor-00002", services.get(0).getFieldValues("name").get(0)); Assert.assertEquals("srp-app:Raptor-00003", services.get(1).getFieldValues("name").get(0)); Assert.assertFalse(result.hasMoreResults()); }
From source file:BQJDBC.QueryResultTest.QueryResultTest.java
@Test public void QueryResultTest05() { final String sql = "SELECT word FROM publicdata:samples.shakespeare WHERE word='huzzah' ;"; final String description = "The word \"huzzah\" NOTE: It doesn't appear in any any book, so it returns with a null #WHERE"; this.logger.info("Test number: 05"); this.logger.info("Running query:" + sql); java.sql.ResultSet Result = null; try {//from www . j a va 2 s. c o m Result = QueryResultTest.con.createStatement().executeQuery(sql); this.logger.debug(Result.getMetaData().getColumnCount()); } catch (SQLException e) { this.logger.error("SQLexception" + e.toString()); Assert.fail("SQLException" + e.toString()); } Assert.assertNotNull(Result); this.logger.debug(description); try { if (Result.getType() != ResultSet.TYPE_FORWARD_ONLY) Assert.assertFalse(Result.first()); } catch (SQLException e) { this.logger.error("SQLexception" + e.toString()); Assert.fail(e.toString()); } }
From source file:org.wso2.carbon.apimgt.handlers.AuthenticationHandlerTest.java
@Test(description = "Handle request with IO exception", dependsOnMethods = "testHandleRequestWithCertMgmtException") public void testHandleRequestWithIOException() throws Exception { HashMap<String, String> transportHeaders = new HashMap<>(); transportHeaders.put(AuthConstants.ENCODED_PEM, "encoded pem"); setMockClient();/*from w ww.ja v a 2 s . co m*/ this.mockClient.setResponse(getAccessTokenReponse()); this.mockClient.setResponse(null); MessageContext messageContext = createSynapseMessageContext("<empty/>", this.synapseConfiguration, transportHeaders, "https://test.com/testservice/api/testdevice"); boolean response = this.handler.handleRequest(messageContext); Assert.assertFalse(response); this.mockClient.reset(); }
From source file:com.ibm.team.build.internal.hjplugin.tests.BuildConfigurationIT.java
private void validateBuildProperties(String workspaceItemId, String fetchDestination, boolean deleteBeforeFetch, boolean acceptBeforeFetch, String componentLoadRules, boolean includeComponents, String loadComponents, String snapshotItemId, int changesAccepted, boolean createFoldersForComponents, Map<String, String> properties) { final String PROPERTY_WORKSPACE_UUID = "team_scm_workspaceUUID"; //$NON-NLS-1$ final String PROPERTY_FETCH_DESTINATION = "team_scm_fetchDestination"; //$NON-NLS-1$ final String PROPERTY_DELETE_DESTINATION_BEFORE_FETCH = "team_scm_deleteDestinationBeforeFetch"; //$NON-NLS-1$ final String PROPERTY_ACCEPT_BEFORE_FETCH = "team_scm_acceptBeforeFetch"; //$NON-NLS-1$ final String PROPERTY_BUILD_ONLY_IF_CHANGES = "team_scm_buildOnlyIfChanges"; //$NON-NLS-1$ final String PROPERTY_COMPONENT_LOAD_RULES = "team_scm_componentLoadRules"; //$NON-NLS-1$ final String PROPERTY_INCLUDE_COMPONENTS = "team_scm_includeComponents"; //$NON-NLS-1$ final String PROPERTY_LOAD_COMPONENTS = "team_scm_loadComponents"; //$NON-NLS-1$ final String PROPERTY_SNAPSHOT_UUID = "team_scm_snapshotUUID"; //$NON-NLS-1$ final String PROPERTY_CHANGES_ACCEPTED = "team_scm_changesAccepted"; //$NON-NLS-1$ final String PROPERTY_CREATE_FOLDERS_FOR_COMPONENTS = "team_scm_createFoldersForComponents"; //$NON-NLS-1$ Assert.assertEquals(workspaceItemId, properties.get(PROPERTY_WORKSPACE_UUID)); Assert.assertEquals(fetchDestination, properties.get(PROPERTY_FETCH_DESTINATION)); Assert.assertEquals(Boolean.toString(deleteBeforeFetch), properties.get(PROPERTY_DELETE_DESTINATION_BEFORE_FETCH)); Assert.assertEquals(Boolean.toString(acceptBeforeFetch), properties.get(PROPERTY_ACCEPT_BEFORE_FETCH)); Assert.assertEquals(componentLoadRules, properties.get(PROPERTY_COMPONENT_LOAD_RULES)); String property = properties.get(PROPERTY_INCLUDE_COMPONENTS); if (property != null) { Assert.assertEquals(Boolean.toString(includeComponents), properties.get(PROPERTY_INCLUDE_COMPONENTS)); } else {//from w w w .j av a 2s. c o m Assert.assertFalse(includeComponents); } Assert.assertEquals(loadComponents, properties.get(PROPERTY_LOAD_COMPONENTS)); Assert.assertEquals(snapshotItemId, properties.get(PROPERTY_SNAPSHOT_UUID)); Assert.assertEquals((changesAccepted > 0 ? Integer.toString(changesAccepted) : null), properties.get(PROPERTY_CHANGES_ACCEPTED)); Assert.assertEquals(Boolean.toString(createFoldersForComponents), properties.get(PROPERTY_CREATE_FOLDERS_FOR_COMPONENTS)); }
From source file:de.itsvs.cwtrpc.controller.AutowiredRemoteServiceGroupConfigTest.java
@Test public void testIsAcceptedServiceInterface2() { final AutowiredRemoteServiceGroupConfig config; config = new AutowiredRemoteServiceGroupConfig(); config.setBasePackages(Arrays.asList(new String[] { "de.itsvs.cwtrpc.controller.config." })); Assert.assertFalse(config.isAcceptedServiceInterface(Pattern.class)); Assert.assertTrue(config.isAcceptedServiceInterface(TestService10.class)); }