Java Code Examples for com.sun.jmx.examples.scandir.config.XmlConfigUtils#write()

The following examples show how to use com.sun.jmx.examples.scandir.config.XmlConfigUtils#write() . 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: ScanDirConfigTest.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Test of load method, of class com.sun.jmx.examples.scandir.ScanDirConfig.
 */
public void testLoad() throws Exception {
    System.out.println("load");

    final File file = File.createTempFile("testconf",".xml");
    final ScanDirConfig instance = new ScanDirConfig(file.getAbsolutePath());
    final ScanManagerConfig bean =
            new  ScanManagerConfig("testLoad");
    final DirectoryScannerConfig dir =
            new DirectoryScannerConfig("tmp");
    dir.setRootDirectory(file.getParent());
    bean.putScan(dir);
    XmlConfigUtils.write(bean,new FileOutputStream(file),false);
    instance.load();

    assertEquals(bean,instance.getConfiguration());
    bean.removeScan(dir.getName());
    XmlConfigUtils.write(bean,new FileOutputStream(file),false);

    assertNotSame(bean,instance.getConfiguration());

    instance.load();

    assertEquals(bean,instance.getConfiguration());

}
 
Example 2
Source File: ScanDirConfigTest.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Test of load method, of class com.sun.jmx.examples.scandir.ScanDirConfig.
 */
public void testLoad() throws Exception {
    System.out.println("load");

    final File file = File.createTempFile("testconf",".xml");
    final ScanDirConfig instance = new ScanDirConfig(file.getAbsolutePath());
    final ScanManagerConfig bean =
            new  ScanManagerConfig("testLoad");
    final DirectoryScannerConfig dir =
            new DirectoryScannerConfig("tmp");
    dir.setRootDirectory(file.getParent());
    bean.putScan(dir);
    XmlConfigUtils.write(bean,new FileOutputStream(file),false);
    instance.load();

    assertEquals(bean,instance.getConfiguration());
    bean.removeScan(dir.getName());
    XmlConfigUtils.write(bean,new FileOutputStream(file),false);

    assertNotSame(bean,instance.getConfiguration());

    instance.load();

    assertEquals(bean,instance.getConfiguration());

}
 
Example 3
Source File: ScanDirConfigTest.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Test of load method, of class com.sun.jmx.examples.scandir.ScanDirConfig.
 */
public void testLoad() throws Exception {
    System.out.println("load");

    final File file = File.createTempFile("testconf",".xml");
    final ScanDirConfig instance = new ScanDirConfig(file.getAbsolutePath());
    final ScanManagerConfig bean =
            new  ScanManagerConfig("testLoad");
    final DirectoryScannerConfig dir =
            new DirectoryScannerConfig("tmp");
    dir.setRootDirectory(file.getParent());
    bean.putScan(dir);
    XmlConfigUtils.write(bean,new FileOutputStream(file),false);
    instance.load();

    assertEquals(bean,instance.getConfiguration());
    bean.removeScan(dir.getName());
    XmlConfigUtils.write(bean,new FileOutputStream(file),false);

    assertNotSame(bean,instance.getConfiguration());

    instance.load();

    assertEquals(bean,instance.getConfiguration());

}
 
Example 4
Source File: ScanDirConfigTest.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Test of load method, of class com.sun.jmx.examples.scandir.ScanDirConfig.
 */
public void testLoad() throws Exception {
    System.out.println("load");

    final File file = File.createTempFile("testconf",".xml");
    final ScanDirConfig instance = new ScanDirConfig(file.getAbsolutePath());
    final ScanManagerConfig bean =
            new  ScanManagerConfig("testLoad");
    final DirectoryScannerConfig dir =
            new DirectoryScannerConfig("tmp");
    dir.setRootDirectory(file.getParent());
    bean.putScan(dir);
    XmlConfigUtils.write(bean,new FileOutputStream(file),false);
    instance.load();

    assertEquals(bean,instance.getConfiguration());
    bean.removeScan(dir.getName());
    XmlConfigUtils.write(bean,new FileOutputStream(file),false);

    assertNotSame(bean,instance.getConfiguration());

    instance.load();

    assertEquals(bean,instance.getConfiguration());

}
 
Example 5
Source File: ScanDirConfigTest.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Test of load method, of class com.sun.jmx.examples.scandir.ScanDirConfig.
 */
