Commit c60d0aecbca63a9a052ee32dc7c40ba179d12a92
1 parent
987f00a7
Exists in
master
Add Javadoc.
Showing
13 changed files
with
129 additions
and
32 deletions
Show diff stats
src/main/java/eu/omp/irap/vespa/epntapclient/EpnTapException.java
@@ -34,6 +34,7 @@ public class EpnTapException extends Exception { | @@ -34,6 +34,7 @@ public class EpnTapException extends Exception { | ||
34 | 34 | ||
35 | /** | 35 | /** |
36 | * @param message A message describing the error. | 36 | * @param message A message describing the error. |
37 | + * @param e The exception thrown. | ||
37 | */ | 38 | */ |
38 | public EpnTapException(String message, Exception e) { | 39 | public EpnTapException(String message, Exception e) { |
39 | super(message, e); | 40 | super(message, e); |
src/main/java/eu/omp/irap/vespa/epntapclient/RequestCtrl.java
@@ -57,7 +57,8 @@ public class RequestCtrl { | @@ -57,7 +57,8 @@ public class RequestCtrl { | ||
57 | private Map<String, Object> parameters = new HashMap<>(); | 57 | private Map<String, Object> parameters = new HashMap<>(); |
58 | 58 | ||
59 | /** | 59 | /** |
60 | - * The query to send, with the name of the table is replaced by {@link #KEYWORD_TABLE_NAME}. | 60 | + * The query to send, containing {@link #KEYWORD_TABLE_NAME} which will be replaced by the |
61 | + * actual name of each table. | ||
61 | */ | 62 | */ |
62 | private String query; | 63 | private String query; |
63 | 64 | ||
@@ -75,6 +76,7 @@ public class RequestCtrl { | @@ -75,6 +76,7 @@ public class RequestCtrl { | ||
75 | * Constructor of RequestCtrl. | 76 | * Constructor of RequestCtrl. |
76 | * | 77 | * |
77 | * @param nbMaxResult The maximum number of rows returned by the query. | 78 | * @param nbMaxResult The maximum number of rows returned by the query. |
79 | + * @param columnNames The names of the columns used in the SELECT keyword in the query. | ||
78 | */ | 80 | */ |
79 | public RequestCtrl(int nbMaxResult, List<String> columnNames) { | 81 | public RequestCtrl(int nbMaxResult, List<String> columnNames) { |
80 | this.nbMaxResult = nbMaxResult; | 82 | this.nbMaxResult = nbMaxResult; |
@@ -104,6 +106,9 @@ public class RequestCtrl { | @@ -104,6 +106,9 @@ public class RequestCtrl { | ||
104 | return targetNames; | 106 | return targetNames; |
105 | } | 107 | } |
106 | 108 | ||
109 | + /** | ||
110 | + * @return The names of the columns used in the SELECT keyword in the query. | ||
111 | + */ | ||
107 | public List<String> getColumnNames() { | 112 | public List<String> getColumnNames() { |
108 | return columnNames; | 113 | return columnNames; |
109 | } | 114 | } |
@@ -124,10 +129,20 @@ public class RequestCtrl { | @@ -124,10 +129,20 @@ public class RequestCtrl { | ||
124 | return parameters; | 129 | return parameters; |
125 | } | 130 | } |
126 | 131 | ||
132 | + /** | ||
133 | + * @return The query to send, with the name of the table is replaced by | ||
134 | + * {@link #KEYWORD_TABLE_NAME}. | ||
135 | + */ | ||
127 | public String getQuery() { | 136 | public String getQuery() { |
128 | return query; | 137 | return query; |
129 | } | 138 | } |
130 | 139 | ||
140 | + /** | ||
141 | + * Get the query and replace the {@link #KEYWORD_TABLE_NAME} by the specified tableName. | ||
142 | + * | ||
143 | + * @param tableName The name of the table, to put in the FROM ADQL keyword. | ||
144 | + * @return The ADQL query, containing the specified table name. | ||
145 | + */ | ||
131 | public String getQuery(String tableName) { | 146 | public String getQuery(String tableName) { |
132 | return query.replace(KEYWORD_TABLE_NAME, tableName); | 147 | return query.replace(KEYWORD_TABLE_NAME, tableName); |
133 | } | 148 | } |
@@ -142,6 +157,11 @@ public class RequestCtrl { | @@ -142,6 +157,11 @@ public class RequestCtrl { | ||
142 | LOGGER.info("removed " + paramName); | 157 | LOGGER.info("removed " + paramName); |
143 | } | 158 | } |
144 | 159 | ||
160 | + /** | ||
161 | + * Set the names of the columns used in the SELECT keyword in the query. | ||
162 | + * | ||
163 | + * @param columnNames The columns names. | ||
164 | + */ | ||
145 | public void setColumnNames(List<String> columnNames) { | 165 | public void setColumnNames(List<String> columnNames) { |
146 | this.columnNames = columnNames; | 166 | this.columnNames = columnNames; |
147 | } | 167 | } |
@@ -155,6 +175,11 @@ public class RequestCtrl { | @@ -155,6 +175,11 @@ public class RequestCtrl { | ||
155 | nbMaxResult = nbRows; | 175 | nbMaxResult = nbRows; |
156 | } | 176 | } |
157 | 177 | ||
178 | + /** | ||
179 | + * Set the query, containing {@link #KEYWORD_TABLE_NAME}. | ||
180 | + * | ||
181 | + * @param query The query. | ||
182 | + */ | ||
158 | public void setQuery(String query) { | 183 | public void setQuery(String query) { |
159 | this.query = query; | 184 | this.query = query; |
160 | } | 185 | } |
src/main/java/eu/omp/irap/vespa/epntapclient/ServicesList.java
@@ -30,12 +30,16 @@ public class ServicesList { | @@ -30,12 +30,16 @@ public class ServicesList { | ||
30 | /** The logger for the class ServicesList. */ | 30 | /** The logger for the class ServicesList. */ |
31 | private static final Logger LOGGER = Logger.getLogger(ServicesList.class.getName()); | 31 | private static final Logger LOGGER = Logger.getLogger(ServicesList.class.getName()); |
32 | 32 | ||
33 | + /** The list of table names entered in the custom table name field. */ | ||
33 | private List<String> customTableNames; | 34 | private List<String> customTableNames; |
34 | 35 | ||
36 | + /** The list of target URLs entered in the custom target URL field. */ | ||
35 | private List<String> customTargetUrls; | 37 | private List<String> customTargetUrls; |
36 | 38 | ||
39 | + /** The list of table names selected in the services table. */ | ||
37 | private List<String> selectedTableNames; | 40 | private List<String> selectedTableNames; |
38 | 41 | ||
42 | + /** The list of target URLs selected in the services table. */ | ||
39 | private List<String> selectedTargetUrls; | 43 | private List<String> selectedTargetUrls; |
40 | 44 | ||
41 | 45 | ||
@@ -69,6 +73,12 @@ public class ServicesList { | @@ -69,6 +73,12 @@ public class ServicesList { | ||
69 | return targetUrls; | 73 | return targetUrls; |
70 | } | 74 | } |
71 | 75 | ||
76 | + /** | ||
77 | + * Update the services (table name and target URLs) entered in the custom services fields. | ||
78 | + * | ||
79 | + * @param customTableNamesToAdd The list of the table names to update. | ||
80 | + * @param customTargetUrlsToAdd The list of the target URLs to update. | ||
81 | + */ | ||
72 | public void updateCustomServices(List<String> customTableNamesToAdd, | 82 | public void updateCustomServices(List<String> customTableNamesToAdd, |
73 | List<String> customTargetUrlsToAdd) { | 83 | List<String> customTargetUrlsToAdd) { |
74 | customTableNames = customTableNamesToAdd; | 84 | customTableNames = customTableNamesToAdd; |
@@ -77,6 +87,12 @@ public class ServicesList { | @@ -77,6 +87,12 @@ public class ServicesList { | ||
77 | LOGGER.info("Updated custom services URLs: " + StringJoiner.join(customTargetUrls)); | 87 | LOGGER.info("Updated custom services URLs: " + StringJoiner.join(customTargetUrls)); |
78 | } | 88 | } |
79 | 89 | ||
90 | + /** | ||
91 | + * Update the services (table name and target URLs) selected in the services table. | ||
92 | + * | ||
93 | + * @param selectedTableNamesToAdd The list of the table names to update. | ||
94 | + * @param selectedTargetUrlsToAdd The list of the target URLs to update. | ||
95 | + */ | ||
80 | public void updateSelectedServices(List<String> selectedTableNamesToAdd, | 96 | public void updateSelectedServices(List<String> selectedTableNamesToAdd, |
81 | List<String> selectedTargetUrlsToAdd) { | 97 | List<String> selectedTargetUrlsToAdd) { |
82 | selectedTableNames = selectedTableNamesToAdd; | 98 | selectedTableNames = selectedTableNamesToAdd; |
src/main/java/eu/omp/irap/vespa/epntapclient/granule/Granule.java
@@ -291,6 +291,11 @@ public class Granule { | @@ -291,6 +291,11 @@ public class Granule { | ||
291 | this.granuleUid = granuleUid; | 291 | this.granuleUid = granuleUid; |
292 | } | 292 | } |
293 | 293 | ||
294 | + /** | ||
295 | + * Convert the Granule to a Map, as <Granule name, Granule value>. | ||
296 | + * | ||
297 | + * @return the Granule as a map. | ||
298 | + */ | ||
294 | public Map<String, Object> asMap() { | 299 | public Map<String, Object> asMap() { |
295 | Map<String, Object> map = new HashMap<>(); | 300 | Map<String, Object> map = new HashMap<>(); |
296 | map.put(GranuleEnum.GRANULE_UID.toString(), granuleUid); | 301 | map.put(GranuleEnum.GRANULE_UID.toString(), granuleUid); |
@@ -948,6 +953,10 @@ public class Granule { | @@ -948,6 +953,10 @@ public class Granule { | ||
948 | return true; | 953 | return true; |
949 | } | 954 | } |
950 | 955 | ||
956 | + /** | ||
957 | + * @return a string containing all the parameters of the Granule, as strings (key: value). Used | ||
958 | + * to be printed for debug purposes. | ||
959 | + */ | ||
951 | public String printAll() { | 960 | public String printAll() { |
952 | String s = ""; | 961 | String s = ""; |
953 | for (Map.Entry<String, Object> parameter : asMap().entrySet()) { | 962 | for (Map.Entry<String, Object> parameter : asMap().entrySet()) { |
src/main/java/eu/omp/irap/vespa/epntapclient/gui/mainpanel/MainPanelCtrl.java
@@ -16,7 +16,6 @@ | @@ -16,7 +16,6 @@ | ||
16 | 16 | ||
17 | package eu.omp.irap.vespa.epntapclient.gui.mainpanel; | 17 | package eu.omp.irap.vespa.epntapclient.gui.mainpanel; |
18 | 18 | ||
19 | -import java.util.List; | ||
20 | import java.util.logging.Level; | 19 | import java.util.logging.Level; |
21 | import java.util.logging.Logger; | 20 | import java.util.logging.Logger; |
22 | 21 | ||
@@ -89,11 +88,6 @@ public class MainPanelCtrl extends EpnTapController implements MainPanelListener | @@ -89,11 +88,6 @@ public class MainPanelCtrl extends EpnTapController implements MainPanelListener | ||
89 | return servicesPanelCtrl; | 88 | return servicesPanelCtrl; |
90 | } | 89 | } |
91 | 90 | ||
92 | - @Override | ||
93 | - public List<String> getTableNames() { | ||
94 | - return servicesPanelCtrl.getServices().getTableNames(); | ||
95 | - } | ||
96 | - | ||
97 | /** | 91 | /** |
98 | * @return The main view of the application. | 92 | * @return The main view of the application. |
99 | */ | 93 | */ |
src/main/java/eu/omp/irap/vespa/epntapclient/gui/mainpanel/MainPanelListener.java
@@ -16,18 +16,26 @@ | @@ -16,18 +16,26 @@ | ||
16 | 16 | ||
17 | package eu.omp.irap.vespa.epntapclient.gui.mainpanel; | 17 | package eu.omp.irap.vespa.epntapclient.gui.mainpanel; |
18 | 18 | ||
19 | -import java.util.List; | ||
20 | - | ||
21 | /** | 19 | /** |
22 | * @author N. Jourdane | 20 | * @author N. Jourdane |
23 | */ | 21 | */ |
24 | public interface MainPanelListener { | 22 | public interface MainPanelListener { |
25 | 23 | ||
24 | + /** | ||
25 | + * Ask the main panel to open a pop-up and display the specified error. | ||
26 | + * | ||
27 | + * @param message A short message describing the error, which will be the pop-up title. | ||
28 | + * @param e The error itself. | ||
29 | + */ | ||
26 | void displayError(String message, Exception e); | 30 | void displayError(String message, Exception e); |
27 | 31 | ||
28 | - List<String> getTableNames(); | ||
29 | - | 32 | + /** |
33 | + * Ask the main panel to send the query. | ||
34 | + */ | ||
30 | void sendQuery(); | 35 | void sendQuery(); |
31 | 36 | ||
37 | + /** | ||
38 | + * Ask the main panel to update the query. | ||
39 | + */ | ||
32 | void updateQuery(); | 40 | void updateQuery(); |
33 | } | 41 | } |
src/main/java/eu/omp/irap/vespa/epntapclient/gui/resultpanel/ResultPanelCtrl.java
@@ -44,6 +44,8 @@ public class ResultPanelCtrl extends VOTableController implements ResultPanelLis | @@ -44,6 +44,8 @@ public class ResultPanelCtrl extends VOTableController implements ResultPanelLis | ||
44 | 44 | ||
45 | /** | 45 | /** |
46 | * Constructor of ResultPanelCtrl. | 46 | * Constructor of ResultPanelCtrl. |
47 | + * | ||
48 | + * @param listener The listener of the main panel. | ||
47 | */ | 49 | */ |
48 | public ResultPanelCtrl(MainPanelListener listener) { | 50 | public ResultPanelCtrl(MainPanelListener listener) { |
49 | this.listener = listener; | 51 | this.listener = listener; |
src/main/java/eu/omp/irap/vespa/epntapclient/gui/resultpanel/ResultPanelListener.java
@@ -18,7 +18,6 @@ package eu.omp.irap.vespa.epntapclient.gui.resultpanel; | @@ -18,7 +18,6 @@ package eu.omp.irap.vespa.epntapclient.gui.resultpanel; | ||
18 | 18 | ||
19 | import java.io.File; | 19 | import java.io.File; |
20 | 20 | ||
21 | -import eu.omp.irap.vespa.votable.controller.VOTableException.CantSaveVOTableException; | ||
22 | import eu.omp.irap.vespa.votable.view.VOTableViewListener; | 21 | import eu.omp.irap.vespa.votable.view.VOTableViewListener; |
23 | 22 | ||
24 | /** | 23 | /** |
@@ -31,7 +30,6 @@ public interface ResultPanelListener extends VOTableViewListener { | @@ -31,7 +30,6 @@ public interface ResultPanelListener extends VOTableViewListener { | ||
31 | * | 30 | * |
32 | * @param file The file selected by the user in the FileChooser pop-up, corresponding to the | 31 | * @param file The file selected by the user in the FileChooser pop-up, corresponding to the |
33 | * place where save the VOTable. | 32 | * place where save the VOTable. |
34 | - * @throws CantSaveVOTableException The VOTable can not be saved at the specified location. | ||
35 | */ | 33 | */ |
36 | public void onDownloadButtonClicked(File file); | 34 | public void onDownloadButtonClicked(File file); |
37 | } | 35 | } |
src/main/java/eu/omp/irap/vespa/epntapclient/gui/servicespanel/ServicesPanelCtrl.java
@@ -93,7 +93,7 @@ public class ServicesPanelCtrl extends VOTableController implements ServicesPane | @@ -93,7 +93,7 @@ public class ServicesPanelCtrl extends VOTableController implements ServicesPane | ||
93 | } | 93 | } |
94 | 94 | ||
95 | @Override | 95 | @Override |
96 | - public void onServiceUpdated() { | 96 | + public void onServiceListUpdated() { |
97 | String tableName = view.getTableNameTextField().getText(); | 97 | String tableName = view.getTableNameTextField().getText(); |
98 | String targetUrl = view.getServiceUrlTextField().getText(); | 98 | String targetUrl = view.getServiceUrlTextField().getText(); |
99 | List<String> customTableNames = Arrays.asList(tableName.split(CUSTOM_SERVICES_SEPARATOR)); | 99 | List<String> customTableNames = Arrays.asList(tableName.split(CUSTOM_SERVICES_SEPARATOR)); |
src/main/java/eu/omp/irap/vespa/epntapclient/gui/servicespanel/ServicesPanelListener.java
@@ -23,5 +23,8 @@ import eu.omp.irap.vespa.votable.view.VOTableViewListener; | @@ -23,5 +23,8 @@ import eu.omp.irap.vespa.votable.view.VOTableViewListener; | ||
23 | */ | 23 | */ |
24 | public interface ServicesPanelListener extends VOTableViewListener { | 24 | public interface ServicesPanelListener extends VOTableViewListener { |
25 | 25 | ||
26 | - public void onServiceUpdated(); | 26 | + /** |
27 | + * This method is called when the services list is updated. | ||
28 | + */ | ||
29 | + public void onServiceListUpdated(); | ||
27 | } | 30 | } |
src/main/java/eu/omp/irap/vespa/epntapclient/gui/servicespanel/ServicesPanelView.java
@@ -56,22 +56,27 @@ public class ServicesPanelView extends VOTableView { | @@ -56,22 +56,27 @@ public class ServicesPanelView extends VOTableView { | ||
56 | buildServicesPanel(); | 56 | buildServicesPanel(); |
57 | } | 57 | } |
58 | 58 | ||
59 | + /** | ||
60 | + * Add to a textField a listener to listen for text update events (changed, inserted, removed). | ||
61 | + * | ||
62 | + * @param textField the textField to listen. | ||
63 | + */ | ||
59 | public void addEventListener(JTextField textField) { | 64 | public void addEventListener(JTextField textField) { |
60 | textField.getDocument().addDocumentListener(new DocumentListener() { | 65 | textField.getDocument().addDocumentListener(new DocumentListener() { |
61 | 66 | ||
62 | @Override | 67 | @Override |
63 | public void changedUpdate(DocumentEvent e) { | 68 | public void changedUpdate(DocumentEvent e) { |
64 | - listener.onServiceUpdated(); | 69 | + listener.onServiceListUpdated(); |
65 | } | 70 | } |
66 | 71 | ||
67 | @Override | 72 | @Override |
68 | public void insertUpdate(DocumentEvent e) { | 73 | public void insertUpdate(DocumentEvent e) { |
69 | - listener.onServiceUpdated(); | 74 | + listener.onServiceListUpdated(); |
70 | } | 75 | } |
71 | 76 | ||
72 | @Override | 77 | @Override |
73 | public void removeUpdate(DocumentEvent e) { | 78 | public void removeUpdate(DocumentEvent e) { |
74 | - listener.onServiceUpdated(); | 79 | + listener.onServiceListUpdated(); |
75 | } | 80 | } |
76 | }); | 81 | }); |
77 | } | 82 | } |
src/test/java/eu/omp/irap/vespa/epntapclient/granule/GranuleCtrlTest.java
@@ -32,28 +32,23 @@ import eu.omp.irap.vespa.votable.votabledata.VoTableDataTest; | @@ -32,28 +32,23 @@ import eu.omp.irap.vespa.votable.votabledata.VoTableDataTest; | ||
32 | */ | 32 | */ |
33 | public class GranuleCtrlTest { | 33 | public class GranuleCtrlTest { |
34 | 34 | ||
35 | + /** The granule controller, initialized with {@link VoTableDataTest#createVoTableData()}. */ | ||
35 | GranuleCtrl granuleCtrl; | 36 | GranuleCtrl granuleCtrl; |
36 | 37 | ||
37 | 38 | ||
39 | + /** | ||
40 | + * Constructor of GranuleCtrlTest. | ||
41 | + */ | ||
38 | public GranuleCtrlTest() { | 42 | public GranuleCtrlTest() { |
39 | granuleCtrl = new GranuleCtrl(VoTableDataTest.createVoTableData()); | 43 | granuleCtrl = new GranuleCtrl(VoTableDataTest.createVoTableData()); |
40 | } | 44 | } |
41 | 45 | ||
46 | + /** | ||
47 | + * Test the method {@link GranuleCtrl#getGranuleFromVOTableRow(int)} by comparing the granules | ||
48 | + * with voTableData. | ||
49 | + */ | ||
42 | @Test | 50 | @Test |
43 | - public void getGranulesTest() { | ||
44 | - List<Granule> granules = null; | ||
45 | - try { | ||
46 | - granules = granuleCtrl.getGranules(); | ||
47 | - } catch (CanNotParseDataException e) { | ||
48 | - fail("Can not parse granule: " + e.getMessage()); | ||
49 | - } | ||
50 | - assertNotNull(granules); | ||
51 | - assertTrue(granules.get(0).equals(GranuleTest.createGranule1())); | ||
52 | - assertTrue(granules.get(1).equals(GranuleTest.createGranule2())); | ||
53 | - } | ||
54 | - | ||
55 | - @Test | ||
56 | - public void parseStringTest() { | 51 | + public void getGranuleFromVOTableRowTest() { |
57 | Granule g1 = null; | 52 | Granule g1 = null; |
58 | Granule g2 = null; | 53 | Granule g2 = null; |
59 | try { | 54 | try { |
@@ -67,4 +62,20 @@ public class GranuleCtrlTest { | @@ -67,4 +62,20 @@ public class GranuleCtrlTest { | ||
67 | assertTrue(g1.equals(GranuleTest.createGranule1())); | 62 | assertTrue(g1.equals(GranuleTest.createGranule1())); |
68 | assertTrue(g2.equals(GranuleTest.createGranule2())); | 63 | assertTrue(g2.equals(GranuleTest.createGranule2())); |
69 | } | 64 | } |
65 | + | ||
66 | + /** | ||
67 | + * Test the method {@link GranuleCtrl#getGranules()} by comparing the granules with voTableData. | ||
68 | + */ | ||
69 | + @Test | ||
70 | + public void getGranulesTest() { | ||
71 | + List<Granule> granules = null; | ||
72 | + try { | ||
73 | + granules = granuleCtrl.getGranules(); | ||
74 | + } catch (CanNotParseDataException e) { | ||
75 | + fail("Can not parse granule: " + e.getMessage()); | ||
76 | + } | ||
77 | + assertNotNull(granules); | ||
78 | + assertTrue(granules.get(0).equals(GranuleTest.createGranule1())); | ||
79 | + assertTrue(granules.get(1).equals(GranuleTest.createGranule2())); | ||
80 | + } | ||
70 | } | 81 | } |
src/test/java/eu/omp/irap/vespa/epntapclient/granule/GranuleTest.java
@@ -27,6 +27,8 @@ import java.util.logging.Logger; | @@ -27,6 +27,8 @@ import java.util.logging.Logger; | ||
27 | 27 | ||
28 | import org.junit.Test; | 28 | import org.junit.Test; |
29 | 29 | ||
30 | +import eu.omp.irap.vespa.votable.votabledata.VoTableDataTest; | ||
31 | + | ||
30 | /** | 32 | /** |
31 | * @author N. Jourdane | 33 | * @author N. Jourdane |
32 | */ | 34 | */ |
@@ -36,6 +38,12 @@ public class GranuleTest { | @@ -36,6 +38,12 @@ public class GranuleTest { | ||
36 | private static final Logger LOGGER = Logger.getLogger(GranuleTest.class.getName()); | 38 | private static final Logger LOGGER = Logger.getLogger(GranuleTest.class.getName()); |
37 | 39 | ||
38 | 40 | ||
41 | + /** | ||
42 | + * Create a granule for tests purposes. It is planetary data for Uranus, got from an actual ADQL | ||
43 | + * query, exactly the same content that {@link VoTableDataTest#createDataArray1()} | ||
44 | + * | ||
45 | + * @return The granule. | ||
46 | + */ | ||
39 | public static Granule createGranule1() { | 47 | public static Granule createGranule1() { |
40 | Date testDate = null; | 48 | Date testDate = null; |
41 | try { | 49 | try { |
@@ -91,6 +99,12 @@ public class GranuleTest { | @@ -91,6 +99,12 @@ public class GranuleTest { | ||
91 | return completeGranule; | 99 | return completeGranule; |
92 | } | 100 | } |
93 | 101 | ||
102 | + /** | ||
103 | + * Create a granule for tests purposes. It is planetary data for Neptune, got from an actual | ||
104 | + * query, exactly the same content that {@link VoTableDataTest#createDataArray2()} | ||
105 | + * | ||
106 | + * @return The granule. | ||
107 | + */ | ||
94 | public static Granule createGranule2() { | 108 | public static Granule createGranule2() { |
95 | Date testDate = null; | 109 | Date testDate = null; |
96 | try { | 110 | try { |
@@ -146,18 +160,29 @@ public class GranuleTest { | @@ -146,18 +160,29 @@ public class GranuleTest { | ||
146 | return completeGranule; | 160 | return completeGranule; |
147 | } | 161 | } |
148 | 162 | ||
163 | + /** | ||
164 | + * Create an incomplete granule without many mandatory parameters, which is forbidden. | ||
165 | + * | ||
166 | + * @return the granule. | ||
167 | + */ | ||
149 | public static Granule createIncompleteGranule() { | 168 | public static Granule createIncompleteGranule() { |
150 | Granule incompleteGranule = new Granule("Mercury"); | 169 | Granule incompleteGranule = new Granule("Mercury"); |
151 | incompleteGranule.setGranuleGid("Planet"); | 170 | incompleteGranule.setGranuleGid("Planet"); |
152 | return incompleteGranule; | 171 | return incompleteGranule; |
153 | } | 172 | } |
154 | 173 | ||
174 | + /** | ||
175 | + * Test if the incomplete granule appears like not valid. | ||
176 | + */ | ||
155 | @SuppressWarnings("static-method") // Otherwise JUnit doesn't work. | 177 | @SuppressWarnings("static-method") // Otherwise JUnit doesn't work. |
156 | @Test | 178 | @Test |
157 | public void isNotValidTest() { | 179 | public void isNotValidTest() { |
158 | assertFalse("The incomplete granule is valid.", createIncompleteGranule().isValid()); | 180 | assertFalse("The incomplete granule is valid.", createIncompleteGranule().isValid()); |
159 | } | 181 | } |
160 | 182 | ||
183 | + /** | ||
184 | + * Test if a complete granule appears like valid. | ||
185 | + */ | ||
161 | @SuppressWarnings("static-method") // Otherwise JUnit doesn't work. | 186 | @SuppressWarnings("static-method") // Otherwise JUnit doesn't work. |
162 | @Test | 187 | @Test |
163 | public void isValidTest() { | 188 | public void isValidTest() { |