当前位置: 首页>>代码示例>>Java>>正文


Java Sample.set方法代码示例

本文整理汇总了Java中org.jrobin.core.Sample.set方法的典型用法代码示例。如果您正苦于以下问题:Java Sample.set方法的具体用法?Java Sample.set怎么用?Java Sample.set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jrobin.core.Sample的用法示例。


在下文中一共展示了Sample.set方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testSampleSetFloatingPointValueWithComma

import org.jrobin.core.Sample; //导入方法依赖的package包/类
/**
 * This test fails because of
 * <a href="http://bugzilla.opennms.org/show_bug.cgi?id=2272">bug #2272</a>
 * in org.jrobin.core.Sample.
 */
@Test
@Ignore("fails due to bug 2272")
public void testSampleSetFloatingPointValueWithComma() throws Exception {
    File rrdFile = createRrdFile();
    
    RrdDb openedFile = m_strategy.openFile(rrdFile.getAbsolutePath());
    
    Sample sample = openedFile.createSample();
    sample.set("N:1,234");
    m_strategy.closeFile(openedFile);
    
    double[] values = sample.getValues();
    assertEquals("values list size", 1, values.length);
    assertEquals("values item 0", 1.234, values[0], 0.0);
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:21,代码来源:JRobinRrdStrategyTest.java

示例2: testSampleSetFloatingPointValueWithExtraJunk

import org.jrobin.core.Sample; //导入方法依赖的package包/类
/**
 * This test fails because of
 * <a href="http://bugzilla.opennms.org/show_bug.cgi?id=2272">bug #2272</a>
 * in org.jrobin.core.Sample.
 */
@Test
@Ignore("fails due to bug 2272")
public void testSampleSetFloatingPointValueWithExtraJunk() throws Exception {
    File rrdFile = createRrdFile();
    
    RrdDb openedFile = m_strategy.openFile(rrdFile.getAbsolutePath());
    
    Sample sample = openedFile.createSample();
    
    ThrowableAnticipator ta = new ThrowableAnticipator();
    ta.anticipate(new Exception("Some exception that complains about bogus data"));
    try {
        sample.set("N:1.234 extra junk");
    } catch (Throwable t) {
        ta.throwableReceived(t);
    } finally {
        m_strategy.closeFile(openedFile);
    }
    ta.verifyAnticipated();
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:26,代码来源:JRobinRrdStrategyTest.java

示例3: testCreate

import org.jrobin.core.Sample; //导入方法依赖的package包/类
@Test
public void testCreate() throws Exception {
    File rrdFile = createRrdFile();
    
    RrdDb openedFile = m_strategy.openFile(rrdFile.getAbsolutePath());
    //m_strategy.updateFile(openedFile, "huh?", "N:1,234234");
    
    Sample sample = ((RrdDb) openedFile).createSample();
    sample.set("N:1.234 something not that politically incorrect");
    System.err.println(sample.dump());

    m_strategy.closeFile(openedFile);
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:14,代码来源:JRobinRrdStrategyTest.java

示例4: testSampleSetFloatingPointValueGood

import org.jrobin.core.Sample; //导入方法依赖的package包/类
@Test
public void testSampleSetFloatingPointValueGood() throws Exception {
    File rrdFile = createRrdFile();
    
    RrdDb openedFile = m_strategy.openFile(rrdFile.getAbsolutePath());
    
    Sample sample = openedFile.createSample();
    sample.set("N:1.234");
    m_strategy.closeFile(openedFile);
    
    double[] values = sample.getValues();
    assertEquals("values list size", 1, values.length);
    assertEquals("values item 0", 1.234, values[0], 0.0);
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:15,代码来源:JRobinRrdStrategyTest.java


注:本文中的org.jrobin.core.Sample.set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。