Java Code Examples for java.lang.System#getProperty()

The following examples show how to use java.lang.System#getProperty() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StreamZipEntriesTest.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void testStreamZip() throws IOException {
    try (ZipFile zf = new ZipFile(new File(System.getProperty("test.src", "."), "input.zip"))) {
        zf.stream().forEach(e -> assertTrue(e instanceof ZipEntry));
        zf.stream().forEach(e -> assertEquals(e.toString(), "ReadZip.java"));

        Object elements[] = zf.stream().toArray();
        assertEquals(1, elements.length);
        assertEquals(elements[0].toString(), "ReadZip.java");
    }
}
 
Example 2
Source File: StreamZipEntriesTest.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void testClosedJarFile() throws IOException {
    JarFile jf = new JarFile(new File(System.getProperty("test.src", "."), "input.jar"));
    jf.close();
    try {
        Stream s = jf.stream();
        fail("Should have thrown IllegalStateException");
    } catch (IllegalStateException e) {
        // expected;
    }
}
 
Example 3
Source File: StreamZipEntriesTest.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void testClosedZipFile() throws IOException {
    ZipFile zf = new ZipFile(new File(System.getProperty("test.src", "."), "input.zip"));
    zf.close();
    try {
        Stream s = zf.stream();
        fail("Should have thrown IllegalStateException");
    } catch (IllegalStateException e) {
        // expected;
    }
}
 
Example 4
Source File: StreamZipEntriesTest.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void testClosedZipFile() throws IOException {
    ZipFile zf = new ZipFile(new File(System.getProperty("test.src", "."), "input.zip"));
    zf.close();
    try {
        Stream s = zf.stream();
        fail("Should have thrown IllegalStateException");
    } catch (IllegalStateException e) {
        // expected;
    }
}
 
Example 5
Source File: StreamZipEntriesTest.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void testClosedJarFile() throws IOException {
    JarFile jf = new JarFile(new File(System.getProperty("test.src", "."), "input.jar"));
    jf.close();
    try {
        Stream s = jf.stream();
        fail("Should have thrown IllegalStateException");
    } catch (IllegalStateException e) {
        // expected;
    }
}
 
Example 6
Source File: StreamZipEntriesTest.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void testStreamJar() throws IOException {
    try (JarFile jf = new JarFile(new File(System.getProperty("test.src", "."), "input.jar"))) {
        jf.stream().forEach(e -> assertTrue(e instanceof JarEntry));

        Object elements[] = jf.stream().toArray();
        assertEquals(3, elements.length);
        assertEquals(elements[0].toString(), "META-INF/");
        assertEquals(elements[1].toString(), "META-INF/MANIFEST.MF");
        assertEquals(elements[2].toString(), "ReleaseInflater.java");
    }
}
 
Example 7
Source File: StreamZipEntriesTest.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void testStreamJar() throws IOException {
    try (JarFile jf = new JarFile(new File(System.getProperty("test.src", "."), "input.jar"))) {
        jf.stream().forEach(e -> assertTrue(e instanceof JarEntry));

        Object elements[] = jf.stream().toArray();
        assertEquals(3, elements.length);
        assertEquals(elements[0].toString(), "META-INF/");
        assertEquals(elements[1].toString(), "META-INF/MANIFEST.MF");
        assertEquals(elements[2].toString(), "ReleaseInflater.java");
    }
}
 
Example 8
Source File: StreamZipEntriesTest.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void testClosedZipFile() throws IOException {
    ZipFile zf = new ZipFile(new File(System.getProperty("test.src", "."), "input.zip"));
    zf.close();
    try {
        Stream s = zf.stream();
        fail("Should have thrown IllegalStateException");
    } catch (IllegalStateException e) {
        // expected;
    }
}
 
Example 9
Source File: StreamZipEntriesTest.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void testStreamJar() throws IOException {
    try (JarFile jf = new JarFile(new File(System.getProperty("test.src", "."), "input.jar"))) {
        jf.stream().forEach(e -> assertTrue(e instanceof JarEntry));

        Object elements[] = jf.stream().toArray();
        assertEquals(3, elements.length);
        assertEquals(elements[0].toString(), "META-INF/");
        assertEquals(elements[1].toString(), "META-INF/MANIFEST.MF");
        assertEquals(elements[2].toString(), "ReleaseInflater.java");
    }
}
 
