// for sync purposes, we select a different wallet than normally, ignoring
 // segregated mode setting.
 private Wallet getWallet() {
   final Record selectedRecord = recordManager.getSelectedRecord();
   if (selectedRecord.tag == Record.Tag.ARCHIVE) {
     return new Wallet(selectedRecord);
   } else {
     return new Wallet(recordManager.getRecords(Record.Tag.ACTIVE), selectedRecord);
   }
 }
Beispiel #2
0
 public Graph(WeightedBVGraph graph, String[] names) {
   org.apache.log4j.Logger logger =
       org.apache.log4j.Logger.getLogger("it.unimi.dsi.webgraph.ImmutableGraph");
   logger.setLevel(org.apache.log4j.Level.FATAL);
   if (names.length != graph.numNodes())
     throw new Error("Problem with the list of names for the nodes in the graph.");
   try {
     File auxFile = File.createTempFile("graph-maps-" + System.currentTimeMillis(), "aux");
     auxFile.deleteOnExit();
     RecordManager recMan = RecordManagerFactory.createRecordManager(auxFile.getAbsolutePath());
     nodes = recMan.hashMap("nodes");
     nodesReverse = recMan.hashMap("nodesReverse");
   } catch (IOException ex) {
     throw new Error(ex);
   }
   nodes.clear();
   nodesReverse.clear();
   Constructor[] cons = WeightedArc.class.getDeclaredConstructors();
   for (int i = 0; i < cons.length; i++) cons[i].setAccessible(true);
   this.graph = graph;
   WeightedArcSet list = new WeightedArcSet();
   ArcLabelledNodeIterator it = graph.nodeIterator();
   while (it.hasNext()) {
     if (commit++ % COMMIT_SIZE == 0) {
       commit();
       list.commit();
     }
     Integer aux1 = it.nextInt();
     Integer aux2 = null;
     ArcLabelledNodeIterator.LabelledArcIterator suc = it.successors();
     while ((aux2 = suc.nextInt()) != null && aux2 >= 0 && (aux2 < graph.numNodes()))
       try {
         WeightedArc arc = (WeightedArc) cons[0].newInstance(aux2, aux1, suc.label().getFloat());
         list.add(arc);
         this.nodes.put(aux1, names[aux1]);
         this.nodes.put(aux2, names[aux2]);
         this.nodesReverse.put(names[aux1], aux1);
         this.nodesReverse.put(names[aux2], aux2);
       } catch (Exception ex) {
         throw new Error(ex);
       }
   }
   reverse = new WeightedBVGraph(list.toArray(new WeightedArc[0]));
   numArcs = list.size();
   iterator = nodeIterator();
   try {
     File auxFile = File.createTempFile("graph" + System.currentTimeMillis(), "aux");
     auxFile.deleteOnExit();
     String basename = auxFile.getAbsolutePath();
     store(basename);
   } catch (IOException ex) {
     throw new Error(ex);
   }
   commit();
 }
Beispiel #3
0
 private static String recursiveToString(long r, String prefix, RecordManager recman) {
   prefix += "  ";
   String s = "";
   long[][] nn = recman.recordGet(r, HTreeMap.DIR_SERIALIZER);
   if (nn == null) {
     s += prefix + "null,\n";
   } else {
     s += prefix + "Arrays.asList(\n";
     for (long[] n : nn) {
       if (n == null) {
         s += prefix + "  null,\n";
       } else {
         s += prefix + "  Arrays.asList(\n";
         for (long r2 : n) {
           if (r2 == 0) {
             s += prefix + "    " + "null,\n";
           } else {
             if ((r2 & 1) == 0) {
               s += recursiveToString(r2 >>> 1, prefix + "    ", recman);
             } else {
               s += prefix + "    " + "Array.asList(";
               TreeMap m = new TreeMap();
               HTreeMap.LinkedNode node =
                   (HTreeMap.LinkedNode)
                       recman.recordGet(r2 >>> 1, new HTreeMap(recman, true).LN_SERIALIZER);
               while (node != null) {
                 m.put(node.key, node.value);
                 node =
                     (HTreeMap.LinkedNode)
                         recman.recordGet(node.next, new HTreeMap(recman, true).LN_SERIALIZER);
               }
               for (Object k : m.keySet()) {
                 s += k + "," + m.get(k) + ",";
               }
               // s=s.substring(0,s.length()-1);
               s += "),\n";
             }
           }
         }
         s += prefix + "  ),\n";
       }
     }
     //            s=s.substring(0,s.length()-2);
     s += prefix + "),\n";
   }
   return s;
 }