public void testLoad() throws Exception {
    System.out.println("load");

    final File file = File.createTempFile("testconf",".xml");
    final ScanDirConfig instance = new ScanDirConfig(file.getAbsolutePath());
    final ScanManagerConfig bean =
            new  ScanManagerConfig("testLoad");
    final DirectoryScannerConfig dir =
            new DirectoryScannerConfig("tmp");
    dir.setRootDirectory(file.getParent());
    bean.putScan(dir);
    XmlConfigUtils.write(bean,new FileOutputStream(file),false);
    instance.load();

    assertEquals(bean,instance.getConfiguration());
    bean.removeScan(dir.getName());
    XmlConfigUtils.write(bean,new FileOutputStream(file),false);

    assertNotSame(bean,instance.getConfiguration());

    instance.load();

    assertEquals(bean,instance.getConfiguration());

}
 
Example 6
Source File: ScanDirConfigTest.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Test of load method, of class com.sun.jmx.examples.scandir.ScanDirConfig.
 */
public void testLoad() throws Exception {
    System.out.println("load");

    final File file = File.createTempFile("testconf",".xml");
    final ScanDirConfig instance = new ScanDirConfig(file.getAbsolutePath());
    final ScanManagerConfig bean =
            new  ScanManagerConfig("testLoad");
    final DirectoryScannerConfig dir =
            new DirectoryScannerConfig("tmp");
    dir.setRootDirectory(file.getParent());
    bean.putScan(dir);
    XmlConfigUtils.write(bean,new FileOutputStream(file),false);
    instance.load();

    assertEquals(bean,instance.getConfiguration());
    bean.removeScan(dir.getName());
    XmlConfigUtils.write(bean,new FileOutputStream(file),false);

    assertNotSame(bean,instance.getConfiguration());

    instance.load();

    assertEquals(bean,instance.getConfiguration());

}
 
Example 7
Source File: ScanDirConfigTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Test of load method, of class com.sun.jmx.examples.scandir.ScanDirConfig.
 */
public void testLoad() throws Exception {
    System.out.println("load");

    final File file = File.createTempFile("testconf",".xml");
    final ScanDirConfig instance = new ScanDirConfig(file.getAbsolutePath());
    final ScanManagerConfig bean =
            new  ScanManagerConfig("testLoad");
    final DirectoryScannerConfig dir =
            new DirectoryScannerConfig("tmp");
    dir.setRootDirectory(file.getParent());
    bean.putScan(dir);
    XmlConfigUtils.write(bean,new FileOutputStream(file),false);
    instance.load();

    assertEquals(bean,instance.getConfiguration());
    bean.removeScan(dir.getName());
    XmlConfigUtils.write(bean,new FileOutputStream(file),false);

    assertNotSame(bean,instance.getConfiguration());

    instance.load();

    assertEquals(bean,instance.getConfiguration());

}
 
Example 8
Source File: ScanDirConfigTest.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Test of load method, of class com.sun.jmx.examples.scandir.ScanDirConfig.
 */
public void testLoad() throws Exception {
    System.out.println("load");

    final File file = File.createTempFile("testconf",".xml");
    final ScanDirConfig instance = new ScanDirConfig(file.getAbsolutePath());
    final ScanManagerConfig bean =
            new  ScanManagerConfig("testLoad");
    final DirectoryScannerConfig dir =
            new DirectoryScannerConfig("tmp");
    dir.setRootDirectory(file.getParent());
    bean.putScan(dir);
    XmlConfigUtils.write(bean,new FileOutputStream(file),false);
    instance.load();

    assertEquals(bean,instance.getConfiguration());
    bean.removeScan(dir.getName());
    XmlConfigUtils.write(bean,new FileOutputStream(file),false);

    assertNotSame(bean,instance.getConfiguration());

    instance.load();

    assertEquals(bean,instance.getConfiguration());

}
 
Example 9
Source File: ScanDirConfigTest.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Test of load method, of class com.sun.jmx.examples.scandir.ScanDirConfig.
 */
public void testLoad() throws Exception {
    System.out.println("load");

    final File file = File.createTempFile("testconf",".xml");
    final ScanDirConfig instance = new ScanDirConfig(file.getAbsolutePath());
    final ScanManagerConfig bean =
            new  ScanManagerConfig("testLoad");
    final DirectoryScannerConfig dir =
            new DirectoryScannerConfig("tmp");
    dir.setRootDirectory(file.getParent());
    bean.putScan(dir);
    XmlConfigUtils.write(bean,new FileOutputStream(file),false);
    instance.load();

    assertEquals(bean,instance.getConfiguration());
    bean.removeScan(dir.getName());
    XmlConfigUtils.write(bean,new FileOutputStream(file),false);

    assertNotSame(bean,instance.getConfiguration());

    instance.load();

    assertEquals(bean,instance.getConfiguration());

}
 
Example 10
Source File: ScanDirConfigTest.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Test of load method, of class com.sun.jmx.examples.scandir.ScanDirConfig.
 */