Example 10
Source File: TestDynamicPolicy.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private String getUserName() {
    String usr = null;

    try {
        usr = System.getProperty("user.name");
    } catch (Exception e) {
    }
    return usr;
}
 
Example 11
Source File: StreamZipEntriesTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void testStreamZip() throws IOException {
    try (ZipFile zf = new ZipFile(new File(System.getProperty("test.src", "."), "input.zip"))) {
        zf.stream().forEach(e -> assertTrue(e instanceof ZipEntry));
        zf.stream().forEach(e -> assertEquals(e.toString(), "ReadZip.java"));

        Object elements[] = zf.stream().toArray();
        assertEquals(1, elements.length);
        assertEquals(elements[0].toString(), "ReadZip.java");
    }
}
 
Example 12
Source File: StreamZipEntriesTest.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void testClosedJarFile() throws IOException {
    JarFile jf = new JarFile(new File(System.getProperty("test.src", "."), "input.jar"));
    jf.close();
    try {
        Stream s = jf.stream();
        fail("Should have thrown IllegalStateException");
    } catch (IllegalStateException e) {
        // expected;
    }
}
 
Example 13
Source File: StreamZipEntriesTest.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void testClosedJarFile() throws IOException {
    JarFile jf = new JarFile(new File(System.getProperty("test.src", "."), "input.jar"));
    jf.close();
    try {
        Stream s = jf.stream();
        fail("Should have thrown IllegalStateException");
    } catch (IllegalStateException e) {
        // expected;
    }
}
 
Example 14
Source File: StreamZipEntriesTest.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void testStreamZip() throws IOException {
    try (ZipFile zf = new ZipFile(new File(System.getProperty("test.src", "."), "input.zip"))) {
        zf.stream().forEach(e -> assertTrue(e instanceof ZipEntry));
        zf.stream().forEach(e -> assertEquals(e.toString(), "ReadZip.java"));

        Object elements[] = zf.stream().toArray();
        assertEquals(1, elements.length);
        assertEquals(elements[0].toString(), "ReadZip.java");
    }
}
 
Example 15
Source File: StreamZipEntriesTest.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void testStreamZip() throws IOException {
    try (ZipFile zf = new ZipFile(new File(System.getProperty("test.src", "."), "input.zip"))) {
        zf.stream().forEach(e -> assertTrue(e instanceof ZipEntry));
        zf.stream().forEach(e -> assertEquals(e.toString(), "ReadZip.java"));

        Object elements[] = zf.stream().toArray();
        assertEquals(1, elements.length);
        assertEquals(elements[0].toString(), "ReadZip.java");
    }
}
 
Example 16
Source File: StreamZipEntriesTest.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void testClosedZipFile() throws IOException {
    ZipFile zf = new ZipFile(new File(System.getProperty("test.src", "."), "input.zip"));
    zf.close();
    try {
        Stream s = zf.stream();
        fail("Should have thrown IllegalStateException");
    } catch (IllegalStateException e) {
        // expected;
    }
}
 
Example 17
Source File: TestDynamicPolicy.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
private String getUserName() {
    String usr = null;

    try {
        usr = System.getProperty("user.name");
    } catch (Exception e) {
    }
    return usr;
}
 
Example 18
Source File: StreamZipEntriesTest.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void testClosedZipFile() throws IOException {
    ZipFile zf = new ZipFile(new File(System.getProperty("test.src", "."), "input.zip"));
    zf.close();
    try {
        Stream s = zf.stream();
        fail("Should have thrown IllegalStateException");
    } catch (IllegalStateException e) {
        // expected;
    }
}
 
Example 19
Source File: StreamZipEntriesTest.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void testClosedJarFile() throws IOException {
    JarFile jf = new JarFile(new File(System.getProperty("test.src", "."), "input.jar"));
    jf.close();
    try {
        Stream s = jf.stream();
        fail("Should have thrown IllegalStateException");
    } catch (IllegalStateException e) {
        // expected;
    }
}
 
Example 20
Source File: StreamZipEntriesTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void testClosedJarFile() throws IOException {
    JarFile jf = new JarFile(new File(System.getProperty("test.src", "."), "input.jar"));
    jf.close();
    try {
        Stream s = jf.stream();
        fail("Should have thrown IllegalStateException");
    } catch (IllegalStateException e) {
        // expected;
    }
}