OlciProductFactory extends AbstractProductFactory { static String[] getForwardAndInverseKeys_pixelCoding() { final String[] codingNames = new String[2]; final Preferences preferences = Config.instance("s3tbx").preferences(); final boolean useFractAccuracy = preferences.getBoolean(SYSPROP_OLCI_USE_FRACTIONAL_ACCURACY, false); if (useFractAccuracy) { codingNames[0] = PixelInterpolatingForward.KEY; } else { codingNames[0] = preferences.get(SYSPROP_OLCI_PIXEL_CODING_FORWARD, PixelForward.KEY); } codingNames[1] = preferences.get(SYSPROP_OLCI_PIXEL_CODING_INVERSE, PixelQuadTreeInverse.KEY); return codingNames; } OlciProductFactory(Sentinel3ProductReader productReader);  final static String OLCI_USE_PIXELGEOCODING; }
@Test public void testGetForwardAndInverseKeys_pixelCoding_fractionalAccuracy() { final String fractionalAccuracy = System.getProperty(SYSPROP_OLCI_USE_FRACTIONAL_ACCURACY); try { System.setProperty(SYSPROP_OLCI_USE_FRACTIONAL_ACCURACY, "true"); final String[] codingKeys = OlciProductFactory.getForwardAndInverseKeys_pixelCoding(); assertEquals("FWD_PIXEL_INTERPOLATING", codingKeys[0]); assertEquals("INV_PIXEL_QUAD_TREE", codingKeys[1]); } finally { if (fractionalAccuracy != null) { System.setProperty(SYSPROP_OLCI_USE_FRACTIONAL_ACCURACY, fractionalAccuracy); } else { System.clearProperty(SYSPROP_OLCI_USE_FRACTIONAL_ACCURACY); } } }
@Test public void testGetForwardAndInverseKeys_pixelCoding_forwardCoding() { final String forwardKey = System.getProperty(SYSPROP_OLCI_PIXEL_CODING_FORWARD); try { System.setProperty(SYSPROP_OLCI_PIXEL_CODING_FORWARD, "hoppla"); final String[] codingKeys = OlciProductFactory.getForwardAndInverseKeys_pixelCoding(); assertEquals("hoppla", codingKeys[0]); assertEquals("INV_PIXEL_QUAD_TREE", codingKeys[1]); } finally { if (forwardKey != null) { System.setProperty(SYSPROP_OLCI_PIXEL_CODING_FORWARD, forwardKey); } else { System.clearProperty(SYSPROP_OLCI_PIXEL_CODING_FORWARD); } } }
@Test public void testGetForwardAndInverseKeys_pixelCoding_inverseCoding() { final String inverseKey = System.getProperty(SYSPROP_OLCI_PIXEL_CODING_INVERSE); try { System.setProperty(SYSPROP_OLCI_PIXEL_CODING_INVERSE, "jippie"); final String[] codingKeys = OlciProductFactory.getForwardAndInverseKeys_pixelCoding(); assertEquals("FWD_PIXEL", codingKeys[0]); assertEquals("jippie", codingKeys[1]); } finally { if (inverseKey != null) { System.setProperty(SYSPROP_OLCI_PIXEL_CODING_INVERSE, inverseKey); } else { System.clearProperty(SYSPROP_OLCI_PIXEL_CODING_INVERSE); } } }
@Test public void testGetForwardAndInverseKeys_pixelCoding_default() { final String forwardKey = System.getProperty(SYSPROP_OLCI_PIXEL_CODING_FORWARD); final String inverseKey = System.getProperty(SYSPROP_OLCI_PIXEL_CODING_INVERSE); final String fractionalAccuracy = System.getProperty(SYSPROP_OLCI_USE_FRACTIONAL_ACCURACY); try { System.clearProperty(SYSPROP_OLCI_PIXEL_CODING_INVERSE); System.clearProperty(SYSPROP_OLCI_PIXEL_CODING_FORWARD); System.clearProperty(SYSPROP_OLCI_USE_FRACTIONAL_ACCURACY); final String[] codingKeys = OlciProductFactory.getForwardAndInverseKeys_pixelCoding(); assertEquals("FWD_PIXEL", codingKeys[0]); assertEquals("INV_PIXEL_QUAD_TREE", codingKeys[1]); } finally { if (forwardKey != null) { System.setProperty(SYSPROP_OLCI_PIXEL_CODING_FORWARD, forwardKey); } if (inverseKey != null) { System.setProperty(SYSPROP_OLCI_PIXEL_CODING_INVERSE, inverseKey); } if (fractionalAccuracy != null) { System.setProperty(SYSPROP_OLCI_USE_FRACTIONAL_ACCURACY, fractionalAccuracy); } } }