test_class.file: oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/FormatVersionTest.java
test_class.identifier: FormatVersionTest
test_case.body: @Test
      public void writeTo() throws Exception {
          DocumentStore store = new MemoryDocumentStore();
          // must not write dummy version
          assertFalse(V0.writeTo(store));
          // upgrade
          for (FormatVersion v : ImmutableList.of(V1_0, V1_2, V1_4, V1_6, V1_8)) {
              assertTrue(v.writeTo(store));
              assertSame(v, FormatVersion.versionOf(store));
          }
      }
test_case.class_method_signature: FormatVersionTest.writeTo()
test_case.full_signature: @Test public void writeTo()
test_case.identifier: writeTo
test_case.invocations: assertFalse writeTo of assertTrue writeTo assertSame versionOf
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void writeTo()
focal_class.declarator: V0 = new FormatVersion(0, 0, 0)
focal_class.modifier: static final
focal_class.original_string: static final FormatVersion V0 = new FormatVersion(0, 0, 0);
focal_class.type: FormatVersion
focal_class.var_name: V0
focal_class.declarator: V1_0 = new FormatVersion(1, 0, 0)
focal_class.modifier: static final
focal_class.original_string: static final FormatVersion V1_0 = new FormatVersion(1, 0, 0);
focal_class.type: FormatVersion
focal_class.var_name: V1_0
focal_class.declarator: V1_2 = new FormatVersion(1, 2, 0)
focal_class.modifier: static final
focal_class.original_string: static final FormatVersion V1_2 = new FormatVersion(1, 2, 0);
focal_class.type: FormatVersion
focal_class.var_name: V1_2
focal_class.declarator: V1_4 = new FormatVersion(1, 4, 0)
focal_class.modifier: static final
focal_class.original_string: static final FormatVersion V1_4 = new FormatVersion(1, 4, 0);
focal_class.type: FormatVersion
focal_class.var_name: V1_4
focal_class.declarator: V1_6 = new FormatVersion(1, 6, 0)
focal_class.modifier: static final
focal_class.original_string: static final FormatVersion V1_6 = new FormatVersion(1, 6, 0);
focal_class.type: FormatVersion
focal_class.var_name: V1_6
focal_class.declarator: V1_8 = new FormatVersion(1, 8, 0)
focal_class.modifier: static final
focal_class.original_string: static final FormatVersion V1_8 = new FormatVersion(1, 8, 0);
focal_class.type: FormatVersion
focal_class.var_name: V1_8
focal_class.declarator: VERSION_ID = "version"
focal_class.modifier: private static final
focal_class.original_string: private static final String VERSION_ID = "version";
focal_class.type: String
focal_class.var_name: VERSION_ID
focal_class.declarator: PROP_VERSION = "_v"
focal_class.modifier: private static final
focal_class.original_string: private static final String PROP_VERSION = "_v";
focal_class.type: String
focal_class.var_name: PROP_VERSION
focal_class.declarator: major
focal_class.modifier: private final
focal_class.original_string: private final int major, minor, micro;
focal_class.type: int
focal_class.var_name: major
focal_class.file: oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/FormatVersion.java
focal_class.identifier: FormatVersion
focal_class.interfaces: implements Comparable<FormatVersion>
focal_class.class_method_signature: FormatVersion.values()
focal_class.full_signature: public static Iterable<FormatVersion> values()
focal_class.identifier: values
focal_class.modifiers: public static
focal_class.parameters: ()
focal_class.return: Iterable<FormatVersion>
focal_class.signature: Iterable<FormatVersion> values()
focal_class.class_method_signature: FormatVersion.FormatVersion(int major, int minor, int micro)
focal_class.full_signature: private  FormatVersion(int major, int minor, int micro)
focal_class.identifier: FormatVersion
focal_class.modifiers: private
focal_class.parameters: (int major, int minor, int micro)
focal_class.signature:  FormatVersion(int major, int minor, int micro)
focal_class.class_method_signature: FormatVersion.canRead(FormatVersion other)
focal_class.full_signature: public boolean canRead(FormatVersion other)
focal_class.identifier: canRead
focal_class.modifiers: public
focal_class.parameters: (FormatVersion other)
focal_class.return: boolean
focal_class.signature: boolean canRead(FormatVersion other)
focal_class.class_method_signature: FormatVersion.versionOf(@NotNull DocumentStore store)
focal_class.full_signature: @NotNull public static FormatVersion versionOf(@NotNull DocumentStore store)
focal_class.identifier: versionOf
focal_class.modifiers: @NotNull public static
focal_class.parameters: (@NotNull DocumentStore store)
focal_class.return: FormatVersion
focal_class.signature: FormatVersion versionOf(@NotNull DocumentStore store)
focal_class.class_method_signature: FormatVersion.writeTo(@NotNull DocumentStore store)
focal_class.full_signature: public boolean writeTo(@NotNull DocumentStore store)
focal_class.identifier: writeTo
focal_class.modifiers: public
focal_class.parameters: (@NotNull DocumentStore store)
focal_class.return: boolean
focal_class.signature: boolean writeTo(@NotNull DocumentStore store)
focal_class.class_method_signature: FormatVersion.valueOf(String s)
focal_class.full_signature: public static FormatVersion valueOf(String s)
focal_class.identifier: valueOf
focal_class.modifiers: public static
focal_class.parameters: (String s)
focal_class.return: FormatVersion
focal_class.signature: FormatVersion valueOf(String s)
focal_class.class_method_signature: FormatVersion.toString()
focal_class.full_signature: @Override public String toString()
focal_class.identifier: toString
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String toString()
focal_class.class_method_signature: FormatVersion.equals(Object obj)
focal_class.full_signature: @Override public boolean equals(Object obj)
focal_class.identifier: equals
focal_class.modifiers: @Override public
focal_class.parameters: (Object obj)
focal_class.return: boolean
focal_class.signature: boolean equals(Object obj)
focal_class.class_method_signature: FormatVersion.compareTo(@NotNull FormatVersion other)
focal_class.full_signature: @Override public int compareTo(@NotNull FormatVersion other)
focal_class.identifier: compareTo
focal_class.modifiers: @Override public
focal_class.parameters: (@NotNull FormatVersion other)
focal_class.return: int
focal_class.signature: int compareTo(@NotNull FormatVersion other)
focal_class.class_method_signature: FormatVersion.concurrentUpdate()
focal_class.full_signature: private static DocumentStoreException concurrentUpdate()
focal_class.identifier: concurrentUpdate
focal_class.modifiers: private static
focal_class.parameters: ()
focal_class.return: DocumentStoreException
focal_class.signature: DocumentStoreException concurrentUpdate()
focal_class.class_method_signature: FormatVersion.unableToWrite(String reason)
focal_class.full_signature: private static DocumentStoreException unableToWrite(String reason)
focal_class.identifier: unableToWrite
focal_class.modifiers: private static
focal_class.parameters: (String reason)
focal_class.return: DocumentStoreException
focal_class.signature: DocumentStoreException unableToWrite(String reason)
focal_method.body: public boolean writeTo(@NotNull DocumentStore store)
              throws DocumentStoreException {
          checkNotNull(store);
          FormatVersion v = versionOf(store);
          if (v == this) {
              // already on this version
              return false;
          }
          if (!canRead(v)) {
              // never downgrade
              throw unableToWrite("Version " + this + " cannot read " + v);
          }
          List<Integer> active = Lists.newArrayList();
          for (ClusterNodeInfoDocument d : ClusterNodeInfoDocument.all(store)) {
              if (d.isActive()) {
                  active.add(d.getClusterId());
              }
          }
          if (!active.isEmpty() && v != V0) {
              throw unableToWrite("There are active cluster nodes: " + active);
          }
          if (v == V0) {
              UpdateOp op = new UpdateOp(VERSION_ID, true);
              op.set(PROP_VERSION, toString());
              if (!store.create(SETTINGS, Lists.newArrayList(op))) {
                  throw concurrentUpdate();
              }
          } else {
              UpdateOp op = new UpdateOp(VERSION_ID, false);
              op.equals(PROP_VERSION, v.toString());
              op.set(PROP_VERSION, toString());
              if (store.findAndUpdate(SETTINGS, op) == null) {
                  throw concurrentUpdate();
              }
          }
          return true;
      }
focal_method.class_method_signature: FormatVersion.writeTo(@NotNull DocumentStore store)
focal_method.full_signature: public boolean writeTo(@NotNull DocumentStore store)
focal_method.identifier: writeTo
focal_method.invocations: checkNotNull versionOf canRead unableToWrite newArrayList all isActive add getClusterId isEmpty unableToWrite set toString create newArrayList concurrentUpdate equals toString set toString findAndUpdate concurrentUpdate
focal_method.modifiers: public
focal_method.parameters: (@NotNull DocumentStore store)
focal_method.return: boolean
focal_method.signature: boolean writeTo(@NotNull DocumentStore store)