ISO8601DateFormat df = new ISO8601DateFormat(); Date d = df.parse("2010-07-28T22:25:51Z");
public void removeLink(Pair<T, T> link) { removeLink(link.getFirst(), link.getSecond()); }
/** * Removes all temporary files created before the given time. * <p> * The delete will cascade down through directories as well. * * @param removeBefore only remove files created <b>before</b> this time * @return Returns the number of files removed */ public static int removeFiles(long removeBefore) { File tempDir = TempFileProvider.getTempDir(); return removeFiles(tempDir, removeBefore, removeBefore, false); }
/** * Construct the canned query given the original parameters applied. * <p/> * A random GUID query execution ID will be generated. * * @param parameters the original query parameters */ protected AbstractCannedQuery(CannedQueryParameters parameters) { ParameterCheck.mandatory("parameters", parameters); this.parameters = parameters; this.queryExecutionId = GUID.generate(); }
/** * Ensures that single, immutable values are cloned before being given out * without affecting the backing storage */ public void testMapGetMutable() { TestMutable mutable = (TestMutable) map.get("MUTABLE"); assertFalse("Mutable value instance incorrect", mutable == valueMutable); checkMaps(false); // Modify the instance mutable.increment(); assertEquals("Backing mutable should not have changed: ", 0, valueMutable.i); }
public void testMapContainsValue() { assertTrue(map.containsValue(valueMutable)); assertFalse(map.containsValue("Dassie")); checkMaps(false); }
public void testMapClear() { map.clear(); assertEquals("Map should be empty: ", 0, map.size()); checkMaps(true); }
/** * No matter how many times we wrap instances in instances, the backing map must remain * the same. */ public void testMapWrapping() { ValueProtectingMap<String, Serializable> mapTwo = new ValueProtectingMap<String, Serializable>(map); assertTrue("Backing map must be shared: ", mapTwo.getProtectedMap() == map.getProtectedMap()); ValueProtectingMap<String, Serializable> mapThree = new ValueProtectingMap<String, Serializable>(map); assertTrue("Backing map must be shared: ", mapThree.getProtectedMap() == map.getProtectedMap()); }
public void testMapContainsKey() { assertTrue(map.containsKey("LIST")); assertFalse(map.containsKey("LISTXXX")); checkMaps(false); }
public void testMapIsEmpty() { assertFalse(map.isEmpty()); checkMaps(false); }
/** * Ensures that single, immutable values are given out as-is and * without affecting the backing storage */ public void testMapGetImmutable() { assertTrue("Immutable value instance incorrect", map.get("IMMUTABLE") == valueImmutable); checkMaps(false); }
@Configuration public class Cfg { public ExecutorService executorService() { return executorServiceFactoryBean().getObject(); } @Bean public ThreadPoolExecutorFactoryBean executorServiceFactoryBean() { return new ThreadPoolExecutorFactoryBean(); } }
public void testGetValidFileName() { // " * \ > < ? / : | . assertEquals("ABCDEFG.txt", FileNameValidator.getValidFileName("ABCDEFG.txt")); assertEquals("A_B_C_D_E_F_G_H_I_J.txt", FileNameValidator.getValidFileName("A\"B*C\\D>E<F?G/H:I|J.txt")); assertEquals("A_B_C_D_E_F_G_H_I_J_", FileNameValidator.getValidFileName("A\"B*C\\D>E<F?G/H:I|J.")); assertEquals("A dot in the end is not permitted_", FileNameValidator.getValidFileName("A dot in the end is not permitted.")); assertEquals("Dots in the end are not permitted..._", FileNameValidator.getValidFileName("Dots in the end are not permitted....")); assertEquals(".Dots.are.allowed.if. .not.at.the.end", FileNameValidator.getValidFileName(".Dots.are.allowed.if. .not.at.the.end")); assertEquals(" Spaces are permited ", FileNameValidator.getValidFileName(" Spaces are permited ")); } }
public void testValidator() { String [] badNames = { "\"", "\\", "/", "<", ">", "?", "*", ":", "|", "." }; for (String name : badNames) { assertFalse(FileNameValidator.isValid(name)); } }
public void testToZulu(){ String base = "2011-02-04T16:13:14.000"; String zulu = base + "Z"; String utc0 = base + "+00:00"; String utc1 = "2011-02-04T17:13:14" + "+01:00"; String utcMinus1 = "2011-02-04T15:13:14" + "-01:00"; assertEquals(zulu, ISO8601DateFormat.formatToZulu(zulu)); assertEquals(zulu, ISO8601DateFormat.formatToZulu(utc1)); assertEquals(zulu, ISO8601DateFormat.formatToZulu(utc0)); assertEquals(zulu, ISO8601DateFormat.formatToZulu(utcMinus1)); }