public void testLoad() throws Exception {
    System.out.println("load");

    final File file = File.createTempFile("testconf",".xml");
    final ScanDirConfig instance = new ScanDirConfig(file.getAbsolutePath());
    final ScanManagerConfig bean =
            new  ScanManagerConfig("testLoad");
    final DirectoryScannerConfig dir =
            new DirectoryScannerConfig("tmp");
    dir.setRootDirectory(file.getParent());
    bean.putScan(dir);
    XmlConfigUtils.write(bean,new FileOutputStream(file),false);
    instance.load();

    assertEquals(bean,instance.getConfiguration());
    bean.removeScan(dir.getName());
    XmlConfigUtils.write(bean,new FileOutputStream(file),false);

    assertNotSame(bean,instance.getConfiguration());

    instance.load();

    assertEquals(bean,instance.getConfiguration());

}
 
Example 11
Source File: ResultLogManager.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private void logToFile(ResultRecord record) throws IOException {
    final String basename;
    final long   maxRecords;
    synchronized (this) {
        if (logFile == null) return;
        basename = getLogFileName(false);
        maxRecords = fileCapacity;
    }

    // Get the stream into which we should log.
    final OutputStream stream =
            checkLogFile(basename,maxRecords,false);

    // logging to file now disabled - too bad.
    if (stream == null) return;

    synchronized (this) {
        try {
            XmlConfigUtils.write(record,stream,true);
            stream.flush();
            // don't increment logCount if we were not logging in logStream.
            if (stream == logStream) logCount++;
        } catch (JAXBException x) {
            final IllegalArgumentException iae =
                    new IllegalArgumentException("bad record",x);
            LOG.finest("Failed to log record: "+x);
            throw iae;
        }
    }
}
 
Example 12
Source File: ResultLogManager.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private void logToFile(ResultRecord record) throws IOException {
    final String basename;
    final long   maxRecords;
    synchronized (this) {
        if (logFile == null) return;
        basename = getLogFileName(false);
        maxRecords = fileCapacity;
    }

    // Get the stream into which we should log.
    final OutputStream stream =
            checkLogFile(basename,maxRecords,false);

    // logging to file now disabled - too bad.
    if (stream == null) return;

    synchronized (this) {
        try {
            XmlConfigUtils.write(record,stream,true);
            stream.flush();
            // don't increment logCount if we were not logging in logStream.
            if (stream == logStream) logCount++;
        } catch (JAXBException x) {
            final IllegalArgumentException iae =
                    new IllegalArgumentException("bad record",x);
            LOG.finest("Failed to log record: "+x);
            throw iae;
        }
    }
}
 
Example 13
Source File: ResultLogManager.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private void logToFile(ResultRecord record) throws IOException {
    final String basename;
    final long   maxRecords;
    synchronized (this) {
        if (logFile == null) return;
        basename = getLogFileName(false);
        maxRecords = fileCapacity;
    }

    // Get the stream into which we should log.
    final OutputStream stream =
            checkLogFile(basename,maxRecords,false);

    // logging to file now disabled - too bad.
    if (stream == null) return;

    synchronized (this) {
        try {
            XmlConfigUtils.write(record,stream,true);
            stream.flush();
            // don't increment logCount if we were not logging in logStream.
            if (stream == logStream) logCount++;
        } catch (JAXBException x) {
            final IllegalArgumentException iae =
                    new IllegalArgumentException("bad record",x);
            LOG.finest("Failed to log record: "+x);
            throw iae;
        }
    }
}
 
Example 14
Source File: ResultLogManager.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private void logToFile(ResultRecord record) throws IOException {
    final String basename;
    final long   maxRecords;
    synchronized (this) {
        if (logFile == null) return;
        basename = getLogFileName(false);
        maxRecords = fileCapacity;
    }

    // Get the stream into which we should log.
    final OutputStream stream =
            checkLogFile(basename,maxRecords,false);

    // logging to file now disabled - too bad.
    if (stream == null) return;

    synchronized (this) {
        try {
            XmlConfigUtils.write(record,stream,true);
            stream.flush();
            // don't increment logCount if we were not logging in logStream.
            if (stream == logStream) logCount++;
        } catch (JAXBException x) {
            final IllegalArgumentException iae =
                    new IllegalArgumentException("bad record",x);
            LOG.finest("Failed to log record: "+x);
            throw iae;
        }
    }
}
 
Example 15
Source File: ResultLogManager.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private void logToFile(ResultRecord record) throws IOException {
    final String basename;
    final long   maxRecords;
    synchronized (this) {
        if (logFile == null) return;
        basename = getLogFileName(false);
        maxRecords = fileCapacity;
    }

    // Get the stream into which we should log.
    final OutputStream stream =
            checkLogFile(basename,maxRecords,false);

    // logging to file now disabled - too bad.
    if (stream == null) return;

    synchronized (this) {
        try {
            XmlConfigUtils.write(record,stream,true);
            stream.flush();
            // don't increment logCount if we were not logging in logStream.
            if (stream == logStream) logCount++;
        } catch (JAXBException x) {
            final IllegalArgumentException iae =
                    new IllegalArgumentException("bad record",x);
            LOG.finest("Failed to log record: "+x);
            throw iae;
        }
    }
}
 