Beispiel #4
0
  private static void backup(final Activity parent) {

    // Get a list of all records
    RecordManager recordManager = MbwManager.getInstance(parent).getRecordManager();
    List<Record> records = new LinkedList<Record>();
    records.addAll(recordManager.getRecords(Tag.ACTIVE));
    records.addAll(recordManager.getRecords(Tag.ARCHIVE));

    if (records.size() == 1 && records.get(0).hasPrivateKey()) {
      // If there is only one record, and it has a private key we let the
      // user choose which backup method to use
      backupSingleRecord(parent, records.get(0));
    } else {
      // Otherwise we automatically launch encrypted PDF backup
      backupAllRecords(parent);
    }
  }
Beispiel #5
0
 public void releaseRecord() throws RecordUnlockedException {
   checkIsActiveRecordLocked();
   SessionState sessionState = getSessionState();
   CollectRecord activeRecord = sessionState.getActiveRecord();
   if (activeRecord != null && activeRecord.getId() != null) {
     recordManager.releaseLock(activeRecord.getId());
   }
   sessionState.setActiveRecord(null);
 }
    @Override
    protected void setRootAsync(Object value, FutureWithCallback<Void> future) {
        if (value instanceof UserTObject && ((UserTObject) value).getTrunk().getStore() != BinaryStore.this)
            future.setException(new RuntimeException(Strings.WRONG_STORE));
        else {
            byte[] data = writeObject(value);
            long id = _jdbm.getRoot(ROOT);

            if (id != 0)
                _jdbm.update(id, data);
            else {
                id = _jdbm.insert(data);
                _jdbm.setRoot(ROOT, id);
            }

            future.set(null);
        }
    }
    @Override
    protected void getRootAsync(FutureWithCallback<Object> future) {
        long rootId = _jdbm.getRoot(ROOT);
        byte[] data = null;

        if (rootId == 0)
            future.set(null);
        else {
            data = _jdbm.fetch(rootId);

            if (data == null)
                throw new RuntimeIOException(Strings.CORRUPTED_STORE);

            Object root = _reader.read(data);

            _reader.readVersions();
            _reader.importVersions();
            future.set(root);
        }
    }
    public final void start() {
        onStarting();

        long sessionsId = _jdbm.getRoot(SESSIONS);

        if (sessionsId != 0) {
            _sessions = BTree.load(_jdbm, sessionsId, true);

            if (_sessions == null)
                throw new RuntimeIOException(Strings.CORRUPTED_STORE);
        } else {
            _sessions = new BTree(_jdbm, true);
            _jdbm.setRoot(SESSIONS, _sessions.getId());
        }

        if (Debug.THREADS) {
            ThreadAssert.exchangeGive(this, _sessions);
            ThreadAssert.exchangeGiveList(this, _reader.getThreadContextObjects());
            ThreadAssert.exchangeGiveList(this, _writer.getThreadContextObjects());
            ThreadAssert.exchangeGive(this, this);
        }

        onStarted();
    }
Beispiel #9
0
 public void checkIsActiveRecordLocked() throws RecordUnlockedException {
   SessionState sessionState = getSessionState();
   CollectRecord record = sessionState.getActiveRecord();
   if (record == null) {
     throw new RecordUnlockedException();
   } else if (record.getId() != null) {
     User user = sessionState.getUser();
     String lockId = sessionState.getSessionId();
     try {
       recordManager.checkIsLocked(record.getId(), user, lockId);
       sessionState.keepActiveRecordAlive();
     } catch (RecordUnlockedException e) {
       clearActiveRecord();
       throw e;
     }
   }
 }
