[LIB-9] Fix name of chesshog-dbetude module
authorgotty <gotty@hedgecode.org>
Tue, 23 Apr 2019 15:57:50 +0000 (18:57 +0300)
committergotty <gotty@hedgecode.org>
Tue, 23 Apr 2019 15:58:40 +0000 (18:58 +0300)
chesshog-dbetude/pom.xml
chesshog-dbetude/src/test/groovy/org/hedgecode/chess/db/CreateDBTest.groovy [new file with mode: 0644]
chesshog-qrcode/pom.xml
chesshog-qrcode/src/test/java/org/hedgecode/chess/qrcode/ChessQRCodeReaderTest.java [new file with mode: 0644]
chesshog-qrcode/src/test/java/org/hedgecode/chess/qrcode/ChessQRCodeWriterTest.java [new file with mode: 0644]

index 0cf4a35..d051ce0 100644 (file)
@@ -31,9 +31,9 @@
     <version>0.1-SNAPSHOT</version>
     <packaging>jar</packaging>
 
-    <name>Hedgecode ChessHog DB Engine</name>
+    <name>Hedgecode ChessHog DB Etude</name>
     <description>
-        Hedgecode ChessHog DB Engine Module.
+        Hedgecode ChessHog DB Etude Module.
     </description>
 
     <properties>
diff --git a/chesshog-dbetude/src/test/groovy/org/hedgecode/chess/db/CreateDBTest.groovy b/chesshog-dbetude/src/test/groovy/org/hedgecode/chess/db/CreateDBTest.groovy
new file mode 100644 (file)
index 0000000..d5204db
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2018. Developed by Hedgecode.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.hedgecode.chess.db
+
+/**
+ *
+ *
+ * @author Dmitry Samoshin aka gotty
+ */
+
+import javax.persistence.Persistence
+
+def factory = Persistence.createEntityManagerFactory("db-etude-persistence-unit")
+def manager = factory.createEntityManager()
+
+manager.getTransaction().begin()
+
+//manager.persist new ServerNode(firstName: "Test", lastName: "Server")
+
+manager.getTransaction().commit()
\ No newline at end of file
index 1c14a06..3c4b577 100644 (file)
             <version>${chessHogVersion}</version>
         </dependency>
         <dependency>
+            <groupId>org.hedgecode.chess</groupId>
+            <artifactId>chesshog-graphics</artifactId>
+            <version>${chessHogVersion}</version>
+        </dependency>
+        <dependency>
             <groupId>com.google.zxing</groupId>
             <artifactId>core</artifactId>
             <version>${zxingVersion}</version>
diff --git a/chesshog-qrcode/src/test/java/org/hedgecode/chess/qrcode/ChessQRCodeReaderTest.java b/chesshog-qrcode/src/test/java/org/hedgecode/chess/qrcode/ChessQRCodeReaderTest.java
new file mode 100644 (file)
index 0000000..d4bd77d
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2018-2019. Developed by Hedgecode.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.hedgecode.chess.qrcode;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+/**
+ * Tests for {@link ChessQRCodeWriter}.
+ *
+ * @author Dmitry Samoshin aka gotty
+ */
+@RunWith(JUnit4.class)
+public class ChessQRCodeReaderTest extends Assert {
+
+    @Test
+    public void decode() throws Exception {
+
+    }
+
+}
\ No newline at end of file
diff --git a/chesshog-qrcode/src/test/java/org/hedgecode/chess/qrcode/ChessQRCodeWriterTest.java b/chesshog-qrcode/src/test/java/org/hedgecode/chess/qrcode/ChessQRCodeWriterTest.java
new file mode 100644 (file)
index 0000000..f4a606f
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2018-2019. Developed by Hedgecode.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.hedgecode.chess.qrcode;
+
+import java.io.File;
+
+import javax.imageio.ImageIO;
+
+import org.hedgecode.chess.img.DiagramBuilder;
+import org.hedgecode.chess.img.ImageFormat;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+import org.hedgecode.chess.Builders;
+import org.hedgecode.chess.Parsers;
+import org.hedgecode.chess.position.Position;
+
+/**
+ * Tests for {@link ChessQRCodeWriter}.
+ *
+ * @author Dmitry Samoshin aka gotty
+ */
+@RunWith(JUnit4.class)
+public class ChessQRCodeWriterTest extends Assert {
+
+    private static final String QR_CODE_IMAGE_PATH = "./QRCodeTest.png";
+
+    @Test
+    public void generate() throws Exception {
+        //String expected = "rnbqkbnr/ppp1pppp/8/3p4/4P3/8/PPPP1PPP/RNBQKBNR w KQkq d6 0 2";
+        String expected = "1r2k1r1/pbppnp1p/1b3P2/8/Q7/B1PB1q2/P4PPP/3R2K1 w - - 0 21";
+        //String expected = "4kb1r/p2n1ppp/4q3/4p1B1/4P3/1Q6/PPP2PPP/2KR4 w k - 0 16";
+
+        Position expectedPosition = Parsers.FEN.parser().parse(
+                expected
+        );
+
+        ChessQRCodeWriter.getInstance().write(
+                ChessQRCodeMode.TCD,
+                Builders.TCD.builder().build(expectedPosition),
+                ImageFormat.PNG,
+                QR_CODE_IMAGE_PATH
+        );
+
+        File file = new File(QR_CODE_IMAGE_PATH);
+        String actual = ChessQRCodeReader.getInstance().read(
+                file
+        ).getContents();
+
+        Position actualPosition = Parsers.TCD.parser().parse(
+                actual
+        );
+
+
+/*
+        assertNotNull(actual);
+        assertEquals(expected, actual);
+*/
+
+        System.out.println(actual);
+
+        ImageIO.write(
+                DiagramBuilder.getInstance().build(actualPosition, "test", "shade"),
+                "PNG",
+                new File("chessboard.png")
+        );
+
+
+        System.out.println(
+                Builders.ASCII.builder().build(actualPosition)
+        );
+
+
+    }
+
+}
\ No newline at end of file