public void testCustomTypeAndItsInstance() { Cache cache = initWorkingSpace(); Type vehicle = cache.addType("Vehicle"); Attribute equipment = vehicle.setAttribute("Equipment"); Generic myVehicle = vehicle.addInstance("myVehicle"); myVehicle.setValue(equipment, "ABS"); closingWorkingSpace(cache); }
private void readByComposites(Generic persistedNode, Generic readNode) { int indexComposites = 0; assert (persistedNode.getComposites().size() == readNode.getComposites().size()); for (Generic persistedGeneric : persistedNode.getComposites()) { compareGeneric(persistedGeneric, readNode.getComposites().get(indexComposites)); readByComposites(persistedGeneric, readNode.getComposites().get(indexComposites)); indexComposites++; } }
public void testLink() { Cache cache = initWorkingSpace(); Type vehicle = cache.addType("Vehicle"); Type color = cache.addType("Color"); Relation vehicleColor = vehicle.setRelation("VehicleColor", color); Generic myVehicle = vehicle.addInstance("myVehicle"); Generic red = color.addInstance("red"); myVehicle.setLink(vehicleColor, "myVehicleRed", red); closingWorkingSpace(cache); }
private static void compareGeneric(Generic persistedGeneric, Generic readGeneric) { assert ((GenericImpl) persistedGeneric).getBirthTs() == ((GenericImpl) readGeneric).getBirthTs() : "BirthTs : " + ((GenericImpl) persistedGeneric).getBirthTs() + " / " + ((GenericImpl) readGeneric).getBirthTs(); assert ((GenericImpl) persistedGeneric).getDeathTs() == ((GenericImpl) readGeneric).getDeathTs() : "DeathTs : " + ((GenericImpl) persistedGeneric).getDeathTs() + " / " + ((GenericImpl) readGeneric).getDeathTs(); assert ((GenericImpl) persistedGeneric).getDesignTs() == ((GenericImpl) readGeneric).getDesignTs() : "DesignTs : " + ((GenericImpl) persistedGeneric).getDesignTs() + " / " + ((GenericImpl) readGeneric).getDesignTs(); assert (persistedGeneric.getMetaLevel() == readGeneric.getMetaLevel()); assert (persistedGeneric.getValue().equals(readGeneric.getValue())); }
private void readByInheritings(Generic persistedNode, Generic readNode) { int indexInherintings = 0; assert (persistedNode.getInheritings().size() == readNode.getInheritings().size()) : persistedNode.getInheritings() + " / " + readNode.getInheritings(); for (Generic persistedGeneric : persistedNode.getInheritings()) { compareGeneric(persistedGeneric, readNode.getInheritings().get(indexInherintings)); readByInheritings(persistedGeneric, readNode.getInheritings().get(indexInherintings)); indexInherintings++; } }