Beispiel #10
0
 public Graph neighbourhoodGraph(int nnodes[], int hops) {
   PrimaryHashMap<Integer, String> nodes;
   PrimaryHashMap<String, Integer> nodesReverse;
   try {
     File auxFile = File.createTempFile("graph-maps-" + System.currentTimeMillis(), "aux");
     auxFile.deleteOnExit();
     RecordManager recMan = RecordManagerFactory.createRecordManager(auxFile.getAbsolutePath());
     nodes = recMan.hashMap("nodes");
     nodesReverse = recMan.hashMap("nodesReverse");
   } catch (IOException ex) {
     throw new Error(ex);
   }
   nodes.clear();
   nodesReverse.clear();
   WeightedArcSet list1 = new WeightedArcSet();
   Int2IntAVLTreeMap map = new Int2IntAVLTreeMap();
   IntSet set = new IntLinkedOpenHashSet();
   int numIterators = 100;
   Constructor[] cons = WeightedArc.class.getDeclaredConstructors();
   for (int i = 0; i < cons.length; i++) cons[i].setAccessible(true);
   for (int n : nnodes) map.put(n, 0);
   NodeIterator its[] = new NodeIterator[numIterators];
   int itNum[] = new int[numIterators];
   for (int n = 0; n < its.length; n++) {
     its[n] = nodeIterator();
     itNum[n] = 0;
   }
   while (map.size() != 0) {
     Integer node = 0;
     for (int n = 0; n < its.length; n++) if (itNum[n] <= node) node = itNum[n];
     node = map.tailMap(node).firstKey();
     if (node == null) map.firstKey();
     NodeIterator it = null;
     Integer aux1 = 0;
     int iit = 0;
     for (int n = 0; n < its.length; n++) {
       if (!its[n].hasNext()) {
         its[n] = nodeIterator();
         itNum[n] = 0;
       }
       if (itNum[n] == node) {
         it = its[n];
         aux1 = itNum[n];
         iit = 0;
         break;
       }
       if (itNum[n] < node && itNum[n] >= aux1) {
         it = its[n];
         aux1 = itNum[n];
         iit = n;
       }
     }
     if (it == null) {
       its[0] = nodeIterator();
       itNum[0] = 0;
       it = its[0];
     }
     while (it != null && (aux1 = it.nextInt()) != null && aux1 >= 0 && aux1 < node) {}
     itNum[iit] = aux1 + 1;
     Integer aux2 = null;
     ArcLabelledNodeIterator.LabelledArcIterator suc = it.successors();
     while ((aux2 = suc.nextInt()) != null && aux2 >= 0 && (aux2 < graph.numNodes()))
       try {
         if (commit++ % COMMIT_SIZE == 0) {
           try {
             nodes.getRecordManager().commit();
           } catch (IOException e) {
             throw new Error(e);
           }
           try {
             nodesReverse.getRecordManager().commit();
           } catch (IOException e) {
             throw new Error(e);
           }
         }
         if (!nodesReverse.containsKey(this.nodes.get(aux1))) {
           nodes.put(nodes.size(), this.nodes.get(aux1));
           nodesReverse.put(this.nodes.get(aux1), nodesReverse.size());
         }
         if (!nodesReverse.containsKey(this.nodes.get(aux2))) {
           nodes.put(nodes.size(), this.nodes.get(aux2));
           nodesReverse.put(this.nodes.get(aux2), nodesReverse.size());
         }
         int aaux1 = nodesReverse.get(this.nodes.get(aux1));
         int aaux2 = nodesReverse.get(this.nodes.get(aux2));
         WeightedArc arc1 =
             (WeightedArc) cons[0].newInstance(aaux1, aaux2, suc.label().getFloat());
         list1.add(arc1);
         if (map.get(node) < hops) {
           if (!set.contains(aux1) && (map.get(aux1) == null || map.get(aux1) > map.get(node) + 1))
             map.put(aux1.intValue(), map.get(node) + 1);
           if (!set.contains(aux2) && (map.get(aux2) == null || map.get(aux2) > map.get(node) + 1))
             map.put(aux2.intValue(), map.get(node) + 1);
         }
       } catch (Exception ex) {
         ex.printStackTrace();
         throw new Error(ex);
       }
     ArcLabelledNodeIterator.LabelledArcIterator anc = it.ancestors();
     while ((aux2 = anc.nextInt()) != null && aux2 >= 0 && (aux2 < graph.numNodes()))
       try {
         if (commit++ % COMMIT_SIZE == 0) {
           try {
             nodes.getRecordManager().commit();
           } catch (IOException e) {
             throw new Error(e);
           }
           try {
             nodesReverse.getRecordManager().commit();
           } catch (IOException e) {
             throw new Error(e);
           }
         }
         if (!nodesReverse.containsKey(this.nodes.get(aux1))) {
           nodes.put(nodes.size(), this.nodes.get(aux1));
           nodesReverse.put(this.nodes.get(aux1), nodesReverse.size());
         }
         if (!nodesReverse.containsKey(this.nodes.get(aux2))) {
           nodes.put(nodes.size(), this.nodes.get(aux2));
           nodesReverse.put(this.nodes.get(aux2), nodesReverse.size());
         }
         int aaux1 = nodesReverse.get(this.nodes.get(aux1));
         int aaux2 = nodesReverse.get(this.nodes.get(aux2));
         WeightedArc arc1 =
             (WeightedArc) cons[0].newInstance(aaux2, aaux1, anc.label().getFloat());
         list1.add(arc1);
         if (map.get(node) < hops) {
           if (!set.contains(aux1) && (map.get(aux1) == null || map.get(aux1) > map.get(node) + 1))
             map.put(aux1.intValue(), map.get(node) + 1);
           if (!set.contains(aux2) && (map.get(aux2) == null || map.get(aux2) > map.get(node) + 1))
             map.put(aux2.intValue(), map.get(node) + 1);
         }
       } catch (Exception ex) {
         ex.printStackTrace();
         throw new Error(ex);
       }
     map.remove(node);
     set.add(node);
   }
   Graph newGraph = new Graph(list1.toArray(new WeightedArc[0]));
   newGraph.nodes.clear();
   newGraph.nodesReverse.clear();
   newGraph.nodes = nodes;
   newGraph.nodesReverse = nodesReverse;
   return newGraph;
 }
