@Test public void testMain() throws Exception { final String[] noArg = new String[]{}; try { App.main(noArg); } catch (Exception e) { Assert.fail("Main method fails!"); } }
public static void main(String[] args) throws Exception { final InputStream properties = Thread.currentThread().getContextClassLoader() .getResourceAsStream("aws.properties"); final AWSCredentials propertiesCredentials = new PropertiesCredentials(properties); final AmazonDynamoDB amazonDynamoDb = new AmazonDynamoDBClient(propertiesCredentials); amazonDynamoDb.setRegion(Region.getRegion(Regions.US_WEST_2)); final DynamoDBMapper dynamoDBMapper = new DynamoDBMapper(amazonDynamoDb); final UserRepository userRepository = new UserRepositoryImpl(dynamoDBMapper); final User user = new User(); user.setUsername("bhdrkn"); user.setEmail("bhdrkn@gmail.com"); user.setPassword("1q2w3e"); userRepository.put(user); final User readUser = userRepository.get("bhdrkn"); assert user.equals(readUser); final List<User> users = userRepository.findAll(); assert users.contains(user); final List<User> findUsers = userRepository.findByEmail("bhdrkn@gmail.com"); assert findUsers.contains(user); final List<User> notFound = userRepository.findByEmail("asdf"); assert notFound.isEmpty(); userRepository.delete("bhdrkn"); final List<User> all = userRepository.findAll(); assert all.isEmpty(); System.out.println("Finished!"); }
App { public static void main(String[] args) throws Exception { final InputStream properties = Thread.currentThread().getContextClassLoader() .getResourceAsStream("aws.properties"); final AWSCredentials propertiesCredentials = new PropertiesCredentials(properties); final AmazonDynamoDB amazonDynamoDb = new AmazonDynamoDBClient(propertiesCredentials); amazonDynamoDb.setRegion(Region.getRegion(Regions.US_WEST_2)); final DynamoDBMapper dynamoDBMapper = new DynamoDBMapper(amazonDynamoDb); final UserRepository userRepository = new UserRepositoryImpl(dynamoDBMapper); final User user = new User(); user.setUsername("bhdrkn"); user.setEmail("bhdrkn@gmail.com"); user.setPassword("1q2w3e"); userRepository.put(user); final User readUser = userRepository.get("bhdrkn"); assert user.equals(readUser); final List<User> users = userRepository.findAll(); assert users.contains(user); final List<User> findUsers = userRepository.findByEmail("bhdrkn@gmail.com"); assert findUsers.contains(user); final List<User> notFound = userRepository.findByEmail("asdf"); assert notFound.isEmpty(); userRepository.delete("bhdrkn"); final List<User> all = userRepository.findAll(); assert all.isEmpty(); System.out.println("Finished!"); } }
App { public static void main(String[] args) throws Exception { final InputStream properties = Thread.currentThread().getContextClassLoader() .getResourceAsStream("aws.properties"); final AWSCredentials propertiesCredentials = new PropertiesCredentials(properties); final AmazonDynamoDB amazonDynamoDb = new AmazonDynamoDBClient(propertiesCredentials); amazonDynamoDb.setRegion(Region.getRegion(Regions.US_WEST_2)); final DynamoDBMapper dynamoDBMapper = new DynamoDBMapper(amazonDynamoDb); final UserRepository userRepository = new UserRepositoryImpl(dynamoDBMapper); final User user = new User(); user.setUsername("bhdrkn"); user.setEmail("bhdrkn@gmail.com"); user.setPassword("1q2w3e"); userRepository.put(user); final User readUser = userRepository.get("bhdrkn"); assert user.equals(readUser); final List<User> users = userRepository.findAll(); assert users.contains(user); final List<User> findUsers = userRepository.findByEmail("bhdrkn@gmail.com"); assert findUsers.contains(user); final List<User> notFound = userRepository.findByEmail("asdf"); assert notFound.isEmpty(); userRepository.delete("bhdrkn"); final List<User> all = userRepository.findAll(); assert all.isEmpty(); System.out.println("Finished!"); } private  App(); }
App { public static void main(String[] args) throws Exception { final InputStream properties = Thread.currentThread().getContextClassLoader() .getResourceAsStream("aws.properties"); final AWSCredentials propertiesCredentials = new PropertiesCredentials(properties); final AmazonDynamoDB amazonDynamoDb = new AmazonDynamoDBClient(propertiesCredentials); amazonDynamoDb.setRegion(Region.getRegion(Regions.US_WEST_2)); final DynamoDBMapper dynamoDBMapper = new DynamoDBMapper(amazonDynamoDb); final UserRepository userRepository = new UserRepositoryImpl(dynamoDBMapper); final User user = new User(); user.setUsername("bhdrkn"); user.setEmail("bhdrkn@gmail.com"); user.setPassword("1q2w3e"); userRepository.put(user); final User readUser = userRepository.get("bhdrkn"); assert user.equals(readUser); final List<User> users = userRepository.findAll(); assert users.contains(user); final List<User> findUsers = userRepository.findByEmail("bhdrkn@gmail.com"); assert findUsers.contains(user); final List<User> notFound = userRepository.findByEmail("asdf"); assert notFound.isEmpty(); userRepository.delete("bhdrkn"); final List<User> all = userRepository.findAll(); assert all.isEmpty(); System.out.println("Finished!"); } private  App(); static void main(String[] args); }
App { public static void main(String[] args) throws Exception { final InputStream properties = Thread.currentThread().getContextClassLoader() .getResourceAsStream("aws.properties"); final AWSCredentials propertiesCredentials = new PropertiesCredentials(properties); final AmazonDynamoDB amazonDynamoDb = new AmazonDynamoDBClient(propertiesCredentials); amazonDynamoDb.setRegion(Region.getRegion(Regions.US_WEST_2)); final DynamoDBMapper dynamoDBMapper = new DynamoDBMapper(amazonDynamoDb); final UserRepository userRepository = new UserRepositoryImpl(dynamoDBMapper); final User user = new User(); user.setUsername("bhdrkn"); user.setEmail("bhdrkn@gmail.com"); user.setPassword("1q2w3e"); userRepository.put(user); final User readUser = userRepository.get("bhdrkn"); assert user.equals(readUser); final List<User> users = userRepository.findAll(); assert users.contains(user); final List<User> findUsers = userRepository.findByEmail("bhdrkn@gmail.com"); assert findUsers.contains(user); final List<User> notFound = userRepository.findByEmail("asdf"); assert notFound.isEmpty(); userRepository.delete("bhdrkn"); final List<User> all = userRepository.findAll(); assert all.isEmpty(); System.out.println("Finished!"); } private  App(); static void main(String[] args);  }