DataItemTest: Test the date type too, and improve the asserts.
[online-glom:gwt-glom.git] / src / test / java / org / glom / web / server / SelfHostExampleNonNumericPrimaryKeysTest.java
1 /*
2  * Copyright (C) 2012 Openismus GmbH
3  *
4  * This file is part of GWT-Glom.
5  *
6  * GWT-Glom is free software: you can redistribute it and/or modify it
7  * under the terms of the GNU Lesser General Public License as published by the
8  * Free Software Foundation, either version 3 of the License, or (at your
9  * option) any later version.
10  *
11  * GWT-Glom is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
14  * for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with GWT-Glom.  If not, see <http://www.gnu.org/licenses/>.
18  */
19
20 package org.glom.web.server;
21
22 import static org.junit.Assert.*;
23
24 import java.net.URL;
25 import java.sql.SQLException;
26
27 import org.glom.web.server.libglom.Document;
28 import org.glom.web.server.libglom.Document.HostingMode;
29 import org.junit.AfterClass;
30 import org.junit.Test;
31
32 /**
33  * @author Murray Cumming <murrayc@openismus.com>
34  * 
35  */
36 public class SelfHostExampleNonNumericPrimaryKeysTest {
37
38         private static SelfHoster selfHoster = null;
39
40         @Test
41         public void test() throws SQLException {
42                 final URL url = SelfHostExampleNonNumericPrimaryKeysTest.class.getResource("test_example_music_collection_text_pk_fields.glom");
43                 assertTrue(url != null);
44                 final String strUri = url.toString();
45
46                 final Document document = new Document();
47                 document.setFileURI(strUri);
48                 assertTrue(document.load());
49
50                 selfHoster = new SelfHoster(document);
51                 final boolean hosted = selfHoster.createAndSelfHostFromExample(HostingMode.HOSTING_MODE_POSTGRES_SELF);
52                 assertTrue(hosted);
53                 
54                 SelfHostTestUtils.testExampleMusiccollectionData(selfHoster, document);
55         }
56
57         @AfterClass
58         public static void tearDown() {
59                 if (selfHoster != null) {
60                         selfHoster.cleanup();
61                 }
62         }
63 }