Beispiel #11
0
 public Graph(String file) throws IOException {
   org.apache.log4j.Logger logger =
       org.apache.log4j.Logger.getLogger("it.unimi.dsi.webgraph.ImmutableGraph");
   logger.setLevel(org.apache.log4j.Level.FATAL);
   try {
     File auxFile = File.createTempFile("graph-maps-" + System.currentTimeMillis(), "aux");
     auxFile.deleteOnExit();
     RecordManager recMan = RecordManagerFactory.createRecordManager(auxFile.getAbsolutePath());
     nodes = recMan.hashMap("nodes");
     nodesReverse = recMan.hashMap("nodesReverse");
   } catch (IOException ex) {
     throw new Error(ex);
   }
   nodes.clear();
   nodesReverse.clear();
   Constructor[] cons = WeightedArc.class.getDeclaredConstructors();
   for (int i = 0; i < cons.length; i++) cons[i].setAccessible(true);
   String aux = null;
   Float weight = (float) 1.0;
   WeightedArcSet list = new WeightedArcSet();
   BufferedReader br;
   try {
     br =
         new BufferedReader(new InputStreamReader(new GZIPInputStream(new FileInputStream(file))));
   } catch (Exception ex) {
     br = new BufferedReader(new FileReader(file));
   }
   while ((aux = br.readLine()) != null)
     try {
       if (commit++ % COMMIT_SIZE == 0) {
         commit();
         list.commit();
       }
       String parts[] = aux.split("\t");
       String l1 = new String(parts[0]);
       String l2 = new String(parts[1]);
       if (!nodesReverse.containsKey(l1)) {
         nodesReverse.put(l1, nodesReverse.size());
         nodes.put(nodes.size(), l1);
       }
       if (!nodesReverse.containsKey(l2)) {
         nodesReverse.put(l2, nodesReverse.size());
         nodes.put(nodes.size(), l2);
       }
       if (parts.length == 3) weight = new Float(parts[2]);
       list.add(
           (WeightedArc) cons[0].newInstance(nodesReverse.get(l1), nodesReverse.get(l2), weight));
     } catch (Exception ex) {
       throw new Error(ex);
     }
   this.graph = new WeightedBVGraph(list.toArray(new WeightedArc[0]));
   br.close();
   list = new WeightedArcSet();
   br = new BufferedReader(new FileReader(file));
   while ((aux = br.readLine()) != null)
     try {
       if (commit++ % COMMIT_SIZE == 0) {
         commit();
         list.commit();
       }
       String parts[] = aux.split("\t");
       String l1 = new String(parts[0]);
       String l2 = new String(parts[1]);
       if (parts.length == 3) weight = new Float(parts[2]);
       list.add(
           (WeightedArc) cons[0].newInstance(nodesReverse.get(l2), nodesReverse.get(l1), weight));
     } catch (Exception ex) {
       throw new Error(ex);
     }
   br.close();
   this.reverse = new WeightedBVGraph(list.toArray(new WeightedArc[0]));
   numArcs = list.size();
   iterator = nodeIterator();
   try {
     File auxFile = File.createTempFile("graph" + System.currentTimeMillis(), "aux");
     auxFile.deleteOnExit();
     String basename = auxFile.getAbsolutePath();
     store(basename);
   } catch (IOException ex) {
     throw new Error(ex);
   }
   commit();
 }
