Package net.sf.joafip.store.entity.conversion

Examples of net.sf.joafip.store.entity.conversion.ReplacementDefMap


    final String[] convertionDefArray = new String[] {
    /**/"0.0.0;a;;0.0.1;b;;",
    /**/"0.0.0;c;;0.0.1;d;;",
    /**/"0.0.1;b;;0.0.3;e;;",
    /**/"0.0.0;f;;0.0.3;g;;" };
    final ReplacementDefMap replacementDefMap =
    /**/new ReplacementDefMap();
    replacementDefSetSetup(replacementDefMap, convertionDefArray);
    final String[] result = new String[] {
    /**/"a;;e;",
    /**/"c;;d;",
    /**/"f;;g;" };
View Full Code Here


  public void test2() throws StoreException, FilePersistenceException,
      ConversionException, ClassInfoException, ClassNotFoundException {
    final String[] convertionDefArray = new String[] {
    /**/"0.0.0;a;;0.0.2;b;;aTob",
    /**/"0.0.2;b;;0.0.4;c;;" };
    final ReplacementDefMap replacementDefMap =
    /**/new ReplacementDefMap();
    replacementDefSetSetup(replacementDefMap, convertionDefArray);
    final ClassInfo classForA = classInfoFactory.getClassInfo("a");
    final Deque<ClassReplacementDef> replacementDef = replacementDefMap
        .replacementClassDef(version0, Version.releaseId("0.0.5"),
            classForA);
    assertNotNull("must have a definition", replacementDef);// NOPMD
    assertEquals("bad number of replacement def", 2, replacementDef.size());// NOPMD
    final Iterator<ClassReplacementDef> iterator = replacementDef
View Full Code Here

    final ConversionDefEntry conversionDefEntry = new ConversionDefEntry(
        classInfoForA, version0, version1);
    conversionDefEntry.addToFieldList(fieldInfo);

    final ReplacementDefMap replacementDefMap =
    /**/new ReplacementDefMap();
    replacementDefMap.add(conversionDefEntry);

    final Deque<ClassReplacementDef> replacementDef = replacementDefMap
        .replacementClassDef(version0, version1, classInfoForA);
    assertNotNull("must have a definition", replacementDef);

    assertEquals("bad number of replacement def", 1, replacementDef.size());
    final Iterator<ClassReplacementDef> iterator = replacementDef
View Full Code Here

   * @throws ClassInfoException
   */
  public void test4() throws StoreException, FilePersistenceException,
      ConversionException, ClassInfoException, ClassNotFoundException {

    final ReplacementDefMap replacementDefMap =
    /**/new ReplacementDefMap();

    final ClassInfo classInfoFor0 = classInfoFactory.getClassInfo("0");
    final ClassInfo classInfoFor1 = classInfoFactory.getClassInfo("1");

    ConversionDefEntry conversionDefEntry = new ConversionDefEntry(
        classInfoFor0, version0, classInfoFor1, version1,
        ClassInfo.NULL, ClassInfo.NULL);

    replacementDefMap.add(conversionDefEntry);

    final ClassInfo classInfoForA = classInfoFactory.getClassInfo("a");
    final FieldInfo fieldInfo = new FieldInfo(classInfoForA, VALUE,
        fieldType, false, false);

    conversionDefEntry = new ConversionDefEntry(classInfoForA, version0,
        version1);
    conversionDefEntry.addToFieldList(fieldInfo);

    replacementDefMap.add(conversionDefEntry);

    // check class "0"
    Deque<ClassReplacementDef> replacementDef = replacementDefMap
        .replacementClassDef(version0, version1, classInfoFor0);
    assertNotNull("must have a definition", replacementDef);
    assertEquals("bad number of replacement def", 1, replacementDef.size());
    Iterator<ClassReplacementDef> iterator = replacementDef.iterator();
    ClassReplacementDef classReplacementDef = iterator.next();
    assertEquals("bad original class", classInfoFor0,
        classReplacementDef.getOriginalClass());
    assertEquals("bad replacement class", classInfoFor1,
        classReplacementDef.getReplacementClass());
    assertTrue("must not have static replacement def", classReplacementDef
        .getStaticFieldConversionMap().isEmpty());
    assertTrue("must not have replacement def", classReplacementDef
        .getFieldConversionMap().isEmpty());

    // check class "a"
    replacementDef = replacementDefMap.replacementClassDef(version0,
        version1, classInfoForA);
    assertNotNull("must have a definition", replacementDef);

    assertEquals("bad number of replacement def", 1, replacementDef.size());
    iterator = replacementDef.iterator();
View Full Code Here

   * @throws ClassInfoException
   */
  public void test5() throws StoreException, FilePersistenceException,
      ConversionException, ClassInfoException, ClassNotFoundException {

    final ReplacementDefMap replacementDefMap =
    /**/new ReplacementDefMap();

    final ClassInfo classInfoForA = classInfoFactory.getClassInfo("a");
    final FieldInfo fieldInfo = new FieldInfo(
    /**/classInfoForA/* declaring class */,
    /**/VALUE,
    /**/fieldType,
    /**/false, false);
    ConversionDefEntry conversionDefEntry = new ConversionDefEntry(
        classInfoForA, version0, version1);
    conversionDefEntry.addToFieldList(fieldInfo);

    replacementDefMap.add(conversionDefEntry);

    final ClassInfo classInfoForB = classInfoFactory.getClassInfo("b");
    conversionDefEntry = new ConversionDefEntry(classInfoForA, version0,
        classInfoForB, version1, ClassInfo.NULL, ClassInfo.NULL);
    replacementDefMap.add(conversionDefEntry);

    final Deque<ClassReplacementDef> replacementDef = replacementDefMap
        .replacementClassDef(version0, version1, classInfoForA);
    assertNotNull("must have a definition", replacementDef);
    assertEquals("bad number of replacement def", 1, replacementDef.size());
    final Iterator<ClassReplacementDef> iterator = replacementDef
        .iterator();
View Full Code Here

        .getFieldType());
  }

  public void test6() throws ConversionException, FilePersistenceException,
      ClassInfoException, ClassNotFoundException {
    final ReplacementDefMap replacementDefMap =
    /**/new ReplacementDefMap();

    final ClassInfo classInfoForA = classInfoFactory.getClassInfo("a");
    final ClassInfo classInfoForB = classInfoFactory.getClassInfo("b");

    ConversionDefEntry conversionDefEntry = new ConversionDefEntry(
        classInfoForA, version0, classInfoForB, version1,
        ClassInfo.NULL, ClassInfo.NULL);
    replacementDefMap.add(conversionDefEntry);

    final FieldInfo fieldInfo = new FieldInfo(classInfoForA, VALUE,
        fieldType, false, false);
    conversionDefEntry = new ConversionDefEntry(classInfoForA, version0,
        version1);
    conversionDefEntry.addToFieldList(fieldInfo);
    replacementDefMap.add(conversionDefEntry);

    final Deque<ClassReplacementDef> replacementDef = replacementDefMap
        .replacementClassDef(version1, Version.releaseId("0.0.2"),
            classInfoForA);
    assertTrue("must not have replacement def", replacementDef.isEmpty());
  }
View Full Code Here

    final int previousJoafipRelesase = Version.releaseId("3.0.0");
    final int previousDataModelIdentifier = 1;
    final ClassInfo originalClass = classInfoFactory
        .getNoProxyClassInfo(PTreeSet.class);

    final ReplacementDefMap joafipReplacementDefMap = conversionManager
        .getJoafipReplacementDefMap();
    final Map<ClassInfo, NavigableMap<Integer, ConversionDefForClass>> replacementDefMap =
    /**/joafipReplacementDefMap.getConversionDefByClassAndIdMap();
    final NavigableMap<Integer, ConversionDefForClass> convDefs = replacementDefMap
        .get(originalClass);
    assertNotNull("mus have conversion definitions for class PTreeSet",
        convDefs);
    final ConversionDefForClass convDef = convDefs.get(0);
View Full Code Here

  private int currentStoreDataModelIdentifier;

  public ConversionManager(final ClassInfoFactory classInfoFactory) {
    super();
    this.classInfoFactory = classInfoFactory;
    joafipReplacementDefMap = new ReplacementDefMap();
    dataModelReplacementDefMap = new ReplacementDefMap();
  }
View Full Code Here

TOP

Related Classes of net.sf.joafip.store.entity.conversion.ReplacementDefMap

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.