List of usage examples for junit.framework Assert assertEquals
static public void assertEquals(int expected, int actual)
From source file:org.apache.vysper.xmpp.extension.xep0124.inttests.MethodsNotAllowedIntegrationTest.java
@Test public void doNotAllowPut() throws Exception { HttpResponse response = httpclient.execute(new HttpPut(getServerUrl())); Assert.assertEquals(405, response.getStatusLine().getStatusCode()); }
From source file:org.openspaces.itest.esb.mule.config.ConnectorConfigPropertiesFileTests.java
@Test public void testConnectorConfig() throws Exception { ApplicationContext context = muleContext.getRegistry() .lookupObject(SpringRegistry.SPRING_APPLICATION_CONTEXT); OpenSpacesQueueConnector connector = (OpenSpacesQueueConnector) context.getBean("queueConnector"); Assert.assertNotNull(connector);/*from www .j a v a 2 s.c om*/ Assert.assertEquals(Integer.valueOf(100), connector.getBatchSize()); Assert.assertEquals(60000L, connector.getTimeout()); Assert.assertTrue(connector.isFifo()); Assert.assertFalse(connector.isPersistent()); }
From source file:org.openspaces.itest.esb.mule.config.OpenSpacesQueueConnectorConfigTests.java
@Test public void testBatchSizeConfig() throws Exception { ApplicationContext context = muleContext.getRegistry() .lookupObject(SpringRegistry.SPRING_APPLICATION_CONTEXT); OpenSpacesQueueConnector connector = (OpenSpacesQueueConnector) context.getBean("queueConnector"); Assert.assertNotNull(connector);//from ww w .jav a2 s . c o m Assert.assertEquals(Integer.valueOf(10), connector.getBatchSize()); }
From source file:com.cloud.agent.dao.impl.PropertiesStorageTest.java
@Test public void configureWithNotExistingFile() { String fileName = "target/notyetexistingfile" + System.currentTimeMillis(); File file = new File(fileName); PropertiesStorage storage = new PropertiesStorage(); HashMap<String, Object> params = new HashMap<String, Object>(); params.put("path", fileName); Assert.assertTrue(storage.configure("test", params)); Assert.assertTrue(file.exists());/*from w ww . j a v a 2s . co m*/ storage.persist("foo", "bar"); Assert.assertEquals("bar", storage.get("foo")); storage.stop(); file.delete(); }
From source file:com.dianping.maven.plugin.tools.misc.file.ProjectMetaGeneratorTest.java
@Test public void test() throws Exception { String expected = "<projects>\n" + " <project name=\"shoppic-service\">\n" + " <port>2000</port>\n" + " </project>\n" + " <project name=\"group-service\">\n" + " <port>2001</port>\n" + " </project>\n" + " <project name=\"account-service\">\n" + " <port>2002</port>\n" + " </project>\n" + " <project name=\"user-service\">\n" + " <port>2003</port>\n" + " </project>\n" + "</projects>"; ProjectMetaContext context = new ProjectMetaContext("org.h2.Driver", "jdbc:h2:mem:hawk;DB_CLOSE_DELAY=-1", "", ""); ProjectMetaGenerator smg = new ProjectMetaGenerator(); smg.generate(file, context);/* w w w .j a v a 2 s. c o m*/ Assert.assertEquals(expected, FileUtils.readFileToString(file)); }
From source file:org.atemsource.atem.impl.pojo.ScannedPojoRepositoryTest.java
@Test public void testTypes() { EntityType<EntityA> entityType = entityTypeRepository.getEntityType(EntityA.class); Assert.assertNotNull(entityType);/*from w ww.j ava 2 s . c om*/ Assert.assertNotNull(entityType.getSubEntityTypes(true)); Assert.assertEquals(1, entityType.getSubEntityTypes(true).size()); Assert.assertEquals(5, entityType.getDeclaredAttributes().size()); Assert.assertNotNull(entityType.getAttribute("list").getTargetType()); }
From source file:azkaban.crypto.EncryptionTest.java
@Test public void testInvalidParams() { ICrypto crypto = new Crypto(); String[] args = { "", null, "test" }; for (Version ver : Version.values()) { for (String plaintext : args) { for (String passphrase : args) { try { if (!StringUtils.isEmpty(plaintext) && !StringUtils.isEmpty(passphrase)) { String cipheredText = crypto.encrypt(plaintext, passphrase, ver); Assert.assertEquals(plaintext, crypto.decrypt(cipheredText, passphrase)); } else { crypto.encrypt(plaintext, passphrase, ver); Assert.fail("Encyption should have failed with invalid parameters. plaintext: " + plaintext + " , passphrase: " + passphrase); }// w w w.ja va 2s . c o m } catch (Exception e) { Assert.assertTrue(e instanceof IllegalArgumentException); } } } } }
From source file:fr.xebia.springframework.jdbc.ManagedBasicDataSourceTest.java
@Test public void testDataSource() throws Exception { ManagedBasicDataSource managedBasicDataSource = (ManagedBasicDataSource) dataSource; Assert.assertEquals("jdbc:h2:mem:dbcp-test", managedBasicDataSource.getUrl()); Assert.assertEquals("org.h2.Driver", managedBasicDataSource.getDriverClassName()); Assert.assertEquals("sa", managedBasicDataSource.getUsername()); Assert.assertEquals(10, managedBasicDataSource.getMaxActive()); Assert.assertEquals(1, managedBasicDataSource.getMinIdle()); Assert.assertEquals(Connection.TRANSACTION_SERIALIZABLE, managedBasicDataSource.getDefaultTransactionIsolation()); }
From source file:org.openxdata.server.service.impl.RoleServiceTest.java
@Test public void getRoles_shouldReturnAllRoles() throws Exception { List<Role> roles = roleService.getRoles(); Assert.assertNotNull(roles);/*from w w w . j a v a 2 s . com*/ Assert.assertEquals(2, roles.size()); Assert.assertEquals("Role_Administrator", roles.get(0).getName()); }
From source file:com.couchbase.capi.TestCouchbase.java
public void testPools() throws Exception { HttpClient client = getClient();// ww w. j a va 2 s . com HttpUriRequest request = new HttpGet(String.format("http://localhost:%d/pools", port)); HttpResponse response = client.execute(request); Assert.assertEquals(200, response.getStatusLine().getStatusCode()); HttpEntity entity = response.getEntity(); Map<String, List<Map<String, Object>>> details = null; if (entity != null) { InputStream input = entity.getContent(); try { details = mapper.readValue(input, Map.class); } finally { input.close(); } } Assert.assertTrue(details.containsKey("pools")); Assert.assertEquals(1, details.get("pools").size()); Assert.assertEquals("default", details.get("pools").get(0).get("name")); Assert.assertEquals("/pools/default?uuid=00000000000000000000000000000000", details.get("pools").get(0).get("uri")); client.getConnectionManager().shutdown(); }