List of usage examples for org.apache.hadoop.io BooleanWritable set
public void set(boolean value)
From source file:org.apache.camel.component.hdfs.HdfsConsumerTest.java
License:Apache License
@Test public void testReadBoolean() throws Exception { if (!canTest()) { return;/* w w w .j a v a 2s.co m*/ } final Path file = new Path(new File("target/test/test-camel-boolean").getAbsolutePath()); Configuration conf = new Configuration(); FileSystem fs1 = FileSystem.get(file.toUri(), conf); SequenceFile.Writer writer = createWriter(fs1, conf, file, NullWritable.class, BooleanWritable.class); NullWritable keyWritable = NullWritable.get(); BooleanWritable valueWritable = new BooleanWritable(); valueWritable.set(true); writer.append(keyWritable, valueWritable); writer.sync(); writer.close(); context.addRoutes(new RouteBuilder() { public void configure() { from("hdfs:///" + file.toUri() + "?fileSystemType=LOCAL&fileType=SEQUENCE_FILE&initialDelay=0") .to("mock:result"); } }); context.start(); MockEndpoint resultEndpoint = context.getEndpoint("mock:result", MockEndpoint.class); resultEndpoint.expectedMessageCount(1); resultEndpoint.assertIsSatisfied(); }
From source file:org.apache.camel.component.hdfs2.HdfsConsumerTest.java
License:Apache License
@Test public void testReadBoolean() throws Exception { if (!canTest()) { return;/*from w ww . j a v a 2 s. co m*/ } final Path file = new Path(new File("target/test/test-camel-boolean").getAbsolutePath()); Configuration conf = new Configuration(); SequenceFile.Writer writer = createWriter(conf, file, NullWritable.class, BooleanWritable.class); NullWritable keyWritable = NullWritable.get(); BooleanWritable valueWritable = new BooleanWritable(); valueWritable.set(true); writer.append(keyWritable, valueWritable); writer.sync(); writer.close(); context.addRoutes(new RouteBuilder() { public void configure() { from("hdfs2:///" + file.toUri() + "?fileSystemType=LOCAL&fileType=SEQUENCE_FILE&initialDelay=0") .to("mock:result"); } }); context.start(); MockEndpoint resultEndpoint = context.getEndpoint("mock:result", MockEndpoint.class); resultEndpoint.expectedMessageCount(1); resultEndpoint.assertIsSatisfied(); }
From source file:org.apache.giraph.reducers.impl.AndReduce.java
License:Apache License
@Override public BooleanWritable reduce(BooleanWritable curValue, BooleanWritable valueToReduce) { curValue.set(curValue.get() && valueToReduce.get()); return curValue; }
From source file:org.apache.giraph.reducers.impl.OrReduce.java
License:Apache License
@Override public BooleanWritable reduce(BooleanWritable curValue, BooleanWritable valueToReduce) { curValue.set(curValue.get() || valueToReduce.get()); return curValue; }
From source file:org.apache.giraph.types.BooleanToBooleanWritableWrapper.java
License:Apache License
@Override public void wrap(Boolean javaValue, BooleanWritable writableValue) { writableValue.set(javaValue); }
From source file:org.apache.giraph.types.ops.BooleanTypeOps.java
License:Apache License
@Override public void set(BooleanWritable to, BooleanWritable from) { to.set(from.get()); }
From source file:org.apache.giraph.types.ops.collections.array.WBooleanArrayList.java
License:Apache License
@Override public void getIntoW(int index, BooleanWritable to) { to.set(getBoolean(index)); }
From source file:org.apache.giraph.types.ops.collections.array.WBooleanArrayList.java
License:Apache License
@Override public void popIntoW(BooleanWritable to) { to.set(popBoolean()); }
From source file:org.apache.metron.common.cli.ConfigurationManagerIntegrationTest.java
License:Apache License
@Test public void testPush() throws Exception { pushConfigs();// ww w. ja v a2s . c om final Set<String> sensorsInZookeeper = new HashSet<>(); final BooleanWritable foundGlobal = new BooleanWritable(false); ConfigurationsUtils.visitConfigs(client, new ConfigurationsUtils.ConfigurationVisitor() { @Override public void visit(ConfigurationType configurationType, String name, String data) { Assert.assertTrue(data.length() > 0); validateConfig(name, configurationType, data); if (configurationType == ConfigurationType.GLOBAL) { validateConfig(name, configurationType, data); foundGlobal.set(true); } else { sensorsInZookeeper.add(name); } } }); Assert.assertEquals(true, foundGlobal.get()); Assert.assertEquals(sensorsInZookeeper, sensors); }
From source file:org.apache.orc.mapred.OrcMapredRecordReader.java
License:Apache License
static BooleanWritable nextBoolean(ColumnVector vector, int row, Object previous) { if (vector.isRepeating) { row = 0;/* w ww . j av a 2 s . co m*/ } if (vector.noNulls || !vector.isNull[row]) { BooleanWritable result; if (previous == null || previous.getClass() != BooleanWritable.class) { result = new BooleanWritable(); } else { result = (BooleanWritable) previous; } result.set(((LongColumnVector) vector).vector[row] != 0); return result; } else { return null; } }