Example 16
Source File: ResultLogManager.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private void logToFile(ResultRecord record) throws IOException {
    final String basename;
    final long   maxRecords;
    synchronized (this) {
        if (logFile == null) return;
        basename = getLogFileName(false);
        maxRecords = fileCapacity;
    }

    // Get the stream into which we should log.
    final OutputStream stream =
            checkLogFile(basename,maxRecords,false);

    // logging to file now disabled - too bad.
    if (stream == null) return;

    synchronized (this) {
        try {
            XmlConfigUtils.write(record,stream,true);
            stream.flush();
            // don't increment logCount if we were not logging in logStream.
            if (stream == logStream) logCount++;
        } catch (JAXBException x) {
            final IllegalArgumentException iae =
                    new IllegalArgumentException("bad record",x);
            LOG.finest("Failed to log record: "+x);
            throw iae;
        }
    }
}
 
Example 17
Source File: ResultLogManager.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private void logToFile(ResultRecord record) throws IOException {
    final String basename;
    final long   maxRecords;
    synchronized (this) {
        if (logFile == null) return;
        basename = getLogFileName(false);
        maxRecords = fileCapacity;
    }

    // Get the stream into which we should log.
    final OutputStream stream =
            checkLogFile(basename,maxRecords,false);

    // logging to file now disabled - too bad.
    if (stream == null) return;

    synchronized (this) {
        try {
            XmlConfigUtils.write(record,stream,true);
            stream.flush();
            // don't increment logCount if we were not logging in logStream.
            if (stream == logStream) logCount++;
        } catch (JAXBException x) {
            final IllegalArgumentException iae =
                    new IllegalArgumentException("bad record",x);
            LOG.finest("Failed to log record: "+x);
            throw iae;
        }
    }
}
 
Example 18
Source File: ResultLogManager.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private void logToFile(ResultRecord record) throws IOException {
    final String basename;
    final long   maxRecords;
    synchronized (this) {
        if (logFile == null) return;
        basename = getLogFileName(false);
        maxRecords = fileCapacity;
    }

    // Get the stream into which we should log.
    final OutputStream stream =
            checkLogFile(basename,maxRecords,false);

    // logging to file now disabled - too bad.
    if (stream == null) return;

    synchronized (this) {
        try {
            XmlConfigUtils.write(record,stream,true);
            stream.flush();
            // don't increment logCount if we were not logging in logStream.
            if (stream == logStream) logCount++;
        } catch (JAXBException x) {
            final IllegalArgumentException iae =
                    new IllegalArgumentException("bad record",x);
            LOG.finest("Failed to log record: "+x);
            throw iae;
        }
    }
}
 
Example 19
Source File: ResultLogManager.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
private void logToFile(ResultRecord record) throws IOException {
    final String basename;
    final long   maxRecords;
    synchronized (this) {
        if (logFile == null) return;
        basename = getLogFileName(false);
        maxRecords = fileCapacity;
    }

    // Get the stream into which we should log.
    final OutputStream stream =
            checkLogFile(basename,maxRecords,false);

    // logging to file now disabled - too bad.
    if (stream == null) return;

    synchronized (this) {
        try {
            XmlConfigUtils.write(record,stream,true);
            stream.flush();
            // don't increment logCount if we were not logging in logStream.
            if (stream == logStream) logCount++;
        } catch (JAXBException x) {
            final IllegalArgumentException iae =
                    new IllegalArgumentException("bad record",x);
            LOG.finest("Failed to log record: "+x);
            throw iae;
        }
    }
}
 
Example 20
Source File: ResultLogManager.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
private void logToFile(ResultRecord record) throws IOException {
    final String basename;
    final long   maxRecords;
    synchronized (this) {
        if (logFile == null) return;
        basename = getLogFileName(false);
        maxRecords = fileCapacity;
    }

    // Get the stream into which we should log.
    final OutputStream stream =
            checkLogFile(basename,maxRecords,false);

    // logging to file now disabled - too bad.
    if (stream == null) return;

    synchronized (this) {
        try {
            XmlConfigUtils.write(record,stream,true);
            stream.flush();
            // don't increment logCount if we were not logging in logStream.
            if (stream == logStream) logCount++;
        } catch (JAXBException x) {
            final IllegalArgumentException iae =
                    new IllegalArgumentException("bad record",x);
            LOG.finest("Failed to log record: "+x);
            throw iae;
        }
    }
}