Beispiel #12
0
 public Graph(BVGraph graph) {
   org.apache.log4j.Logger logger =
       org.apache.log4j.Logger.getLogger("it.unimi.dsi.webgraph.ImmutableGraph");
   logger.setLevel(org.apache.log4j.Level.FATAL);
   try {
     File auxFile = File.createTempFile("graph-maps-" + System.currentTimeMillis(), "aux");
     auxFile.deleteOnExit();
     RecordManager recMan = RecordManagerFactory.createRecordManager(auxFile.getAbsolutePath());
     nodes = recMan.hashMap("nodes");
     nodesReverse = recMan.hashMap("nodesReverse");
   } catch (IOException ex) {
     throw new Error(ex);
   }
   nodes.clear();
   nodesReverse.clear();
   Constructor[] cons = WeightedArc.class.getDeclaredConstructors();
   for (int i = 0; i < cons.length; i++) cons[i].setAccessible(true);
   Integer aux1 = null;
   WeightedArcSet list = new WeightedArcSet();
   it.unimi.dsi.webgraph.NodeIterator it = graph.nodeIterator();
   while ((aux1 = it.nextInt()) != null) {
     LazyIntIterator suc = it.successors();
     Integer aux2 = null;
     while ((aux2 = suc.nextInt()) != null && aux2 >= 0 && (aux2 < graph.numNodes()))
       try {
         if (commit++ % COMMIT_SIZE == 0) {
           list.commit();
         }
         list.add((WeightedArc) cons[0].newInstance(aux1, aux2, (float) 1.0));
       } catch (Exception ex) {
         throw new Error(ex);
       }
   }
   this.graph = new WeightedBVGraph(list.toArray(new WeightedArc[0]));
   list = new WeightedArcSet();
   it = graph.nodeIterator();
   while ((aux1 = it.nextInt()) != null) {
     LazyIntIterator suc = it.successors();
     Integer aux2 = null;
     while ((aux2 = suc.nextInt()) != null && aux2 >= 0 && (aux2 < graph.numNodes()))
       try {
         if (commit++ % COMMIT_SIZE == 0) {
           commit();
           list.commit();
         }
         list.add((WeightedArc) cons[0].newInstance(aux2, aux1, (float) 1.0));
         this.nodes.put(aux1, "" + aux1);
         this.nodes.put(aux2, "" + aux2);
         this.nodesReverse.put("" + aux1, aux1);
         this.nodesReverse.put("" + aux2, aux2);
       } catch (Exception ex) {
         throw new Error(ex);
       }
   }
   this.reverse = new WeightedBVGraph(list.toArray(new WeightedArc[0]));
   numArcs = list.size();
   iterator = nodeIterator();
   try {
     File auxFile = File.createTempFile("graph" + System.currentTimeMillis(), "aux");
     auxFile.deleteOnExit();
     String basename = auxFile.getAbsolutePath();
     store(basename);
   } catch (IOException ex) {
     throw new Error(ex);
   }
   commit();
 }
