本文整理汇总了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);
}
示例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();
}
示例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);
}
示例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);
}