Search in sources :

Example 16 with StringBufferInputStream

use of java.io.StringBufferInputStream in project webtools.sourceediting by eclipse.

the class TestModelsFromFiles method addContentsAndCreateFile.

private void addContentsAndCreateFile(IFile file) throws CoreException {
    StringBufferInputStream stringStream = new StringBufferInputStream("testing testing testing");
    file.create(stringStream, false, null);
}
Also used : StringBufferInputStream(java.io.StringBufferInputStream)

Example 17 with StringBufferInputStream

use of java.io.StringBufferInputStream in project groovy-core by groovy.

the class DependencyTest method testTransitiveDep.

public void testTransitiveDep() {
    cu.addSource("testTransitiveDep.gtest", new StringBufferInputStream("class A1 {}\n" + "class A2 extends A1{}\n" + "class A3 extends A2{}\n"));
    cu.compile(Phases.CLASS_GENERATION);
    cache.makeTransitiveHull();
    Set<String> dep = cache.get("A1");
    assertEquals(dep.size(), 1);
    dep = cache.get("A2");
    assertEquals(dep.size(), 2);
    assertTrue(dep.contains("A1"));
    dep = cache.get("A3");
    assertEquals(dep.size(), 3);
    assertTrue(dep.contains("A1"));
    assertTrue(dep.contains("A2"));
}
Also used : StringBufferInputStream(java.io.StringBufferInputStream)

Example 18 with StringBufferInputStream

use of java.io.StringBufferInputStream in project cubrid-manager by CUBRID.

the class CUBRIDPreparedStatementProxyTest method methodSetUnicodeStream.

/**
	 * Test method for
	 * {@link com.cubrid.jdbc.proxy.driver.CUBRIDPreparedStatementProxy#setUnicodeStream(int, java.io.InputStream, int)}
	 * .
	 */
public void methodSetUnicodeStream(CUBRIDPreparedStatementProxy pstmt) {
    String sql = "select * from " + testTableName + " where url = ?";
    CUBRIDPreparedStatementProxy ps = null;
    try {
        ps = (CUBRIDPreparedStatementProxy) conn.prepareStatement(sql);
        ps.setUnicodeStream(30, new StringBufferInputStream("string buffer input stream"), 3);
    } catch (SQLException e) {
        assertTrue(false);
    } catch (UnsupportedOperationException e1) {
        assertTrue(true);
    } finally {
        if (ps != null)
            try {
                ps.close();
            } catch (SQLException e) {
            }
    }
}
Also used : StringBufferInputStream(java.io.StringBufferInputStream) SQLException(java.sql.SQLException)

Example 19 with StringBufferInputStream

use of java.io.StringBufferInputStream in project pentaho-platform by pentaho.

the class LocaleImportHandlerTest method shouldNotFailAndReturnNullWhenMaliciousXmlIsGiven.

@Test(timeout = 2000, expected = SAXException.class)
public void shouldNotFailAndReturnNullWhenMaliciousXmlIsGiven() throws IOException, ParserConfigurationException, SAXException {
    LocaleImportHandler lih = new LocaleImportHandler(Collections.emptyList(), null);
    lih.getLocalBundleDocument(new StringBufferInputStream(XmlTestConstants.MALICIOUS_XML));
    fail();
}
Also used : StringBufferInputStream(java.io.StringBufferInputStream) Test(org.junit.Test)

Example 20 with StringBufferInputStream

use of java.io.StringBufferInputStream in project pentaho-platform by pentaho.

the class KettleSystemListenerTest method shouldNotFailAndReturnNullWhenMaliciousXmlIsGiven.

@Test(timeout = 2000, expected = SAXException.class)
public void shouldNotFailAndReturnNullWhenMaliciousXmlIsGiven() throws IOException, ParserConfigurationException, SAXException {
    KettleSystemListener ksl = new KettleSystemListener();
    ksl.getSlaveServerConfigNode(new StringBufferInputStream(XmlTestConstants.MALICIOUS_XML));
    fail();
}
Also used : StringBufferInputStream(java.io.StringBufferInputStream) Test(org.junit.Test)

Aggregations

StringBufferInputStream (java.io.StringBufferInputStream)34 Test (org.junit.Test)10 InputStream (java.io.InputStream)9 SQLException (java.sql.SQLException)6 IModelManager (org.eclipse.wst.sse.core.internal.provisional.IModelManager)5 IStructuredModel (org.eclipse.wst.sse.core.internal.provisional.IStructuredModel)5 BadLocationException (org.eclipse.jface.text.BadLocationException)3 IStructuredDocument (org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument)3 InputStreamBuilder (io.vertigo.dynamo.file.model.InputStreamBuilder)2 VFile (io.vertigo.dynamo.file.model.VFile)2 ByteArrayInputStream (java.io.ByteArrayInputStream)2 IOException (java.io.IOException)2 Instant (java.time.Instant)2 Matchers.anyString (org.mockito.Matchers.anyString)2 KettleException (org.pentaho.di.core.exception.KettleException)2 RepositoryMeta (org.pentaho.di.repository.RepositoryMeta)2 Element (org.w3c.dom.Element)2 Table (com.mapr.db.Table)1 Description (io.qameta.allure.Description)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1