Ejemplo n.º 1
0
 /**
  * Tests the {@link FormatTable#getEntry} and {@link FormatTable#getEntries} methods.
  *
  * @throws SQLException If the test can't connect to the database.
  */
 @Test
 public void testSelectAndList() throws SQLException {
   final FormatTable table = getDatabase().getTable(FormatTable.class);
   final FormatEntry entry = table.getEntry(TEMPERATURE);
   assertEquals("Unexpected format read from the database.", TEMPERATURE, entry.identifier);
   assertSame("Expected the cached instance.", entry, table.getEntry(TEMPERATURE));
   assertEquals("Wrong image format.", "PNG", entry.imageFormat);
   assertEquals("Wrong color palette.", "rainbow", entry.paletteName);
   /*
    * Check the sample dimensions.
    */
   final List<GridSampleDimension> bands = entry.sampleDimensions;
   SampleDimensionTableTest.checkTemperatureDimension(bands.toArray(new GridSampleDimension[0]));
   /*
    * Ask for every format, and ensure that our instance is in the list.
    */
   table.setImageFormats(entry.getImageFormats());
   final Set<FormatEntry> entries = table.getEntries();
   assertFalse(entries.isEmpty());
   assertTrue(entries.contains(entry));
   table.release();
 }
Ejemplo n.º 2
0
 /**
  * Tests a for an entry having two bands
  *
  * @throws SQLException If the test can't connect to the database.
  */
 @Test
 public void testTwoBands() throws SQLException {
   final FormatTable table = getDatabase().getTable(FormatTable.class);
   final FormatEntry entry = table.getEntry(CURRENT);
   assertEquals("Unexpected format read from the database.", CURRENT, entry.identifier);
   assertSame("Expected the cached instance.", entry, table.getEntry(CURRENT));
   assertEquals("Wrong image format.", "NetCDF", entry.imageFormat);
   assertEquals("Wrong color palette.", "white-cyan-red", entry.paletteName);
   /*
    * Check the sample dimensions.
    */
   final List<GridSampleDimension> bands = entry.sampleDimensions;
   assertEquals(2, bands.size());
   assertFalse(bands.get(0).equals(bands.get(1)));
   /*
    * Ask for every format, and ensure that our instance is in the list.
    */
   table.setImageFormats(entry.getImageFormats());
   final Set<FormatEntry> entries = table.getEntries();
   assertFalse(entries.isEmpty());
   assertTrue(entries.contains(entry));
   table.release();
 }