[Git][java-team/ciftools-java][master] 5 commits: New upstream version 4.0.2

Andrius Merkys (@merkys) gitlab at salsa.debian.org
Mon Jul 4 08:51:06 BST 2022



Andrius Merkys pushed to branch master at Debian Java Maintainers / ciftools-java


Commits:
e184ad6f by Andrius Merkys at 2022-07-04T03:04:49-04:00
New upstream version 4.0.2
- - - - -
3d154428 by Andrius Merkys at 2022-07-04T03:05:02-04:00
Update upstream source from tag 'upstream/4.0.2'

Update to upstream version '4.0.2'
with Debian dir 391c2c39c5bb6590caa293603ee8360ae1d02858
- - - - -
a4266d30 by Andrius Merkys at 2022-07-04T03:16:30-04:00
Refresh deactivate_tests_using_network.patch.

- - - - -
2109b72d by Andrius Merkys at 2022-07-04T03:17:06-04:00
Update lintian override.

- - - - -
6685ac1f by Andrius Merkys at 2022-07-04T03:17:30-04:00
Update changelog for 4.0.2-1 release

- - - - -


20 changed files:

- CHANGELOG.md
- README.md
- debian/changelog
- debian/libciftools-java.lintian-overrides
- debian/patches/deactivate_tests_using_network.patch
- pom.xml
- src/main/java/org/rcsb/cif/binary/BinaryCifWriter.java
- src/test/java/org/rcsb/cif/IntegrationTest.java
- src/test/java/org/rcsb/cif/UpdateTestFiles.java
- src/test/java/org/rcsb/cif/WriterTest.java
- src/test/resources/snapshot/1acj.bcif
- src/test/resources/snapshot/1acj.bcif.gz
- src/test/resources/snapshot/1j59.bcif
- src/test/resources/snapshot/1j59.bcif.gz
- src/test/resources/snapshot/1pga.bcif
- src/test/resources/snapshot/1pga.bcif.gz
- src/test/resources/snapshot/4cxl.bcif
- src/test/resources/snapshot/4cxl.bcif.gz
- src/test/resources/snapshot/5zmz.bcif
- src/test/resources/snapshot/5zmz.bcif.gz


Changes:

=====================================
CHANGELOG.md
=====================================
@@ -3,6 +3,11 @@ CIFTools Changelog
 
 This project uses semantic versioning. Furthermore, this project provides code that was generated from schemata. Any schema change that introduces a breaking change in the generated code is considered as breaking for the whole project. Additional information is provided below when this occurs (named `Breaking schema changes`). Most of these occur in experimental categories and are unlikely to affect your code. `Breaking API changes` will be avoided starting with version 1.0.0.
 
+ciftools-java 4.0.2 - June 2022
+-------------
+### Bug fixes
+* write `null` instead of empty map if all values are present and no mask is needed - otherwise other software might refuse to load files written by ciftools-java
+
 ciftools-java 4.0.1 - June 2022
 -------------
 ### Bug fixes


=====================================
README.md
=====================================
@@ -14,7 +14,7 @@ CIFTools is distributed by maven. To get started, append your `pom.xml` by:
 <dependency>
   <groupId>org.rcsb</groupId>
   <artifactId>ciftools-java</artifactId>