Beispiel #13
0
  @Override
  @OutboundActionMeta(name = "alarm")
  public void handleOutbound(Context ctx) throws ServletException, IOException {
    Model model = new Model(ctx);
    Payload payload = ctx.getPayload();
    Action action = payload.getAction();
    int userId = getLoginUserId(ctx);
    boolean result = false;

    switch (action) {
      case ALARM_RECORD_LIST:
        m_recordManager.queryUserAlarmRecords(model, userId);
        break;
      case ALARM_RULE_ADD:
        m_ruleManager.ruleAdd(payload, model);
        break;
      case ALARM_RULE_ADD_SUBMIT:
        m_ruleManager.ruleAddSubmit(payload, model);
        break;
      case ALARM_RULE_UPDATE:
        m_ruleManager.ruleUpdate(payload, model);
        break;
      case ALARM_RULE_UPDATE_SUBMIT:
        m_ruleManager.ruleUpdateSubmit(payload, model);
        break;
      case EXCEPTION_ALARM_RULE_DELETE:
        m_ruleManager.ruleDelete(payload);
        m_ruleManager.queryExceptionRuleList(model, userId);
        break;
      case EXCEPTION_ALARM_RULE_SUB:
        result = m_ruleManager.ruleSub(payload, userId);
        if (result) {
          model.setOpState(SUCCESS);
        } else {
          model.setOpState(FAIL);
        }
        break;
      case EXCEPTION_ALARM_RULE_LIST:
        m_ruleManager.queryExceptionRuleList(model, userId);
        break;
      case ALARM_TEMPLATE_LIST:
        m_templateManager.queryTemplateByName(payload, model);
        break;
      case ALARM_TEMPLATE_ADD:
        break;
      case ALARM_TEMPLATE_ADD_SUBMIT:
        m_templateManager.templateAddSubmit(payload, model);
        break;
      case ALARM_TEMPLATE_DELETE:
        break;
      case ALARM_TEMPLATE_UPDATE:
        m_templateManager.templateUpdate(payload, model);
        break;
      case ALARM_TEMPLATE_UPDATE_SUBMIT:
        m_templateManager.templateUpdateSubmit(payload, model);
        break;
      case SERVICE_ALARM_RULE_DELETE:
        m_ruleManager.ruleDelete(payload);
        m_ruleManager.queryServiceRuleList(model, userId);
        break;
      case SERVICE_ALARM_RULE_LIST:
        m_ruleManager.queryServiceRuleList(model, userId);
        break;
      case SERVICE_ALARM_RULE_SUB:
        result = m_ruleManager.ruleSub(payload, userId);
        if (result) {
          model.setOpState(SUCCESS);
        } else {
          model.setOpState(FAIL);
        }
        break;
      case ALARM_RECORD_DETAIL:
        m_recordManager.queryAlarmRecordDetail(payload, model);
        break;
      case SCHEDULED_REPORT_ADD:
        m_scheduledManager.scheduledReportAdd(payload, model);
        break;
      case SCHEDULED_REPORT_ADD_SUBMIT:
        m_scheduledManager.scheduledReportAddSubmit(payload, model);
        break;
      case SCHEDULED_REPORT_DELETE:
        m_scheduledManager.scheduledReportDelete(payload);
        m_scheduledManager.queryScheduledReports(model, userId);
        break;
      case SCHEDULED_REPORT_LIST:
        m_scheduledManager.queryScheduledReports(model, userId);
        break;
      case SCHEDULED_REPORT_UPDATE:
        m_scheduledManager.scheduledReportUpdate(payload, model);
        break;
      case SCHEDULED_REPORT_UPDATE_SUBMIT:
        m_scheduledManager.scheduledReportUpdateSubmit(payload, model);
        break;
      case SCHEDULED_REPORT_SUB:
        result = m_scheduledManager.scheduledReportSub(payload, userId);
        if (result) {
          model.setOpState(SUCCESS);
        } else {
          model.setOpState(FAIL);
        }
        break;
      case REPORT_RECORD_LIST:
        m_recordManager.queryUserReportRecords(model, userId);
        break;
    }

    model.setAction(payload.getAction());
    model.setPage(SystemPage.ALARM);
    m_jspViewer.view(ctx, model);
  }
