Testing docFieldLongs

(redrubia) #1

I have a function, in which I call docFieldLongs. In unit testing I need to
create and override this function and also return ScriptDocValues.Longs.

public void testRunAsLongs throws Exception()
    script = new MaxiScoreScript(params){
        protected ScriptDocValues.Longs docFieldLongs(String getter){
            IndexWriter writer = new IndexWriter(new RAMDirectory(), 

new IndexWriterConfig(Lucene.VERSION, new
Document d = new Document();
d.add(new LongField("value", 102, Field.Store.NO));
d.add(new LongField("value" ,101, Field.Store.NO));

            IndexNumericFieldData indexFieldData = 

AtomicNumericFieldData fieldData =

            AtomicNumericFieldData temp = fieldData;

            // return (ScriptDocValues.Longs) temp.getScriptValues();



The main aim of this is to get the same type returned. However I am having
a few issues with this, with regards to refreshReader. I also feel this is
a very long winded way of doing things.

In summary, I simply want to override docFiledLongs, to return ScriptDocValues.Longs which I have defined. In my function, I call

I want this statement when tested to return a List items, being

Any help would be greatly appreciated.


You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/c3642fc6-57cf-496e-813f-a2b761b1b25f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

(system) #2