public void testGetCreatedAt() { Definition def = new Definition(user, DataForTests.definition); try { assertEquals("Definition string not set correctly", def.get(), DataForTests.definition); } catch (EInvalidData e1) { fail("EInvalidData: " + e1.getMessage()); } try { Date d = def.getCreatedAt(); assertNotNull(d); } catch (EInvalidData e) { fail("InvalidData: " + e.getMessage()); } catch (EAccessDenied e) { fail("AccessDenied: " + e.getMessage()); } }
public static void main(String[] args) { try { // step 1 - create a user object for authentication User user = new User(Config.username, Config.api_key); // step 2 - create a definition Definition def = user.createDefinition( "interaction.type == \"twitter\" and (interaction.content contains \"music\")"); // step 3 - make the request to have our csdl compiled def.compile(); System.out.println("Hash: " + def.getHash()); System.out.println("Created at: " + def.getCreatedAt()); System.out.println("Total cost: " + def.getTotalDPU()); } catch (Exception ex) { System.err.println(); Logger.getLogger("net.datasift.example") .log(Level.WARNING, "An error occured: " + ex.getMessage()); } }