-  <version>4.0.0</version>
+  <version>4.0.2</version>
 </dependency>
 ```
 


=====================================
debian/changelog
=====================================
@@ -1,3 +1,10 @@
+ciftools-java (4.0.2-1) unstable; urgency=medium
+
+  * New upstream version 4.0.2
+  * Update lintian override.
+
+ -- Andrius Merkys <merkys at debian.org>  Mon, 04 Jul 2022 03:17:27 -0400
+
 ciftools-java (4.0.1-1) unstable; urgency=medium
 
   * New upstream version 4.0.1


=====================================
debian/libciftools-java.lintian-overrides
=====================================
@@ -1,4 +1,4 @@
 # I kept the upstream name ciftools-java as there already exists a Debian
 # package named cif-tools. Still, a binary package libciftools-java-java
 # would sound a bit awkward.
-bad-jar-name usr/share/java/ciftools-java.jar
+bad-jar-name [usr/share/java/ciftools-java.jar]


=====================================
debian/patches/deactivate_tests_using_network.patch
=====================================
@@ -83,9 +83,9 @@ Last-Update: 2021-10-17
  
 +import org.junit.jupiter.api.Disabled;
  import org.junit.jupiter.api.Test;
- import org.rcsb.cif.binary.codec.MessagePackCodec;
  import org.rcsb.cif.model.Category;
-@@ -314,6 +315,7 @@
+ import org.rcsb.cif.model.CifFile;
+@@ -311,6 +312,7 @@
      /**
       * BinaryCIF might slightly violate the schema and lead to a ClassCastException if not handled.
       */
@@ -93,7 +93,7 @@ Last-Update: 2021-10-17
      @Test
      void readRcsbAndEbiGeneric() throws IOException {
          CifFile rcsb = CifIO.readFromInputStream(TestHelper.getInputStream("bcif/1acj.bcif"));
-@@ -329,6 +331,7 @@
+@@ -326,6 +328,7 @@
          assertEquals(83, ebiNdbSeqNum.getRowCount());
      }
  


=====================================
pom.xml
=====================================
@@ -3,7 +3,7 @@
     <modelVersion>4.0.0</modelVersion>
     <groupId>org.rcsb</groupId>
     <artifactId>ciftools-java</artifactId>
-    <version>4.0.1</version>
+    <version>4.0.2</version>
     <packaging>jar</packaging>
     <description>
         A Java library for handling text and binary CIF files.
@@ -35,7 +35,7 @@
         <connection>scm:git:git://github.com/rcsb/ciftools-java.git</connection>
         <developerConnection>scm:git:git at github.com:rcsb/ciftools-java.git</developerConnection>
         <url>https://github.com/rcsb/ciftools-java</url>
-      <tag>ciftools-java-4.0.1</tag>
+      <tag>ciftools-java-4.0.2</tag>
   </scm>
 
     <dependencies>


=====================================
src/main/java/org/rcsb/cif/binary/BinaryCifWriter.java
=====================================
@@ -291,8 +291,9 @@ public class BinaryCifWriter {
         encodedMap.put("data", byteArray.getData());
 
         // encode mask
-        Map<String, Object> maskData = new LinkedHashMap<>();
+        Map<String, Object> maskData = null;
         if (!allPresent) {
+            maskData = new LinkedHashMap<>();
             ByteArray maskRLE = mask.encode(new RunLengthEncoding()).encode();
 
             if (maskRLE.getData().length < mask.getData().length) {


=====================================
src/test/java/org/rcsb/cif/IntegrationTest.java
=====================================
@@ -1,7 +1,6 @@
 package org.rcsb.cif;
 
 import org.junit.jupiter.api.Test;
-import org.rcsb.cif.binary.codec.MessagePackCodec;
 import org.rcsb.cif.model.Category;
 import org.rcsb.cif.model.CifFile;
 import org.rcsb.cif.model.Column;
@@ -21,8 +20,6 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.lang.reflect.Array;
 import java.nio.charset.StandardCharsets;
-import java.util.Arrays;
-import java.util.Map;
 
 import static org.junit.jupiter.api.Assertions.*;
 import static org.rcsb.cif.TestHelper.TEST_CASES;
@@ -344,37 +341,4 @@ class IntegrationTest {
                 .getNdbSeqNum();
         assertEquals(83, ebiNdbSeqNum.getRowCount());
     }
-
-    @Test
-    @SuppressWarnings("unchecked")
-    void testTypeInferenceWhenSchemaIsAbsent() throws IOException {
-        CifFile text = CifIO.readFromInputStream(TestHelper.getInputStream("cif/1acj.cif"));
-        Column<?> textColumn = text.getBlocks().get(0).getCategory("pdbx_struct_assembly_gen").getColumn("assembly_id");
-        assertEquals("1", textColumn.getStringData(0));
-
-//        byte[] bytes = CifIO.writeBinary(text);
-//        Map<String, Object> binaryMap = MessagePackCodec.decode(new ByteArrayInputStream(bytes));
-        Map<String, Object> binaryMap = MessagePackCodec.decode(TestHelper.getInputStream("bcif/1acj.bcif"));
-        Map<String, Object> blocks = (Map<String, Object>) ((Object[]) binaryMap.get("dataBlocks"))[0];
-        Map<String, Object> structAssemblyGen = find(blocks.get("categories"), "_pdbx_struct_assembly_gen");
-        Map<String, Object> assemblyId = find(structAssemblyGen.get("columns"), "assembly_id");
-        Object[] encoding = (Object[]) ((Map<String, Object>) assemblyId.get("data")).get("encoding");
-        System.out.println(structAssemblyGen);
-        System.out.println(assemblyId);
-        System.out.println(Arrays.toString(encoding));
-
-//        CifFile binary = CifIO.readFromInputStream(new ByteArrayInputStream(bytes));
-//        Column<?> binaryColumn = binary.getBlocks().get(0).getCategory("pdbx_struct_assembly_gen").getColumn("assembly_id");
-//        assertEquals("1", binaryColumn.getStringData(0));
-//        assertTrue(binaryColumn instanceof StrColumn);
-    }
-
-    @SuppressWarnings("unchecked")
-    private Map<String, Object> find(Object data, String name) {
-        return Arrays.stream((Object[]) data)
-                .map(c -> (Map<String, Object>) c)
-                .filter(m -> name.equals(m.get("name")))
-                .findFirst()
-                .orElseThrow();
-    }
 }


=====================================
src/test/java/org/rcsb/cif/UpdateTestFiles.java
=====================================
@@ -10,6 +10,9 @@ import java.nio.file.Paths;
 
 import static org.rcsb.cif.TestHelper.TEST_CASES;
 
+/**
+ * Args[0] points to snapshot directory: ciftools-java/src/test/resources/snapshot/
+ */
 public class UpdateTestFiles {
     public static void main(String[] args) throws IOException {
         Path dest = Paths.get(args[0]);


=====================================
src/test/java/org/rcsb/cif/WriterTest.java
=====================================
@@ -1,6 +1,7 @@
 package org.rcsb.cif;
 
 import org.junit.jupiter.api.Test;
+import org.rcsb.cif.binary.codec.MessagePackCodec;
 import org.rcsb.cif.model.BlockBuilder;
 import org.rcsb.cif.model.Category;
 import org.rcsb.cif.model.CategoryBuilder;
@@ -24,6 +25,8 @@ import org.rcsb.cif.schema.mm.MmCifFile;
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.util.Arrays;
+import java.util.Map;
 import java.util.regex.Pattern;
 
 import static org.junit.jupiter.api.Assertions.*;
@@ -204,4 +207,18 @@ class WriterTest {
         assertArrayEquals(originalGzip, outputGzip, "binary write output does not match snapshot of output - did the implementation change?" +
                 " if so, update snapshot files in snapshot/");
     }
+
+    @Test
+    @SuppressWarnings("unchecked")
+    void shouldWriteNullMaskIfAllValuesPresent() throws IOException {
+        CifFile cifFile = CifIO.readFromInputStream(TestHelper.getInputStream("cif/1a2c.cif"));
+        byte[] bytes = CifIO.writeBinary(cifFile);
+        Map<String, Object> message = MessagePackCodec.decode(new ByteArrayInputStream(bytes));
+        Map<String, Object> block = (Map<String, Object>) ((Object[]) message.get("dataBlocks"))[0];
+        Map<String, Object> atomSite = (Map<String, Object>) Arrays.stream((Object[]) block.get("categories")).map(Map.class::cast).filter(m -> m.get("name").equals("_atom_site")).findFirst().orElse(null);
+        assertNotNull(atomSite);
+        Map<String, Object> authAsymId = (Map<String, Object>) Arrays.stream((Object[]) atomSite.get("columns")).map(Map.class::cast).filter(m -> m.get("name").equals("auth_asym_id")).findFirst().orElse(null);
+        assertNotNull(authAsymId);
+        assertNull(authAsymId.get("mask"), "empty mask must be encoded by 'null' value");
+    }
 }


=====================================
src/test/resources/snapshot/1acj.bcif
=====================================
Binary files a/src/test/resources/snapshot/1acj.bcif and b/src/test/resources/snapshot/1acj.bcif differ


=====================================
src/test/resources/snapshot/1acj.bcif.gz
=====================================
Binary files a/src/test/resources/snapshot/1acj.bcif.gz and b/src/test/resources/snapshot/1acj.bcif.gz differ


=====================================
src/test/resources/snapshot/1j59.bcif
=====================================
Binary files a/src/test/resources/snapshot/1j59.bcif and b/src/test/resources/snapshot/1j59.bcif differ


=====================================
src/test/resources/snapshot/1j59.bcif.gz
=====================================
Binary files a/src/test/resources/snapshot/1j59.bcif.gz and b/src/test/resources/snapshot/1j59.bcif.gz differ


=====================================
src/test/resources/snapshot/1pga.bcif
=====================================
Binary files a/src/test/resources/snapshot/1pga.bcif and b/src/test/resources/snapshot/1pga.bcif differ


=====================================
src/test/resources/snapshot/1pga.bcif.gz
=====================================
Binary files a/src/test/resources/snapshot/1pga.bcif.gz and b/src/test/resources/snapshot/1pga.bcif.gz differ


=====================================
src/test/resources/snapshot/4cxl.bcif
=====================================
Binary files a/src/test/resources/snapshot/4cxl.bcif and b/src/test/resources/snapshot/4cxl.bcif differ


=====================================
src/test/resources/snapshot/4cxl.bcif.gz
=====================================
Binary files a/src/test/resources/snapshot/4cxl.bcif.gz and b/src/test/resources/snapshot/4cxl.bcif.gz differ


=====================================
src/test/resources/snapshot/5zmz.bcif
=====================================
Binary files a/src/test/resources/snapshot/5zmz.bcif and b/src/test/resources/snapshot/5zmz.bcif differ


=====================================
src/test/resources/snapshot/5zmz.bcif.gz
=====================================
Binary files a/src/test/resources/snapshot/5zmz.bcif.gz and b/src/test/resources/snapshot/5zmz.bcif.gz differ



View it on GitLab: https://salsa.debian.org/java-team/ciftools-java/-/compare/33cf2dfeb01b23b48087ef66cb047691a3959cd0...6685ac1f0b5b52a23df78ebb0297fdfa441b4616

-- 
View it on GitLab: https://salsa.debian.org/java-team/ciftools-java/-/compare/33cf2dfeb01b23b48087ef66cb047691a3959cd0...6685ac1f0b5b52a23df78ebb0297fdfa441b4616
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20220704/a8d11f08/attachment.htm>


More information about the pkg-java-commits mailing list