Search in sources :

Example 1 with Ss0

use of com.yahoo.vespa.documentgen.test.Book.Ss0 in project vespa by vespa-engine.

the class DocumentGenPluginTest method newBookConcrete.

private Book newBookConcrete(int i) {
    Book book = new Book(new DocumentId("doc:book:" + i));
    book.setAuthor("Melville");
    Date date = new Date().setExacttime(99l);
    book.setTitleSpanTrees(new HashMap<String, SpanTree>());
    SpanTree t = new SpanTree().annotate(date);
    book.titleSpanTrees().put(t.getName(), t);
    book.setTitle("Moby Dick");
    book.setYear(1851);
    // .setAl1(myAs1));
    book.setMystruct(new Ss1().setSs01(new Ss0().setS0("My s0").setD0(99d)).setS1("My s1").setL1(89l));
    Map<Float, Integer> wsFloat = new HashMap<>();
    wsFloat.put(56f, 55);
    wsFloat.put(57f, 54);
    book.setMywsfloat(wsFloat);
    Array<IntegerFieldValue> intArr1 = new Array<>(DataType.getArray(DataType.INT));
    intArr1.add(new IntegerFieldValue(1));
    intArr1.add(new IntegerFieldValue(2));
    intArr1.add(new IntegerFieldValue(3));
    Array intArr1Arr = new Array(DataType.getArray(intArr1.getDataType()));
    intArr1Arr.add(intArr1);
    Array intArr1ArrArr = new Array(DataType.getArray(intArr1Arr.getDataType()));
    intArr1ArrArr.add(intArr1Arr);
    book.setMytriplearray(intArr1ArrArr);
    return book;
}
Also used : Date(com.yahoo.vespa.documentgen.test.annotation.Date) Ss1(com.yahoo.vespa.documentgen.test.Book.Ss1) Ss0(com.yahoo.vespa.documentgen.test.Book.Ss0) SpanTree(com.yahoo.document.annotation.SpanTree)

Example 2 with Ss0

use of com.yahoo.vespa.documentgen.test.Book.Ss0 in project vespa by vespa-engine.

the class DocumentGenPluginTest method getBook.

private Book getBook() {
    Book book = new Book(new DocumentId("doc:book:0"));
    book.setAuthor("Herman Melville");
    book.setTitle("Moby Dick - Or The Whale");
    book.setIsbn("234-33");
    book.setYear(1815).setDescription("A great novel about whaling.");
    Ss1 ss1 = new Book.Ss1();
    Ss0 ss0 = new Book.Ss0();
    ss0.setD0(-238472634.78);
    ss1.setS1("test s1").setI1(999).setD1(56.777).setSs01(ss0);
    book.setMystruct(ss1);
    List<Integer> myArrInt = new ArrayList<>();
    myArrInt.add(10);
    myArrInt.add(20);
    myArrInt.add(30);
    book.setMyarrayint(myArrInt);
    List<Integer> intL = new ArrayList<Integer>() {

        {
            add(1);
            add(2);
            add(3);
        }
    };
    List<Integer> intL2 = new ArrayList<Integer>() {

        {
            add(9);
            add(10);
            add(11);
        }
    };
    List<List<Integer>> doubleIntL = new ArrayList<>();
    doubleIntL.add(intL);
    doubleIntL.add(intL2);
    List<List<List<Integer>>> tripleIntL = new ArrayList<>();
    tripleIntL.add(doubleIntL);
    book.setMytriplearray(tripleIntL);
    Map<String, String> sMap = new HashMap<>();
    sMap.put("Melville", "Moby Dick");
    sMap.put("Bulgakov", "The Master and Margarita");
    sMap.put("Black Debbath", "Tung tung politisk rock");
    book.setStringmap(sMap);
    Map<Integer, Ss1> structMap = new HashMap<>();
    structMap.put(50, ss1);
    structMap.put(60, ss1);
    book.setStructmap(structMap);
    Map<Float, Integer> ws = new HashMap<>();
    ws.put(1.1f, 100);
    ws.put(2.2f, 200);
    ws.put(3.3f, 300);
    book.setMywsfloat(ws);
    Ss1 arrayedStruct1 = new Ss1().setS1("YEPS").setI1(789);
    Ss1 arrayedStruct2 = new Ss1().setS1("JA").setI1(456);
    List<Ss1> structArray = new ArrayList<>();
    structArray.add(arrayedStruct1);
    structArray.add(arrayedStruct2);
    book.setMysinglestructarray(structArray);
    book.setContent(ByteBuffer.allocate(3).put(new byte[] { 3, 4, 5 }));
    book.getContent().position(0);
    return book;
}
Also used : Ss1(com.yahoo.vespa.documentgen.test.Book.Ss1) Ss0(com.yahoo.vespa.documentgen.test.Book.Ss0)

Aggregations

Ss0 (com.yahoo.vespa.documentgen.test.Book.Ss0)2 Ss1 (com.yahoo.vespa.documentgen.test.Book.Ss1)2 SpanTree (com.yahoo.document.annotation.SpanTree)1 Date (com.yahoo.vespa.documentgen.test.annotation.Date)1