Beispiel #14
0
  @Test
  public void test1() {
    MemcachedMPool pool = new MemcachedMPool();
    pool.initialize(32, 0.25f, 4 << 10);

    RecordManager manager = new RecordManager(pool);
    KVIndexCache cache = new KVIndexCache(manager);

    String keystr = "navis1";
    String valurstr = "value1";
    byte[] key = keystr.getBytes();
    byte[] value = valurstr.getBytes();

    long counter = 0;
    int[][] eindex1 = TestUtils.eindex(pool, key, value, 0, ++counter);
    int[][] eindex2 = TestUtils.eindex(pool, "navis2", "value2", 0, ++counter);
    int[][] eindex3 = TestUtils.eindex(pool, "navis3", "value3", 0, ++counter);

    int length = Region.toLength(eindex1[MEMORY]);
    Assert.assertEquals(length, RECORD_HEADER_LEN + keystr.length() + valurstr.length());

    Assert.assertNull(cache.store(0, eindex1));

    int[][] retrieved = cache.get(key, Utils.hash(key));
    Assert.assertSame(eindex1[MEMORY], retrieved[MEMORY]);
    Assert.assertEquals(keystr, manager.keyString(eindex1[MEMORY]));
    Assert.assertEquals(valurstr, manager.valueString(eindex1[MEMORY]));
    Assert.assertEquals(
        keystr + "=" + valurstr, manager.keyValueString(eindex1[MEMORY], (byte) '='));

    int[] prev = eindex1[MEMORY];
    int[] nindex = eindex1[MEMORY] = manager.cropData(eindex1[MEMORY]);
    System.out.println(Region.toString(eindex1[MEMORY]) + " --> " + Region.toString(nindex));
    Assert.assertNotSame(prev, nindex);
    Assert.assertSame(eindex1, cache.get(key, Utils.hash(key)));
    Assert.assertEquals(keystr, manager.keyString(nindex));
    Assert.assertEquals(length - valurstr.length(), Region.toLength(nindex));

    cache.store(0, eindex2);
    cache.store(0, eindex3);

    Assert.assertTrue(
        TestUtils.equals(manager, cache.values(), true, "navis1", "navis2", "navis3"));

    Assert.assertEquals("value2", manager.valueString(cache.retrieve("navis2")));
    Assert.assertTrue(
        TestUtils.equals(manager, cache.values(), true, "navis1", "navis3", "navis2"));
    Assert.assertTrue(
        TestUtils.equals(manager, cache.cvalues(), true, "navis1", "navis2", "navis3"));

    System.out.println(
        "LRU : " + Arrays.toString(TestUtils.toString(manager, cache.values(), false)));
    System.out.println(
        "C   : " + Arrays.toString(TestUtils.toString(manager, cache.cvalues(), false)));

    System.out.println(
        "[KVIndexCacheTest/test1] remove mark " + manager.keyString(eindex1[MEMORY]));
    cache.removeMark(eindex1);
    Assert.assertNull(cache.retrieve("navis1"));
    Assert.assertTrue(
        TestUtils.equals(
            manager, cache.values(), false, "navis1", "navis3:value3", "navis2:value2"));
    Assert.assertTrue(
        TestUtils.equals(
            manager, cache.cvalues(), false, "navis2:value2", "navis3:value3", "navis1"));

    System.out.println(
        "LRU : " + Arrays.toString(TestUtils.toString(manager, cache.values(), false)));
    System.out.println(
        "C   : " + Arrays.toString(TestUtils.toString(manager, cache.cvalues(), false)));
  }