本文整理汇总了Java中com.cedarsoftware.util.DeepEquals类的典型用法代码示例。如果您正苦于以下问题:Java DeepEquals类的具体用法?Java DeepEquals怎么用?Java DeepEquals使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DeepEquals类属于com.cedarsoftware.util包,在下文中一共展示了DeepEquals类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testUpdateAfterSetLeafNodeWorks
import com.cedarsoftware.util.DeepEquals; //导入依赖的package包/类
@Test
public void testUpdateAfterSetLeafNodeWorks() throws InterruptedException {
DatabaseReference ref = IntegrationTestUtils.getRandomNode(masterApp);
final Semaphore semaphore = new Semaphore(0);
final Map<String, Object> expected = new MapBuilder().put("a", 1L).put("b", 2L).build();
ref.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot snapshot) {
if (DeepEquals.deepEquals(snapshot.getValue(), expected)) {
semaphore.release();
}
}
@Override
public void onCancelled(DatabaseError error) {
}
});
ref.setValueAsync(42);
ref.updateChildrenAsync(expected);
TestHelpers.waitFor(semaphore);
}
开发者ID:firebase,项目名称:firebase-admin-java,代码行数:24,代码来源:DataTestIT.java
示例2: add
import com.cedarsoftware.util.DeepEquals; //导入依赖的package包/类
public void add(final Query query, final Object expected) {
count++;
ValueEventListener listener =
query.addValueEventListener(
new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot snapshot) {
Object result = snapshot.getValue();
// Hack to handle race condition in initial data
if (DeepEquals.deepEquals(expected, result)) {
// We may pass through intermediate states, but we should end up with
// the correct
// state
semaphore.release(1);
}
}
@Override
public void onCancelled(DatabaseError error) {
fail("Listen cancelled");
}
});
expectations.add(new QueryAndListener(query, listener));
}
开发者ID:firebase,项目名称:firebase-admin-java,代码行数:25,代码来源:ValueExpectationHelper.java
示例3: shouldDeserializeFromJSON
import com.cedarsoftware.util.DeepEquals; //导入依赖的package包/类
@Test
public void shouldDeserializeFromJSON() throws IOException {
/* Create the KeyValueProperty */
KeyValueValorisation kvp = new KeyValueValorisation("name", "value");
/* Create the iterable property */
IterableValorisation.IterableValorisationItem itemIterable2 = new IterableValorisation.IterableValorisationItem("blockOfProperties", Sets.newHashSet(new KeyValueValorisation("name3", "value")));
IterableValorisation iterableValorisation2 = new IterableValorisation("iterable2", Lists.newArrayList(itemIterable2));
IterableValorisation.IterableValorisationItem item = new IterableValorisation.IterableValorisationItem("blockOfProperties", Sets.newHashSet(new KeyValueValorisation("name2", "value"), iterableValorisation2));
IterableValorisation iterableValorisation = new IterableValorisation("iterable", Lists.newArrayList(item));
Properties valorisations = new Properties(Sets.newHashSet(kvp), Sets.newHashSet(iterableValorisation));
assertThat(DeepEquals.deepEquals(MAPPER.readValue(fixture("fixtures/business/properties.json"), Properties.class), valorisations)).isTrue();
}
开发者ID:voyages-sncf-technologies,项目名称:hesperides,代码行数:17,代码来源:PropertiesTest.java
示例4: shouldDeserializeFromJSON
import com.cedarsoftware.util.DeepEquals; //导入依赖的package包/类
@Test
public void shouldDeserializeFromJSON() throws IOException {
/* Create the KeyValueProperty */
KeyValuePropertyIndexation kvp = new KeyValuePropertyIndexation("name", "value", "some comment");
/* Create the iterable property */
PropertyIndexation propertyIndexation = new PropertyIndexation("name1", "comment1");
Set<PropertyIndexation> fields = Sets.newHashSet(propertyIndexation);
IterablePropertyIndexation.Valorisation field = new IterablePropertyIndexation.Valorisation("blockOfProperties", Sets.newHashSet(new KeyValuePropertyIndexation("name2", "value", "comment2")));
IterablePropertyIndexation ip = new IterablePropertyIndexation("iterable", "some comment", fields, Lists.newArrayList(field));
PropertiesIndexation hesperidesPropertiesIndexation = new PropertiesIndexation("properties.UNI.0.pltfm.unit", Sets.newHashSet(kvp), Sets.newHashSet(ip));
assertThat(DeepEquals.deepEquals(MAPPER.readValue(fixture("fixtures/indexation/properties.json"), PropertiesIndexation.class), hesperidesPropertiesIndexation)).isTrue();
}
开发者ID:voyages-sncf-technologies,项目名称:hesperides,代码行数:18,代码来源:PropertiesIndexationTest.java
示例5: compare
import com.cedarsoftware.util.DeepEquals; //导入依赖的package包/类
@AfterClass
public static void compare() {
System.out.println("USING SAMPLE #: " + SAMPLE_WEEK);
assertEquals(napiSamples.size(), simpleSamples.size());
if(doPrintout) {
System.out.println("\n--------------------------------");
for(Iterator<SampleWeek> it = simpleSamples.iterator(), it2 = napiSamples.iterator();it.hasNext() && it2.hasNext();) {
SampleWeek sw1 = it.next();
SampleWeek sw2 = it2.next();
System.out.println("Seq#: " + sw1.seqNum + " - " + sw2.seqNum);
System.out.println("Encoder: " + Arrays.toString(sw1.encoderOut) + " - " + Arrays.toString(sw2.encoderOut));
System.out.println("SP: " + Arrays.toString(sw1.spOut) + " - " + Arrays.toString(sw2.spOut));
System.out.println("TM (in): " + Arrays.toString(sw1.tmIn) + " - " + Arrays.toString(sw2.tmIn));
System.out.println("TM (pred. cols): " + Arrays.toString(sw1.tmPred) + " - " + Arrays.toString(sw2.tmPred));
System.out.println("TM (Active Cells): " + Arrays.toString(sw1.activeCells) + " - " + Arrays.toString(sw2.activeCells));
System.out.println("TM (Predictive Cells): " + Arrays.toString(sw1.predictiveCells) + " - " + Arrays.toString(sw2.predictiveCells));
System.out.println("Anomaly Score: " + sw1.score + " - " + sw2.score);
System.out.println("");
}
}
assertTrue(DeepEquals.deepEquals(simpleSamples, napiSamples));
}
开发者ID:numenta,项目名称:htm.java,代码行数:24,代码来源:NetworkConsistencyTest.java
示例6: testThreadedPublisher_TemporalMemoryNetwork
import com.cedarsoftware.util.DeepEquals; //导入依赖的package包/类
@Test
public void testThreadedPublisher_TemporalMemoryNetwork() {
Network network = createAndRunTestTemporalMemoryNetwork();
Layer<?> l = network.lookup("r1").lookup("1");
Connections cn = l.getConnections();
SerialConfig config = new SerialConfig("testThreadedPublisher_TemporalMemoryNetwork", SerialConfig.SERIAL_TEST_DIR);
PersistenceAPI api = Persistence.get(config);
byte[] bytes = api.write(cn);
Connections serializedConnections = api.read(bytes);
Network network2 = createAndRunTestTemporalMemoryNetwork();
Layer<?> l2 = network2.lookup("r1").lookup("1");
Connections newCons = l2.getConnections();
boolean b = DeepEquals.deepEquals(newCons, serializedConnections);
deepCompare(newCons, serializedConnections);
assertTrue(b);
}
开发者ID:numenta,项目名称:htm.java,代码行数:21,代码来源:PersistenceAPITest.java
示例7: testThreadedPublisher_SpatialPoolerNetwork
import com.cedarsoftware.util.DeepEquals; //导入依赖的package包/类
@Test
public void testThreadedPublisher_SpatialPoolerNetwork() {
Network network = createAndRunTestSpatialPoolerNetwork(0, 6);
Layer<?> l = network.lookup("r1").lookup("1");
Connections cn = l.getConnections();
SerialConfig config = new SerialConfig("testThreadedPublisher_SpatialPoolerNetwork", SerialConfig.SERIAL_TEST_DIR);
PersistenceAPI api = Persistence.get(config);
byte[] bytes = api.write(cn);
//Serialize above Connections for comparison with same run but unserialized below...
Connections serializedConnections = api.read(bytes);
Network network2 = createAndRunTestSpatialPoolerNetwork(0, 6);
Layer<?> l2 = network2.lookup("r1").lookup("1");
Connections newCons = l2.getConnections();
//Compare the two Connections (both serialized and regular runs) - should be equal
boolean b = DeepEquals.deepEquals(newCons, serializedConnections);
deepCompare(newCons, serializedConnections);
assertTrue(b);
}
开发者ID:numenta,项目名称:htm.java,代码行数:23,代码来源:PersistenceAPITest.java
示例8: testHTMSensor_DaysOfWeek
import com.cedarsoftware.util.DeepEquals; //导入依赖的package包/类
@Test
public void testHTMSensor_DaysOfWeek() {
Object[] n = { "some name", ResourceLocator.path("days-of-week.csv") };
HTMSensor<File> sensor = (HTMSensor<File>)Sensor.create(
FileSensor::create, SensorParams.create(Keys::path, n));
Parameters p = getParameters();
p = p.union(NetworkTestHarness.getDayDemoTestEncoderParams());
sensor.initEncoder(p);
SerialConfig config = new SerialConfig("testHTMSensor_DaysOfWeek", SerialConfig.SERIAL_TEST_DIR);
PersistenceAPI api = Persistence.get(config);
byte[] bytes = api.write(sensor);
HTMSensor<File> serializedSensor = api.read(bytes);
boolean b = DeepEquals.deepEquals(serializedSensor, sensor);
deepCompare(serializedSensor, sensor);
assertTrue(b);
}
开发者ID:numenta,项目名称:htm.java,代码行数:21,代码来源:PersistenceAPITest.java
示例9: testHTMSensor_HotGym
import com.cedarsoftware.util.DeepEquals; //导入依赖的package包/类
@Test
public void testHTMSensor_HotGym() {
Object[] n = { "some name", ResourceLocator.path("rec-center-hourly-small.csv") };
HTMSensor<File> sensor = (HTMSensor<File>)Sensor.create(
FileSensor::create, SensorParams.create(Keys::path, n));
sensor.initEncoder(getTestEncoderParams());
SerialConfig config = new SerialConfig("testHTMSensor_HotGym");
PersistenceAPI api = Persistence.get(config);
byte[] bytes = api.write(sensor);
assertNotNull(bytes);
assertTrue(bytes.length > 0);
HTMSensor<File> serializedSensor = api.read(bytes);
boolean b = DeepEquals.deepEquals(serializedSensor, sensor);
deepCompare(serializedSensor, sensor);
assertTrue(b);
}
开发者ID:numenta,项目名称:htm.java,代码行数:21,代码来源:PersistenceAPITest.java
示例10: testSerializeObservableSensor
import com.cedarsoftware.util.DeepEquals; //导入依赖的package包/类
@Test
public void testSerializeObservableSensor() {
PublisherSupplier supplier = PublisherSupplier.builder()
.addHeader("dayOfWeek")
.addHeader("darr")
.addHeader("B").build();
ObservableSensor<String[]> oSensor = new ObservableSensor<>(SensorParams.create(Keys::obs, new Object[] {"name", supplier}));
SerialConfig config = new SerialConfig("testSerializeObservableSensor", SerialConfig.SERIAL_TEST_DIR);
PersistenceAPI api = Persistence.get(config);
byte[] bytes = api.write(oSensor);
ObservableSensor<String[]> serializedOSensor = api.read(bytes);
boolean b = DeepEquals.deepEquals(serializedOSensor, oSensor);
deepCompare(serializedOSensor, oSensor);
assertTrue(b);
}
开发者ID:numenta,项目名称:htm.java,代码行数:20,代码来源:PersistenceAPITest.java
示例11: testSimpleCollections
import com.cedarsoftware.util.DeepEquals; //导入依赖的package包/类
@Test
public void testSimpleCollections() throws Exception {
HashMap obj = new HashMap();
ArrayList li = new ArrayList(); li.add("zero"); li.add(null); li.add("second");
obj.put("x", li);
obj.put("y", li);
obj.put("yy", null);
obj.put(null, "asd");
obj.put(3,"99999");
out.writeObject(obj);
final byte[] copyOfWrittenBuffer = out.getCopyOfWrittenBuffer();
in.resetForReuseUseArray(copyOfWrittenBuffer);
out.flush();
HashMap res = (HashMap) in.readObject();
assertTrue(res.get("x") == res.get("y"));
assertTrue(DeepEquals.deepEquals(obj,res));
}
开发者ID:RuedigerMoeller,项目名称:fast-serialization,代码行数:19,代码来源:BasicFSTTest.java
示例12: testEnums
import com.cedarsoftware.util.DeepEquals; //导入依赖的package包/类
@Test
public void testEnums() throws Exception {
Basics obj = new Basics(123);
out.writeObject(obj);
in.resetForReuseUseArray(out.getCopyOfWrittenBuffer());
out.flush();
Basics res = (Basics) in.readObject();
// note: fix false alarm with 1.7_71 + newer 1.8. (because stacktrace not serialized ofc)
Object[] exceptions1 = res.exceptions;
Object[] exceptions2 = obj.exceptions;
res.exceptions = obj.exceptions = null;
for (int i = 1; i < exceptions1.length; i++) {
assertTrue( exceptions1[i].getClass() == exceptions2[i].getClass() );
}
assertTrue(DeepEquals.deepEquals(obj, res));
}
开发者ID:RuedigerMoeller,项目名称:fast-serialization,代码行数:19,代码来源:BasicFSTTest.java
示例13: testFlush
import com.cedarsoftware.util.DeepEquals; //导入依赖的package包/类
@Test
public void testFlush() throws IOException, ClassNotFoundException {
ByteArrayOutputStream bout = new ByteArrayOutputStream(1000*1000);
FSTObjectOutput fout = new FSTObjectOutput(bout);
Strings obj = new Strings();
fout.writeObject(obj);
fout.writeObject(new byte[1000*1000*10]);
fout.writeObject(obj);
fout.close();
FSTObjectInput fin = new FSTObjectInput(new ByteArrayInputStream(bout.toByteArray()));
Strings res = (Strings) fin.readObject();
fin.readObject();
Strings res1 = (Strings) fin.readObject();
assertTrue(res == res1);
assertTrue(DeepEquals.deepEquals(obj,res));
}
开发者ID:RuedigerMoeller,项目名称:fast-serialization,代码行数:18,代码来源:BasicFSTTest.java
示例14: main
import com.cedarsoftware.util.DeepEquals; //导入依赖的package包/类
public static void main(String[] args) {
FSTObjectRegistry.POS_MAP_SIZE = 1;
FSTConfiguration conf = FSTConfiguration.createJsonNoRefConfiguration();
System.out.println(conf.asObject(conf.asByteArray("∂ √ ∞ ∑ ≈ ≠ ≡ ≤ ≥ ∆ ∏ ∩ ⌠ ⌡ │ ∫ Ω ⅓ ⅔ ⅛ ⅜ ⅝ ⅞ ♭ ♮ ♯ ♩ ♪ © ® ™")));
conf.registerCrossPlatformClassMappingUseSimpleName(
SampleClass.class,
Object[].class,
Object[][].class,
int[][].class,
int[][][].class
);
// Object p = new SimpleClass();
Object p = new SampleClass();
System.out.println(conf.asJsonString(p));
byte[] bytes = conf.asByteArray(p);
Object deser = conf.asObject(bytes);
System.out.println(DeepEquals.deepEquals(p,deser));
while( true )
sb(conf);
}
开发者ID:RuedigerMoeller,项目名称:fast-serialization,代码行数:25,代码来源:Play.java
示例15: carBenchIntern
import com.cedarsoftware.util.DeepEquals; //导入依赖的package包/类
public void carBenchIntern(boolean shared) throws Exception {
OnHeapCoder coder =new OnHeapCoder(shared,
Car.class, CarBench.Engine.class, CarBench.Model.class,
CarBench.Accel.class, CarBench.PerformanceFigures.class,
CarBench.FueldData.class, CarBench.OptionalExtras.class);
byte arr[] = new byte[10000];
System.out.println("-----");
Object car = setupSampleObject();
Object deser = null;
for (int i=0; i<10; i++) {
deser = onhbench(car, coder, arr, 0);
}
assertTrue(DeepEquals.deepEquals(car, deser));
}
开发者ID:RuedigerMoeller,项目名称:fast-serialization,代码行数:18,代码来源:CarBench.java
示例16: carBenchInternDefault
import com.cedarsoftware.util.DeepEquals; //导入依赖的package包/类
public void carBenchInternDefault(boolean shared) throws Exception {
DefaultCoder coder =new DefaultCoder(shared,
Car.class, CarBench.Engine.class, CarBench.Model.class,
CarBench.Accel.class, CarBench.PerformanceFigures.class,
CarBench.FueldData.class, CarBench.OptionalExtras.class);
byte arr[] = new byte[10000];
System.out.println("-----");
Object car = setupSampleObject();
Object deser = null;
for (int i=0; i<10; i++) {
deser = onhbench(car, coder, arr, 0);
}
assertTrue(DeepEquals.deepEquals(car, deser));
}
开发者ID:RuedigerMoeller,项目名称:fast-serialization,代码行数:18,代码来源:CarBench.java
示例17: carBenchInternMinBin
import com.cedarsoftware.util.DeepEquals; //导入依赖的package包/类
public void carBenchInternMinBin(boolean shared) throws Exception {
MinBinCoder coder =new MinBinCoder(shared,
Car.class, CarBench.Engine.class, CarBench.Model.class,
CarBench.Accel.class, CarBench.PerformanceFigures.class,
CarBench.FueldData.class, CarBench.OptionalExtras.class);
byte arr[] = new byte[10000];
System.out.println("-----");
Object car = setupSampleObject();
Object deser = null;
for (int i=0; i<10; i++) {
deser = onhbench(car, coder, arr, 0);
}
assertTrue(DeepEquals.deepEquals(car, deser));
}
开发者ID:RuedigerMoeller,项目名称:fast-serialization,代码行数:18,代码来源:CarBench.java
示例18: test
import com.cedarsoftware.util.DeepEquals; //导入依赖的package包/类
@Test
public void test() {
FSTConfiguration conf = FSTConfiguration.createUnsafeBinaryConfiguration();
Object deser = null;
byte[] ser = null;
System.out.println("binary");
deser = smallBench(conf, original, deser);
deser = smallBench(conf, original, deser);
assertTrue(DeepEquals.deepEquals(original, deser));
System.out.println("default");
conf = FSTConfiguration.createDefaultConfiguration();
deser = smallBench(conf, original, deser);
deser = smallBench(conf, original, deser);
assertTrue(DeepEquals.deepEquals(original, deser));
System.out.println("Default LEN:"+FSTConfiguration.createDefaultConfiguration().asByteArray(original).length);
}
开发者ID:RuedigerMoeller,项目名称:fast-serialization,代码行数:20,代码来源:RawMemTest.java
示例19: testHM
import com.cedarsoftware.util.DeepEquals; //导入依赖的package包/类
@Test
public void testHM() throws IOException, ClassNotFoundException {
FSTConfiguration conf = FSTConfiguration.createDefaultConfiguration();
HashMap hm = createHM();
HashMap hm1 = createHM1(hm);
FSTObjectOutput oo = conf.getObjectOutput();
oo.writeObject(hm);
oo.writeObject(hm1);
byte[] copyOfWrittenBuffer = oo.getCopyOfWrittenBuffer();
FSTObjectInput in = conf.getObjectInput(copyOfWrittenBuffer);
Object o1 = in.readObject();
Object o2 = in.readObject();
Assert.assertTrue(DeepEquals.deepEquals(o1,hm));
Assert.assertTrue(DeepEquals.deepEquals(o2,hm1));
}
开发者ID:RuedigerMoeller,项目名称:fast-serialization,代码行数:17,代码来源:BigObjTest.java
示例20: testWithStreams
import com.cedarsoftware.util.DeepEquals; //导入依赖的package包/类
@Test
public void testWithStreams() throws IOException, ClassNotFoundException {
HashMap hm = createHM();
HashMap hm1 = createHM1(hm);
FSTObjectOutput out = new FSTObjectOutput(new FileOutputStream("../epsis.oos"));
out.writeObject(hm);
out.writeObject(hm1);
out.close();
FSTObjectInput in = new FSTObjectInput(new FileInputStream("../epsis.oos"));
HashMap o1 = (HashMap) in.readObject();
HashMap o2 = (HashMap) in.readObject();
in.close();
Assert.assertTrue(DeepEquals.deepEquals(o1, hm));
Assert.assertTrue(DeepEquals.deepEquals(o2, hm1));
}
开发者ID:RuedigerMoeller,项目名称:fast-serialization,代码行数:18,代码来源:BigObjTest.java
注:本文中的com.cedarsoftware.util.DeepEquals类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论