target
stringlengths
20
113k
src_fm
stringlengths
11
86.3k
src_fm_fc
stringlengths
21
86.4k
src_fm_fc_co
stringlengths
30
86.4k
src_fm_fc_ms
stringlengths
42
86.8k
src_fm_fc_ms_ff
stringlengths
43
86.8k
@Test public void testCreateEntityWithValidEntity(){ MockMutationExecuterFactory mutationExecutionFactory = new MockMutationExecuterFactory(); GraphMutation graphMutation = new GraphMutation(mutationExecutionFactory); TartanImplTestUtil util = new TartanImplTestUtil(); NewEntity newEntity = util.createNewEntity(TartanI...
@Override public BatchMutation createEntity(NewEntity newEntity) { Preconditions.argumentNotNull(newEntity, "newEntity"); CreateEntity createEntity = new CreateEntity(newEntity); pipeline.add(createEntity); return this; }
GraphMutation implements BatchMutation { @Override public BatchMutation createEntity(NewEntity newEntity) { Preconditions.argumentNotNull(newEntity, "newEntity"); CreateEntity createEntity = new CreateEntity(newEntity); pipeline.add(createEntity); return this; } }
GraphMutation implements BatchMutation { @Override public BatchMutation createEntity(NewEntity newEntity) { Preconditions.argumentNotNull(newEntity, "newEntity"); CreateEntity createEntity = new CreateEntity(newEntity); pipeline.add(createEntity); return this; } @Inject GraphMutation(MutationExecutorFactory factory); ...
GraphMutation implements BatchMutation { @Override public BatchMutation createEntity(NewEntity newEntity) { Preconditions.argumentNotNull(newEntity, "newEntity"); CreateEntity createEntity = new CreateEntity(newEntity); pipeline.add(createEntity); return this; } @Inject GraphMutation(MutationExecutorFactory factory); ...
GraphMutation implements BatchMutation { @Override public BatchMutation createEntity(NewEntity newEntity) { Preconditions.argumentNotNull(newEntity, "newEntity"); CreateEntity createEntity = new CreateEntity(newEntity); pipeline.add(createEntity); return this; } @Inject GraphMutation(MutationExecutorFactory factory); ...
@Test public void testCreateRelationshipWithNullRelationship(){ MockMutationExecuterFactory mutationExecutionFactory = new MockMutationExecuterFactory(); GraphMutation graphMutation = new GraphMutation(mutationExecutionFactory); try{ graphMutation.createRelationship(null); fail("Should have thrown an exception with nul...
@Override public BatchMutation createRelationship(NewRelationship newRelationship) { Preconditions.argumentNotNull(newRelationship, "newRelationship"); CreateRelationship createRelationships = new CreateRelationship( newRelationship); pipeline.add(createRelationships); return this; }
GraphMutation implements BatchMutation { @Override public BatchMutation createRelationship(NewRelationship newRelationship) { Preconditions.argumentNotNull(newRelationship, "newRelationship"); CreateRelationship createRelationships = new CreateRelationship( newRelationship); pipeline.add(createRelationships); return th...
GraphMutation implements BatchMutation { @Override public BatchMutation createRelationship(NewRelationship newRelationship) { Preconditions.argumentNotNull(newRelationship, "newRelationship"); CreateRelationship createRelationships = new CreateRelationship( newRelationship); pipeline.add(createRelationships); return th...
GraphMutation implements BatchMutation { @Override public BatchMutation createRelationship(NewRelationship newRelationship) { Preconditions.argumentNotNull(newRelationship, "newRelationship"); CreateRelationship createRelationships = new CreateRelationship( newRelationship); pipeline.add(createRelationships); return th...
GraphMutation implements BatchMutation { @Override public BatchMutation createRelationship(NewRelationship newRelationship) { Preconditions.argumentNotNull(newRelationship, "newRelationship"); CreateRelationship createRelationships = new CreateRelationship( newRelationship); pipeline.add(createRelationships); return th...
@Test public void testCreateRelationshipWithValidRelationship(){ TartanImplTestUtil util = new TartanImplTestUtil(); NewEntity sourceEntity = util.createNewEntity(TartanImplTestConstants.ATTR_CHILD_KEY); NewEntity targetEntity = util.createNewEntity(TartanImplTestConstants.ATTR_PARENT_KEY); NewRelationship newRelations...
@Override public BatchMutation createRelationship(NewRelationship newRelationship) { Preconditions.argumentNotNull(newRelationship, "newRelationship"); CreateRelationship createRelationships = new CreateRelationship( newRelationship); pipeline.add(createRelationships); return this; }
GraphMutation implements BatchMutation { @Override public BatchMutation createRelationship(NewRelationship newRelationship) { Preconditions.argumentNotNull(newRelationship, "newRelationship"); CreateRelationship createRelationships = new CreateRelationship( newRelationship); pipeline.add(createRelationships); return th...
GraphMutation implements BatchMutation { @Override public BatchMutation createRelationship(NewRelationship newRelationship) { Preconditions.argumentNotNull(newRelationship, "newRelationship"); CreateRelationship createRelationships = new CreateRelationship( newRelationship); pipeline.add(createRelationships); return th...
GraphMutation implements BatchMutation { @Override public BatchMutation createRelationship(NewRelationship newRelationship) { Preconditions.argumentNotNull(newRelationship, "newRelationship"); CreateRelationship createRelationships = new CreateRelationship( newRelationship); pipeline.add(createRelationships); return th...
GraphMutation implements BatchMutation { @Override public BatchMutation createRelationship(NewRelationship newRelationship) { Preconditions.argumentNotNull(newRelationship, "newRelationship"); CreateRelationship createRelationships = new CreateRelationship( newRelationship); pipeline.add(createRelationships); return th...
@Test public void testExecute(){ MockMutationExecuterFactory mutationExecutionFactory = new MockMutationExecuterFactory(); GraphMutation graphMutation = new GraphMutation(mutationExecutionFactory); OperationResult<Result> execute = graphMutation.execute(); assertNotNull(execute); }
@Override public OperationResult<Result> execute() { return () -> (GraphMutationResult) graphOperation.operationResult(); }
GraphMutation implements BatchMutation { @Override public OperationResult<Result> execute() { return () -> (GraphMutationResult) graphOperation.operationResult(); } }
GraphMutation implements BatchMutation { @Override public OperationResult<Result> execute() { return () -> (GraphMutationResult) graphOperation.operationResult(); } @Inject GraphMutation(MutationExecutorFactory factory); }
GraphMutation implements BatchMutation { @Override public OperationResult<Result> execute() { return () -> (GraphMutationResult) graphOperation.operationResult(); } @Inject GraphMutation(MutationExecutorFactory factory); @Override BatchMutation createEntity(NewEntity newEntity); @Override BatchMutation createRelations...
GraphMutation implements BatchMutation { @Override public OperationResult<Result> execute() { return () -> (GraphMutationResult) graphOperation.operationResult(); } @Inject GraphMutation(MutationExecutorFactory factory); @Override BatchMutation createEntity(NewEntity newEntity); @Override BatchMutation createRelations...
@Test public void testWithEntityWhenEntityIsNull(){ MockMutationExecuterFactory mutationExecutionFactory = new MockMutationExecuterFactory(); GraphMutation graphMutation = new GraphMutation(mutationExecutionFactory); try{ graphMutation.withEntity(null); fail("Should have thrown an exception with null entity"); }catch(E...
@Override public Entity.Mutation withEntity(Entity entity) { Preconditions.argumentNotNull(entity, "entity"); return new GraphEntityMutation(entity, pipeline, this); }
GraphMutation implements BatchMutation { @Override public Entity.Mutation withEntity(Entity entity) { Preconditions.argumentNotNull(entity, "entity"); return new GraphEntityMutation(entity, pipeline, this); } }
GraphMutation implements BatchMutation { @Override public Entity.Mutation withEntity(Entity entity) { Preconditions.argumentNotNull(entity, "entity"); return new GraphEntityMutation(entity, pipeline, this); } @Inject GraphMutation(MutationExecutorFactory factory); }
GraphMutation implements BatchMutation { @Override public Entity.Mutation withEntity(Entity entity) { Preconditions.argumentNotNull(entity, "entity"); return new GraphEntityMutation(entity, pipeline, this); } @Inject GraphMutation(MutationExecutorFactory factory); @Override BatchMutation createEntity(NewEntity newEnti...
GraphMutation implements BatchMutation { @Override public Entity.Mutation withEntity(Entity entity) { Preconditions.argumentNotNull(entity, "entity"); return new GraphEntityMutation(entity, pipeline, this); } @Inject GraphMutation(MutationExecutorFactory factory); @Override BatchMutation createEntity(NewEntity newEnti...
@Test public void testWithEntityWhenEntityIsNotNull(){ MockMutationExecuterFactory mutationExecutionFactory = new MockMutationExecuterFactory(); GraphMutation graphMutation = new GraphMutation(mutationExecutionFactory); Mutation withEntity = graphMutation.withEntity(buildEntity()); assertNotNull(withEntity); }
@Override public Entity.Mutation withEntity(Entity entity) { Preconditions.argumentNotNull(entity, "entity"); return new GraphEntityMutation(entity, pipeline, this); }
GraphMutation implements BatchMutation { @Override public Entity.Mutation withEntity(Entity entity) { Preconditions.argumentNotNull(entity, "entity"); return new GraphEntityMutation(entity, pipeline, this); } }
GraphMutation implements BatchMutation { @Override public Entity.Mutation withEntity(Entity entity) { Preconditions.argumentNotNull(entity, "entity"); return new GraphEntityMutation(entity, pipeline, this); } @Inject GraphMutation(MutationExecutorFactory factory); }
GraphMutation implements BatchMutation { @Override public Entity.Mutation withEntity(Entity entity) { Preconditions.argumentNotNull(entity, "entity"); return new GraphEntityMutation(entity, pipeline, this); } @Inject GraphMutation(MutationExecutorFactory factory); @Override BatchMutation createEntity(NewEntity newEnti...
GraphMutation implements BatchMutation { @Override public Entity.Mutation withEntity(Entity entity) { Preconditions.argumentNotNull(entity, "entity"); return new GraphEntityMutation(entity, pipeline, this); } @Inject GraphMutation(MutationExecutorFactory factory); @Override BatchMutation createEntity(NewEntity newEnti...
@Test public void testWithRelationshipWhenRelationshipIsNull(){ MockMutationExecuterFactory mutationExecutionFactory = new MockMutationExecuterFactory(); GraphMutation graphMutation = new GraphMutation(mutationExecutionFactory); try{ graphMutation.withRelationship(null); fail("Should have thrown an exception with null ...
@Override public Relationship.Mutation withRelationship(Relationship relationship) { Preconditions.argumentNotNull(relationship, "relationship"); return new GraphRelationshipMutation(relationship, pipeline, this); }
GraphMutation implements BatchMutation { @Override public Relationship.Mutation withRelationship(Relationship relationship) { Preconditions.argumentNotNull(relationship, "relationship"); return new GraphRelationshipMutation(relationship, pipeline, this); } }
GraphMutation implements BatchMutation { @Override public Relationship.Mutation withRelationship(Relationship relationship) { Preconditions.argumentNotNull(relationship, "relationship"); return new GraphRelationshipMutation(relationship, pipeline, this); } @Inject GraphMutation(MutationExecutorFactory factory); }
GraphMutation implements BatchMutation { @Override public Relationship.Mutation withRelationship(Relationship relationship) { Preconditions.argumentNotNull(relationship, "relationship"); return new GraphRelationshipMutation(relationship, pipeline, this); } @Inject GraphMutation(MutationExecutorFactory factory); @Overr...
GraphMutation implements BatchMutation { @Override public Relationship.Mutation withRelationship(Relationship relationship) { Preconditions.argumentNotNull(relationship, "relationship"); return new GraphRelationshipMutation(relationship, pipeline, this); } @Inject GraphMutation(MutationExecutorFactory factory); @Overr...
@Test public void testWithRelationshipWhenRelationshipIsNotNull(){ MockMutationExecuterFactory mutationExecutionFactory = new MockMutationExecuterFactory(); GraphMutation graphMutation = new GraphMutation(mutationExecutionFactory); TartanImplTestUtil util = new TartanImplTestUtil(); Entity.ID sourceEntityID = Entity.ID...
@Override public Relationship.Mutation withRelationship(Relationship relationship) { Preconditions.argumentNotNull(relationship, "relationship"); return new GraphRelationshipMutation(relationship, pipeline, this); }
GraphMutation implements BatchMutation { @Override public Relationship.Mutation withRelationship(Relationship relationship) { Preconditions.argumentNotNull(relationship, "relationship"); return new GraphRelationshipMutation(relationship, pipeline, this); } }
GraphMutation implements BatchMutation { @Override public Relationship.Mutation withRelationship(Relationship relationship) { Preconditions.argumentNotNull(relationship, "relationship"); return new GraphRelationshipMutation(relationship, pipeline, this); } @Inject GraphMutation(MutationExecutorFactory factory); }
GraphMutation implements BatchMutation { @Override public Relationship.Mutation withRelationship(Relationship relationship) { Preconditions.argumentNotNull(relationship, "relationship"); return new GraphRelationshipMutation(relationship, pipeline, this); } @Inject GraphMutation(MutationExecutorFactory factory); @Overr...
GraphMutation implements BatchMutation { @Override public Relationship.Mutation withRelationship(Relationship relationship) { Preconditions.argumentNotNull(relationship, "relationship"); return new GraphRelationshipMutation(relationship, pipeline, this); } @Inject GraphMutation(MutationExecutorFactory factory); @Overr...
@Test public void testApplyToNullPredicates(){ StreamPredicate[] predicates = new StreamPredicate[1]; predicates[0] = new EqualToPredicate(); AndPredicate andPredicate = new AndPredicate(predicates); Collection<Attribute> attributes = Collections.emptyList(); assertFalse(andPredicate.apply(attributes)); }
@Override public boolean apply(Collection<Attribute> attributes) { for (StreamPredicate predicate : predicates) { if (!predicate.apply(attributes)){ return false; } } return true; }
AndPredicate implements StreamPredicate, CompoundPredicate { @Override public boolean apply(Collection<Attribute> attributes) { for (StreamPredicate predicate : predicates) { if (!predicate.apply(attributes)){ return false; } } return true; } }
AndPredicate implements StreamPredicate, CompoundPredicate { @Override public boolean apply(Collection<Attribute> attributes) { for (StreamPredicate predicate : predicates) { if (!predicate.apply(attributes)){ return false; } } return true; } AndPredicate(); AndPredicate(StreamPredicate... predicates); }
AndPredicate implements StreamPredicate, CompoundPredicate { @Override public boolean apply(Collection<Attribute> attributes) { for (StreamPredicate predicate : predicates) { if (!predicate.apply(attributes)){ return false; } } return true; } AndPredicate(); AndPredicate(StreamPredicate... predicates); @Override Strea...
AndPredicate implements StreamPredicate, CompoundPredicate { @Override public boolean apply(Collection<Attribute> attributes) { for (StreamPredicate predicate : predicates) { if (!predicate.apply(attributes)){ return false; } } return true; } AndPredicate(); AndPredicate(StreamPredicate... predicates); @Override Strea...
@Test public void test_setTemplateRootDir() throws Throwable { File templateRootDir = null; generator.setTemplateRootDir(templateRootDir); }
public void setTemplateRootDir(File templateRootDir) { setTemplateRootDirs(new File[] { templateRootDir }); }
Generator { public void setTemplateRootDir(File templateRootDir) { setTemplateRootDirs(new File[] { templateRootDir }); } }
Generator { public void setTemplateRootDir(File templateRootDir) { setTemplateRootDirs(new File[] { templateRootDir }); } Generator(); }
Generator { public void setTemplateRootDir(File templateRootDir) { setTemplateRootDirs(new File[] { templateRootDir }); } Generator(); void setTemplateRootDir(File templateRootDir); void setTemplateRootDir(String templateRootDir); void setTemplateRootDirs(File... templateRootDirs); void setTemplateRootDirs(String... te...
Generator { public void setTemplateRootDir(File templateRootDir) { setTemplateRootDirs(new File[] { templateRootDir }); } Generator(); void setTemplateRootDir(File templateRootDir); void setTemplateRootDir(String templateRootDir); void setTemplateRootDirs(File... templateRootDirs); void setTemplateRootDirs(String... te...
@Test public void test_addTemplateRootDir() throws Throwable { File f = new File("."); generator.addTemplateRootDir(f); }
public void addTemplateRootDir(File file) { templateRootDirs.add(file); }
Generator { public void addTemplateRootDir(File file) { templateRootDirs.add(file); } }
Generator { public void addTemplateRootDir(File file) { templateRootDirs.add(file); } Generator(); }
Generator { public void addTemplateRootDir(File file) { templateRootDirs.add(file); } Generator(); void setTemplateRootDir(File templateRootDir); void setTemplateRootDir(String templateRootDir); void setTemplateRootDirs(File... templateRootDirs); void setTemplateRootDirs(String... templateRootDirs); void addTemplateRoo...
Generator { public void addTemplateRootDir(File file) { templateRootDirs.add(file); } Generator(); void setTemplateRootDir(File templateRootDir); void setTemplateRootDir(String templateRootDir); void setTemplateRootDirs(File... templateRootDirs); void setTemplateRootDirs(String... templateRootDirs); void addTemplateRoo...
@Test public void test_setCopyBinaryFile() throws Throwable { boolean isCopyBinaryFile = true; generator.setCopyBinaryFile(isCopyBinaryFile); }
public void setCopyBinaryFile(boolean isCopyBinaryFile) { this.isCopyBinaryFile = isCopyBinaryFile; }
Generator { public void setCopyBinaryFile(boolean isCopyBinaryFile) { this.isCopyBinaryFile = isCopyBinaryFile; } }
Generator { public void setCopyBinaryFile(boolean isCopyBinaryFile) { this.isCopyBinaryFile = isCopyBinaryFile; } Generator(); }
Generator { public void setCopyBinaryFile(boolean isCopyBinaryFile) { this.isCopyBinaryFile = isCopyBinaryFile; } Generator(); void setTemplateRootDir(File templateRootDir); void setTemplateRootDir(String templateRootDir); void setTemplateRootDirs(File... templateRootDirs); void setTemplateRootDirs(String... templateRo...
Generator { public void setCopyBinaryFile(boolean isCopyBinaryFile) { this.isCopyBinaryFile = isCopyBinaryFile; } Generator(); void setTemplateRootDir(File templateRootDir); void setTemplateRootDir(String templateRootDir); void setTemplateRootDirs(File... templateRootDirs); void setTemplateRootDirs(String... templateRo...
@Test public void test_setTemplateRootDir() throws Throwable { File templateRootDir = null; generator.setTemplateRootDir(templateRootDir); }
public void setTemplateRootDir(File templateRootDir) { setTemplateRootDirs(new File[]{templateRootDir}); }
Generator { public void setTemplateRootDir(File templateRootDir) { setTemplateRootDirs(new File[]{templateRootDir}); } }
Generator { public void setTemplateRootDir(File templateRootDir) { setTemplateRootDirs(new File[]{templateRootDir}); } Generator(); }
Generator { public void setTemplateRootDir(File templateRootDir) { setTemplateRootDirs(new File[]{templateRootDir}); } Generator(); void setTemplateRootDir(File templateRootDir); void setTemplateRootDir(String templateRootDir); void setTemplateRootDirs(File... templateRootDirs); void setTemplateRootDirs(String... templ...
Generator { public void setTemplateRootDir(File templateRootDir) { setTemplateRootDirs(new File[]{templateRootDir}); } Generator(); void setTemplateRootDir(File templateRootDir); void setTemplateRootDir(String templateRootDir); void setTemplateRootDirs(File... templateRootDirs); void setTemplateRootDirs(String... templ...
@Test public void test_addTemplateRootDir() throws Throwable { File f = new File("."); generator.addTemplateRootDir(f); }
public void addTemplateRootDir(File file) { templateRootDirs.add(file); }
Generator { public void addTemplateRootDir(File file) { templateRootDirs.add(file); } }
Generator { public void addTemplateRootDir(File file) { templateRootDirs.add(file); } Generator(); }
Generator { public void addTemplateRootDir(File file) { templateRootDirs.add(file); } Generator(); void setTemplateRootDir(File templateRootDir); void setTemplateRootDir(String templateRootDir); void setTemplateRootDirs(File... templateRootDirs); void setTemplateRootDirs(String... templateRootDirs); void addTemplateRoo...
Generator { public void addTemplateRootDir(File file) { templateRootDirs.add(file); } Generator(); void setTemplateRootDir(File templateRootDir); void setTemplateRootDir(String templateRootDir); void setTemplateRootDirs(File... templateRootDirs); void setTemplateRootDirs(String... templateRootDirs); void addTemplateRoo...
@Test public void test_setCopyBinaryFile() throws Throwable { boolean isCopyBinaryFile = true; generator.setCopyBinaryFile(isCopyBinaryFile); }
public void setCopyBinaryFile(boolean isCopyBinaryFile) { this.isCopyBinaryFile = isCopyBinaryFile; }
Generator { public void setCopyBinaryFile(boolean isCopyBinaryFile) { this.isCopyBinaryFile = isCopyBinaryFile; } }
Generator { public void setCopyBinaryFile(boolean isCopyBinaryFile) { this.isCopyBinaryFile = isCopyBinaryFile; } Generator(); }
Generator { public void setCopyBinaryFile(boolean isCopyBinaryFile) { this.isCopyBinaryFile = isCopyBinaryFile; } Generator(); void setTemplateRootDir(File templateRootDir); void setTemplateRootDir(String templateRootDir); void setTemplateRootDirs(File... templateRootDirs); void setTemplateRootDirs(String... templateRo...
Generator { public void setCopyBinaryFile(boolean isCopyBinaryFile) { this.isCopyBinaryFile = isCopyBinaryFile; } Generator(); void setTemplateRootDir(File templateRootDir); void setTemplateRootDir(String templateRootDir); void setTemplateRootDirs(File... templateRootDirs); void setTemplateRootDirs(String... templateRo...
@Test public void saveCategory() throws Exception { Category category = new Category(); category.setName("java"); category.setParentId("0"); category.setHasParent(false); category.setCreateTime(new Date()); category.setUpdateTime(new Date()); categoryService.saveCategory(category); }
@Override public void saveCategory(Category category) { categoryRepository.save(category); }
CategoryServiceImpl implements CategoryService { @Override public void saveCategory(Category category) { categoryRepository.save(category); } }
CategoryServiceImpl implements CategoryService { @Override public void saveCategory(Category category) { categoryRepository.save(category); } }
CategoryServiceImpl implements CategoryService { @Override public void saveCategory(Category category) { categoryRepository.save(category); } @Override void saveCategory(Category category); @Override void insertCategories(Iterable<Category> iterable); @Override void deleteCategoryById(Long id); @Override void updateCa...
CategoryServiceImpl implements CategoryService { @Override public void saveCategory(Category category) { categoryRepository.save(category); } @Override void saveCategory(Category category); @Override void insertCategories(Iterable<Category> iterable); @Override void deleteCategoryById(Long id); @Override void updateCa...
@Test public void insertCategories() throws Exception { List<Category> list = new ArrayList<>(); for (int i=0;i<100;i++){ Category category = new Category(); category.setName("java"+i); category.setParentId("0"+i); category.setHasParent(false); category.setCreateTime(new Date()); category.setUpdateTime(new Date()); lis...
@Override public void insertCategories(Iterable<Category> iterable) { categoryRepository.save(iterable); }
CategoryServiceImpl implements CategoryService { @Override public void insertCategories(Iterable<Category> iterable) { categoryRepository.save(iterable); } }
CategoryServiceImpl implements CategoryService { @Override public void insertCategories(Iterable<Category> iterable) { categoryRepository.save(iterable); } }
CategoryServiceImpl implements CategoryService { @Override public void insertCategories(Iterable<Category> iterable) { categoryRepository.save(iterable); } @Override void saveCategory(Category category); @Override void insertCategories(Iterable<Category> iterable); @Override void deleteCategoryById(Long id); @Override...
CategoryServiceImpl implements CategoryService { @Override public void insertCategories(Iterable<Category> iterable) { categoryRepository.save(iterable); } @Override void saveCategory(Category category); @Override void insertCategories(Iterable<Category> iterable); @Override void deleteCategoryById(Long id); @Override...
@Test public void deleteCategoryById() throws Exception { categoryService.deleteCategoryById(100L); }
@Override public void deleteCategoryById(Long id) { categoryRepository.delete(id); }
CategoryServiceImpl implements CategoryService { @Override public void deleteCategoryById(Long id) { categoryRepository.delete(id); } }
CategoryServiceImpl implements CategoryService { @Override public void deleteCategoryById(Long id) { categoryRepository.delete(id); } }
CategoryServiceImpl implements CategoryService { @Override public void deleteCategoryById(Long id) { categoryRepository.delete(id); } @Override void saveCategory(Category category); @Override void insertCategories(Iterable<Category> iterable); @Override void deleteCategoryById(Long id); @Override void updateCategory(C...
CategoryServiceImpl implements CategoryService { @Override public void deleteCategoryById(Long id) { categoryRepository.delete(id); } @Override void saveCategory(Category category); @Override void insertCategories(Iterable<Category> iterable); @Override void deleteCategoryById(Long id); @Override void updateCategory(C...
@Test public void updateCategory() throws Exception { Category category = categoryService.findCategoryById(2L); category.setName("修改你的名称"); categoryService.updateCategory(category); }
@Override public void updateCategory(Category category) { categoryRepository.save(category); }
CategoryServiceImpl implements CategoryService { @Override public void updateCategory(Category category) { categoryRepository.save(category); } }
CategoryServiceImpl implements CategoryService { @Override public void updateCategory(Category category) { categoryRepository.save(category); } }
CategoryServiceImpl implements CategoryService { @Override public void updateCategory(Category category) { categoryRepository.save(category); } @Override void saveCategory(Category category); @Override void insertCategories(Iterable<Category> iterable); @Override void deleteCategoryById(Long id); @Override void update...
CategoryServiceImpl implements CategoryService { @Override public void updateCategory(Category category) { categoryRepository.save(category); } @Override void saveCategory(Category category); @Override void insertCategories(Iterable<Category> iterable); @Override void deleteCategoryById(Long id); @Override void update...
@Test public void findAll() throws Exception { Iterable<Category> all = categoryService.findAll(); for (Category category : all) { System.err.println(category.toString()); } }
@Override public Iterable<Category> findAll() { return categoryRepository.findAll(); }
CategoryServiceImpl implements CategoryService { @Override public Iterable<Category> findAll() { return categoryRepository.findAll(); } }
CategoryServiceImpl implements CategoryService { @Override public Iterable<Category> findAll() { return categoryRepository.findAll(); } }
CategoryServiceImpl implements CategoryService { @Override public Iterable<Category> findAll() { return categoryRepository.findAll(); } @Override void saveCategory(Category category); @Override void insertCategories(Iterable<Category> iterable); @Override void deleteCategoryById(Long id); @Override void updateCategory...
CategoryServiceImpl implements CategoryService { @Override public Iterable<Category> findAll() { return categoryRepository.findAll(); } @Override void saveCategory(Category category); @Override void insertCategories(Iterable<Category> iterable); @Override void deleteCategoryById(Long id); @Override void updateCategory...
@Test public void findCategoryById() throws Exception { Category category = categoryService.findCategoryById(99L); System.err.println(category.toString()); }
@Override public Category findCategoryById(Long id) { return categoryRepository.findOne(id); }
CategoryServiceImpl implements CategoryService { @Override public Category findCategoryById(Long id) { return categoryRepository.findOne(id); } }
CategoryServiceImpl implements CategoryService { @Override public Category findCategoryById(Long id) { return categoryRepository.findOne(id); } }
CategoryServiceImpl implements CategoryService { @Override public Category findCategoryById(Long id) { return categoryRepository.findOne(id); } @Override void saveCategory(Category category); @Override void insertCategories(Iterable<Category> iterable); @Override void deleteCategoryById(Long id); @Override void update...
CategoryServiceImpl implements CategoryService { @Override public Category findCategoryById(Long id) { return categoryRepository.findOne(id); } @Override void saveCategory(Category category); @Override void insertCategories(Iterable<Category> iterable); @Override void deleteCategoryById(Long id); @Override void update...
@Test public void findCategoryByPage() { Page<Category> page = categoryService.findCategoryByPage(5-1, 20); System.out.println("总页数"+page.getTotalPages()); System.out.println("总记录数目"+page.getTotalElements()); System.out.println("当前页面"+(page.getNumber()+1)); System.out.println("当前页面的内容"+page.getContent()); System.out.pr...
@Override public Page<Category> findCategoryByPage(Integer starPage, Integer itemNumber) { PageRequest pageRequest = new PageRequest(starPage,itemNumber); return categoryRepository.findAll(pageRequest); }
CategoryServiceImpl implements CategoryService { @Override public Page<Category> findCategoryByPage(Integer starPage, Integer itemNumber) { PageRequest pageRequest = new PageRequest(starPage,itemNumber); return categoryRepository.findAll(pageRequest); } }
CategoryServiceImpl implements CategoryService { @Override public Page<Category> findCategoryByPage(Integer starPage, Integer itemNumber) { PageRequest pageRequest = new PageRequest(starPage,itemNumber); return categoryRepository.findAll(pageRequest); } }
CategoryServiceImpl implements CategoryService { @Override public Page<Category> findCategoryByPage(Integer starPage, Integer itemNumber) { PageRequest pageRequest = new PageRequest(starPage,itemNumber); return categoryRepository.findAll(pageRequest); } @Override void saveCategory(Category category); @Override void in...
CategoryServiceImpl implements CategoryService { @Override public Page<Category> findCategoryByPage(Integer starPage, Integer itemNumber) { PageRequest pageRequest = new PageRequest(starPage,itemNumber); return categoryRepository.findAll(pageRequest); } @Override void saveCategory(Category category); @Override void in...
@Test public void findCategoryByPageAndOrder() { Page<Category> pageAndOrder = categoryService.findCategoryByPageAndOrder(0, 5); List<Category> content = pageAndOrder.getContent(); for (Category category : content) { System.out.println(category.toString()); } }
@Override public Page<Category> findCategoryByPageAndOrder(Integer starPage, Integer itemNumber) { List<Sort.Order> orders = new ArrayList<>(); orders.add(new Sort.Order(Sort.Direction.DESC,"id")); PageRequest pageRequest = new PageRequest(starPage,itemNumber,new Sort(orders)); return categoryRepository.findAll(pageReq...
CategoryServiceImpl implements CategoryService { @Override public Page<Category> findCategoryByPageAndOrder(Integer starPage, Integer itemNumber) { List<Sort.Order> orders = new ArrayList<>(); orders.add(new Sort.Order(Sort.Direction.DESC,"id")); PageRequest pageRequest = new PageRequest(starPage,itemNumber,new Sort(or...
CategoryServiceImpl implements CategoryService { @Override public Page<Category> findCategoryByPageAndOrder(Integer starPage, Integer itemNumber) { List<Sort.Order> orders = new ArrayList<>(); orders.add(new Sort.Order(Sort.Direction.DESC,"id")); PageRequest pageRequest = new PageRequest(starPage,itemNumber,new Sort(or...
CategoryServiceImpl implements CategoryService { @Override public Page<Category> findCategoryByPageAndOrder(Integer starPage, Integer itemNumber) { List<Sort.Order> orders = new ArrayList<>(); orders.add(new Sort.Order(Sort.Direction.DESC,"id")); PageRequest pageRequest = new PageRequest(starPage,itemNumber,new Sort(or...
CategoryServiceImpl implements CategoryService { @Override public Page<Category> findCategoryByPageAndOrder(Integer starPage, Integer itemNumber) { List<Sort.Order> orders = new ArrayList<>(); orders.add(new Sort.Order(Sort.Direction.DESC,"id")); PageRequest pageRequest = new PageRequest(starPage,itemNumber,new Sort(or...
@Test public void defaultInitialisation() { FF4JMBean sampleBean = new FF4JMBean(); sampleBean.setFf4j(ff4j); Assert.assertNotNull(sampleBean); }
public void setFf4j(FF4j ff4j) { this.ff4j = ff4j; }
FF4JMBean { public void setFf4j(FF4j ff4j) { this.ff4j = ff4j; } }
FF4JMBean { public void setFf4j(FF4j ff4j) { this.ff4j = ff4j; } }
FF4JMBean { public void setFf4j(FF4j ff4j) { this.ff4j = ff4j; } @ManagedAttribute(description = "Returns states of every features of the store") Map<String, Boolean> getFeaturesStatus(); @ManagedOperation(description = "Enable feature from its identifier") @ManagedOperationParameters({@ManagedOperationParameter(name ...
FF4JMBean { public void setFf4j(FF4j ff4j) { this.ff4j = ff4j; } @ManagedAttribute(description = "Returns states of every features of the store") Map<String, Boolean> getFeaturesStatus(); @ManagedOperation(description = "Enable feature from its identifier") @ManagedOperationParameters({@ManagedOperationParameter(name ...
@Test public void testgetKeysNull() { InMemoryPropertyStore tmpStore = new InMemoryPropertyStore(); Configuration tmpConf = new FF4jConfiguration(tmpStore); Iterator<String> propsKeys = tmpConf.getKeys("z"); Assert.assertFalse(propsKeys.hasNext()); tmpStore.setProperties(null); Assert.assertFalse(tmpConf.getKeys().hasN...
@Override public Iterator<String> getKeys(String prefix) { Set< String > setOfNames = ff4jStore().listPropertyNames(); Set< String > results = new HashSet<String>(); if (setOfNames != null && setOfNames.size() > 0) { for (String name : setOfNames) { if (name.startsWith(prefix)) { results.add(name); } } } return results...
FF4jConfiguration extends AbstractConfiguration { @Override public Iterator<String> getKeys(String prefix) { Set< String > setOfNames = ff4jStore().listPropertyNames(); Set< String > results = new HashSet<String>(); if (setOfNames != null && setOfNames.size() > 0) { for (String name : setOfNames) { if (name.startsWith(...
FF4jConfiguration extends AbstractConfiguration { @Override public Iterator<String> getKeys(String prefix) { Set< String > setOfNames = ff4jStore().listPropertyNames(); Set< String > results = new HashSet<String>(); if (setOfNames != null && setOfNames.size() > 0) { for (String name : setOfNames) { if (name.startsWith(...
FF4jConfiguration extends AbstractConfiguration { @Override public Iterator<String> getKeys(String prefix) { Set< String > setOfNames = ff4jStore().listPropertyNames(); Set< String > results = new HashSet<String>(); if (setOfNames != null && setOfNames.size() > 0) { for (String name : setOfNames) { if (name.startsWith(...
FF4jConfiguration extends AbstractConfiguration { @Override public Iterator<String> getKeys(String prefix) { Set< String > setOfNames = ff4jStore().listPropertyNames(); Set< String > results = new HashSet<String>(); if (setOfNames != null && setOfNames.size() > 0) { for (String name : setOfNames) { if (name.startsWith(...
@Test(expected = IllegalStateException.class) public void testNullStore() { new FF4jConfiguration().ff4jStore(); }
public PropertyStore ff4jStore() { if (ff4jStore == null) { throw new IllegalStateException("Cannot load property from store as not initialized please set 'ff4jStore' property"); } return getFf4jStore(); }
FF4jConfiguration extends AbstractConfiguration { public PropertyStore ff4jStore() { if (ff4jStore == null) { throw new IllegalStateException("Cannot load property from store as not initialized please set 'ff4jStore' property"); } return getFf4jStore(); } }
FF4jConfiguration extends AbstractConfiguration { public PropertyStore ff4jStore() { if (ff4jStore == null) { throw new IllegalStateException("Cannot load property from store as not initialized please set 'ff4jStore' property"); } return getFf4jStore(); } FF4jConfiguration(); FF4jConfiguration(PropertyStore ff4jProper...
FF4jConfiguration extends AbstractConfiguration { public PropertyStore ff4jStore() { if (ff4jStore == null) { throw new IllegalStateException("Cannot load property from store as not initialized please set 'ff4jStore' property"); } return getFf4jStore(); } FF4jConfiguration(); FF4jConfiguration(PropertyStore ff4jProper...
FF4jConfiguration extends AbstractConfiguration { public PropertyStore ff4jStore() { if (ff4jStore == null) { throw new IllegalStateException("Cannot load property from store as not initialized please set 'ff4jStore' property"); } return getFf4jStore(); } FF4jConfiguration(); FF4jConfiguration(PropertyStore ff4jProper...
@Test(expected = IllegalStateException.class) public void initializationKO() { PropertyStoreCommonsConfig psConf = new PropertyStoreCommonsConfig(); psConf.existProperty("toto"); }
@Override public boolean existProperty(String name) { Util.assertHasLength(name); return conf().containsKey(name); }
PropertyStoreCommonsConfig extends AbstractPropertyStore { @Override public boolean existProperty(String name) { Util.assertHasLength(name); return conf().containsKey(name); } }
PropertyStoreCommonsConfig extends AbstractPropertyStore { @Override public boolean existProperty(String name) { Util.assertHasLength(name); return conf().containsKey(name); } PropertyStoreCommonsConfig(); PropertyStoreCommonsConfig(Configuration configuration); }
PropertyStoreCommonsConfig extends AbstractPropertyStore { @Override public boolean existProperty(String name) { Util.assertHasLength(name); return conf().containsKey(name); } PropertyStoreCommonsConfig(); PropertyStoreCommonsConfig(Configuration configuration); @Override boolean existProperty(String name); @Override ...
PropertyStoreCommonsConfig extends AbstractPropertyStore { @Override public boolean existProperty(String name) { Util.assertHasLength(name); return conf().containsKey(name); } PropertyStoreCommonsConfig(); PropertyStoreCommonsConfig(Configuration configuration); @Override boolean existProperty(String name); @Override ...
@Test(expected = IllegalArgumentException.class) public void yamlFile_shouldExist() { new YamlParser().parseConfigurationFile(null); }
@Override @SuppressWarnings("unchecked") public FF4jConfiguration parseConfigurationFile(InputStream inputStream) { Util.assertNotNull(inputStream, "Cannot read file stream is empty, check readability and path."); Map<?,?> yamlConfigFile = safeYaml.load(inputStream); Map<?,?> ff4jYamlMap = (Map<?, ?>) yamlConfigFile.ge...
YamlParser implements FF4jConfigurationParser<FF4jConfiguration> { @Override @SuppressWarnings("unchecked") public FF4jConfiguration parseConfigurationFile(InputStream inputStream) { Util.assertNotNull(inputStream, "Cannot read file stream is empty, check readability and path."); Map<?,?> yamlConfigFile = safeYaml.load...
YamlParser implements FF4jConfigurationParser<FF4jConfiguration> { @Override @SuppressWarnings("unchecked") public FF4jConfiguration parseConfigurationFile(InputStream inputStream) { Util.assertNotNull(inputStream, "Cannot read file stream is empty, check readability and path."); Map<?,?> yamlConfigFile = safeYaml.load...
YamlParser implements FF4jConfigurationParser<FF4jConfiguration> { @Override @SuppressWarnings("unchecked") public FF4jConfiguration parseConfigurationFile(InputStream inputStream) { Util.assertNotNull(inputStream, "Cannot read file stream is empty, check readability and path."); Map<?,?> yamlConfigFile = safeYaml.load...
YamlParser implements FF4jConfigurationParser<FF4jConfiguration> { @Override @SuppressWarnings("unchecked") public FF4jConfiguration parseConfigurationFile(InputStream inputStream) { Util.assertNotNull(inputStream, "Cannot read file stream is empty, check readability and path."); Map<?,?> yamlConfigFile = safeYaml.load...
@Test public void importYaml_should_be_same_asXMLImport() { InputStream xmlFile = getClass().getClassLoader().getResourceAsStream("test-ff4j-features.xml"); InputStream ymlFile = getClass().getClassLoader().getResourceAsStream("test-ff4j-features.yml"); XmlConfig xmlConfig = new XmlParser().parseConfigurationFile(xmlFi...
@Override @SuppressWarnings("unchecked") public FF4jConfiguration parseConfigurationFile(InputStream inputStream) { Util.assertNotNull(inputStream, "Cannot read file stream is empty, check readability and path."); Map<?,?> yamlConfigFile = safeYaml.load(inputStream); Map<?,?> ff4jYamlMap = (Map<?, ?>) yamlConfigFile.ge...
YamlParser implements FF4jConfigurationParser<FF4jConfiguration> { @Override @SuppressWarnings("unchecked") public FF4jConfiguration parseConfigurationFile(InputStream inputStream) { Util.assertNotNull(inputStream, "Cannot read file stream is empty, check readability and path."); Map<?,?> yamlConfigFile = safeYaml.load...
YamlParser implements FF4jConfigurationParser<FF4jConfiguration> { @Override @SuppressWarnings("unchecked") public FF4jConfiguration parseConfigurationFile(InputStream inputStream) { Util.assertNotNull(inputStream, "Cannot read file stream is empty, check readability and path."); Map<?,?> yamlConfigFile = safeYaml.load...
YamlParser implements FF4jConfigurationParser<FF4jConfiguration> { @Override @SuppressWarnings("unchecked") public FF4jConfiguration parseConfigurationFile(InputStream inputStream) { Util.assertNotNull(inputStream, "Cannot read file stream is empty, check readability and path."); Map<?,?> yamlConfigFile = safeYaml.load...
YamlParser implements FF4jConfigurationParser<FF4jConfiguration> { @Override @SuppressWarnings("unchecked") public FF4jConfiguration parseConfigurationFile(InputStream inputStream) { Util.assertNotNull(inputStream, "Cannot read file stream is empty, check readability and path."); Map<?,?> yamlConfigFile = safeYaml.load...
@Test public void testParsePropertyEmpty() { Assert.assertNull(PropertyJsonParser.parseProperty("")); Assert.assertNull(PropertyJsonParser.parseProperty(null)); }
@SuppressWarnings("unchecked") public static Property<?> parseProperty(String json) { if (null == json || "".equals(json)) { return null; } Map<String, Object> propertyJson; try { propertyJson = objectMapper.readValue(json, HashMap.class); } catch (Exception re) { throw new IllegalArgumentException("Cannot parse JSON P...
PropertyJsonParser { @SuppressWarnings("unchecked") public static Property<?> parseProperty(String json) { if (null == json || "".equals(json)) { return null; } Map<String, Object> propertyJson; try { propertyJson = objectMapper.readValue(json, HashMap.class); } catch (Exception re) { throw new IllegalArgumentException...
PropertyJsonParser { @SuppressWarnings("unchecked") public static Property<?> parseProperty(String json) { if (null == json || "".equals(json)) { return null; } Map<String, Object> propertyJson; try { propertyJson = objectMapper.readValue(json, HashMap.class); } catch (Exception re) { throw new IllegalArgumentException...
PropertyJsonParser { @SuppressWarnings("unchecked") public static Property<?> parseProperty(String json) { if (null == json || "".equals(json)) { return null; } Map<String, Object> propertyJson; try { propertyJson = objectMapper.readValue(json, HashMap.class); } catch (Exception re) { throw new IllegalArgumentException...
PropertyJsonParser { @SuppressWarnings("unchecked") public static Property<?> parseProperty(String json) { if (null == json || "".equals(json)) { return null; } Map<String, Object> propertyJson; try { propertyJson = objectMapper.readValue(json, HashMap.class); } catch (Exception re) { throw new IllegalArgumentException...
@Test(expected = IllegalArgumentException.class) public void testParsePropertyError() { Assert.assertNull(PropertyJsonParser.parseProperty("something:invalid")); }
@SuppressWarnings("unchecked") public static Property<?> parseProperty(String json) { if (null == json || "".equals(json)) { return null; } Map<String, Object> propertyJson; try { propertyJson = objectMapper.readValue(json, HashMap.class); } catch (Exception re) { throw new IllegalArgumentException("Cannot parse JSON P...
PropertyJsonParser { @SuppressWarnings("unchecked") public static Property<?> parseProperty(String json) { if (null == json || "".equals(json)) { return null; } Map<String, Object> propertyJson; try { propertyJson = objectMapper.readValue(json, HashMap.class); } catch (Exception re) { throw new IllegalArgumentException...
PropertyJsonParser { @SuppressWarnings("unchecked") public static Property<?> parseProperty(String json) { if (null == json || "".equals(json)) { return null; } Map<String, Object> propertyJson; try { propertyJson = objectMapper.readValue(json, HashMap.class); } catch (Exception re) { throw new IllegalArgumentException...
PropertyJsonParser { @SuppressWarnings("unchecked") public static Property<?> parseProperty(String json) { if (null == json || "".equals(json)) { return null; } Map<String, Object> propertyJson; try { propertyJson = objectMapper.readValue(json, HashMap.class); } catch (Exception re) { throw new IllegalArgumentException...
PropertyJsonParser { @SuppressWarnings("unchecked") public static Property<?> parseProperty(String json) { if (null == json || "".equals(json)) { return null; } Map<String, Object> propertyJson; try { propertyJson = objectMapper.readValue(json, HashMap.class); } catch (Exception re) { throw new IllegalArgumentException...
@Test public void testFull() { String pExp = "{\"name\":\"p1\",\"description\":null,\"type\":\"org.ff4j.property.PropertyString\",\"value\":\"v1\",\"fixedValues\":null}"; Property<?> p = PropertyJsonParser.parseProperty(pExp); Assert.assertNotNull(p); Assert.assertNotNull(p.getType()); Assert.assertEquals("v1", p.getVa...
@SuppressWarnings("unchecked") public static Property<?> parseProperty(String json) { if (null == json || "".equals(json)) { return null; } Map<String, Object> propertyJson; try { propertyJson = objectMapper.readValue(json, HashMap.class); } catch (Exception re) { throw new IllegalArgumentException("Cannot parse JSON P...
PropertyJsonParser { @SuppressWarnings("unchecked") public static Property<?> parseProperty(String json) { if (null == json || "".equals(json)) { return null; } Map<String, Object> propertyJson; try { propertyJson = objectMapper.readValue(json, HashMap.class); } catch (Exception re) { throw new IllegalArgumentException...
PropertyJsonParser { @SuppressWarnings("unchecked") public static Property<?> parseProperty(String json) { if (null == json || "".equals(json)) { return null; } Map<String, Object> propertyJson; try { propertyJson = objectMapper.readValue(json, HashMap.class); } catch (Exception re) { throw new IllegalArgumentException...
PropertyJsonParser { @SuppressWarnings("unchecked") public static Property<?> parseProperty(String json) { if (null == json || "".equals(json)) { return null; } Map<String, Object> propertyJson; try { propertyJson = objectMapper.readValue(json, HashMap.class); } catch (Exception re) { throw new IllegalArgumentException...
PropertyJsonParser { @SuppressWarnings("unchecked") public static Property<?> parseProperty(String json) { if (null == json || "".equals(json)) { return null; } Map<String, Object> propertyJson; try { propertyJson = objectMapper.readValue(json, HashMap.class); } catch (Exception re) { throw new IllegalArgumentException...
@Test public void testMarshaling() throws Exception { Map <String, Feature> features = ff4j.getFeatures(); for (String key : features.keySet()) { assertMarshalling(features.get(key)); Feature f1 = FeatureJsonParser.parseFeature(features.get(key).toJson()); assertMarshalling(f1); } }
@SuppressWarnings("unchecked") public static Feature parseFeature(String json) { try { return parseFeatureMap(objectMapper.readValue(json, HashMap.class)); } catch (IOException e) { throw new IllegalArgumentException("Cannot parse json as Feature " + json, e); } }
FeatureJsonParser { @SuppressWarnings("unchecked") public static Feature parseFeature(String json) { try { return parseFeatureMap(objectMapper.readValue(json, HashMap.class)); } catch (IOException e) { throw new IllegalArgumentException("Cannot parse json as Feature " + json, e); } } }
FeatureJsonParser { @SuppressWarnings("unchecked") public static Feature parseFeature(String json) { try { return parseFeatureMap(objectMapper.readValue(json, HashMap.class)); } catch (IOException e) { throw new IllegalArgumentException("Cannot parse json as Feature " + json, e); } } private FeatureJsonParser(); }
FeatureJsonParser { @SuppressWarnings("unchecked") public static Feature parseFeature(String json) { try { return parseFeatureMap(objectMapper.readValue(json, HashMap.class)); } catch (IOException e) { throw new IllegalArgumentException("Cannot parse json as Feature " + json, e); } } private FeatureJsonParser(); @Supp...
FeatureJsonParser { @SuppressWarnings("unchecked") public static Feature parseFeature(String json) { try { return parseFeatureMap(objectMapper.readValue(json, HashMap.class)); } catch (IOException e) { throw new IllegalArgumentException("Cannot parse json as Feature " + json, e); } } private FeatureJsonParser(); @Supp...
@Test public void testArrays() throws Exception { Map <String, Feature> features = ff4j.getFeatures(); int idx = 0; Feature[] f= new Feature[features.size()]; for (String feature : features.keySet()) { f[idx] = features.get(feature); idx++; } String featuresArrayAsJson = marshallWithJackson(f); Feature[] ff = FeatureJs...
@SuppressWarnings("unchecked") public static Feature[] parseFeatureArray(String json) { if (null == json || "".equals(json)) { return null; } try { List<LinkedHashMap<String, Object>> flipMap = objectMapper.readValue(json, List.class); Feature[] fArray = new Feature[flipMap.size()]; int idx = 0; for (LinkedHashMap<Stri...
FeatureJsonParser { @SuppressWarnings("unchecked") public static Feature[] parseFeatureArray(String json) { if (null == json || "".equals(json)) { return null; } try { List<LinkedHashMap<String, Object>> flipMap = objectMapper.readValue(json, List.class); Feature[] fArray = new Feature[flipMap.size()]; int idx = 0; for...
FeatureJsonParser { @SuppressWarnings("unchecked") public static Feature[] parseFeatureArray(String json) { if (null == json || "".equals(json)) { return null; } try { List<LinkedHashMap<String, Object>> flipMap = objectMapper.readValue(json, List.class); Feature[] fArray = new Feature[flipMap.size()]; int idx = 0; for...
FeatureJsonParser { @SuppressWarnings("unchecked") public static Feature[] parseFeatureArray(String json) { if (null == json || "".equals(json)) { return null; } try { List<LinkedHashMap<String, Object>> flipMap = objectMapper.readValue(json, List.class); Feature[] fArray = new Feature[flipMap.size()]; int idx = 0; for...
FeatureJsonParser { @SuppressWarnings("unchecked") public static Feature[] parseFeatureArray(String json) { if (null == json || "".equals(json)) { return null; } try { List<LinkedHashMap<String, Object>> flipMap = objectMapper.readValue(json, List.class); Feature[] fArray = new Feature[flipMap.size()]; int idx = 0; for...
@Test(expected = IllegalArgumentException.class) public void propertiesFile_shouldExist() { new PropertiesParser().parseConfigurationFile(null); }
@Override public FF4jConfiguration parseConfigurationFile(InputStream inputStream) { Util.assertNotNull(inputStream, "Cannot read file stream is empty, check readability and path."); try { Properties props = new Properties(); props.load(inputStream); return parseConfiguration(props); } catch (IOException e) { throw new...
PropertiesParser implements FF4jConfigurationParser<FF4jConfiguration> { @Override public FF4jConfiguration parseConfigurationFile(InputStream inputStream) { Util.assertNotNull(inputStream, "Cannot read file stream is empty, check readability and path."); try { Properties props = new Properties(); props.load(inputStrea...
PropertiesParser implements FF4jConfigurationParser<FF4jConfiguration> { @Override public FF4jConfiguration parseConfigurationFile(InputStream inputStream) { Util.assertNotNull(inputStream, "Cannot read file stream is empty, check readability and path."); try { Properties props = new Properties(); props.load(inputStrea...
PropertiesParser implements FF4jConfigurationParser<FF4jConfiguration> { @Override public FF4jConfiguration parseConfigurationFile(InputStream inputStream) { Util.assertNotNull(inputStream, "Cannot read file stream is empty, check readability and path."); try { Properties props = new Properties(); props.load(inputStrea...
PropertiesParser implements FF4jConfigurationParser<FF4jConfiguration> { @Override public FF4jConfiguration parseConfigurationFile(InputStream inputStream) { Util.assertNotNull(inputStream, "Cannot read file stream is empty, check readability and path."); try { Properties props = new Properties(); props.load(inputStrea...
@Test(expected = IllegalArgumentException.class) public void testInvalidJsonGetIllegalArgument() { FeatureJsonParser.parseFeature("something:invald"); }
@SuppressWarnings("unchecked") public static Feature parseFeature(String json) { try { return parseFeatureMap(objectMapper.readValue(json, HashMap.class)); } catch (IOException e) { throw new IllegalArgumentException("Cannot parse json as Feature " + json, e); } }
FeatureJsonParser { @SuppressWarnings("unchecked") public static Feature parseFeature(String json) { try { return parseFeatureMap(objectMapper.readValue(json, HashMap.class)); } catch (IOException e) { throw new IllegalArgumentException("Cannot parse json as Feature " + json, e); } } }
FeatureJsonParser { @SuppressWarnings("unchecked") public static Feature parseFeature(String json) { try { return parseFeatureMap(objectMapper.readValue(json, HashMap.class)); } catch (IOException e) { throw new IllegalArgumentException("Cannot parse json as Feature " + json, e); } } private FeatureJsonParser(); }
FeatureJsonParser { @SuppressWarnings("unchecked") public static Feature parseFeature(String json) { try { return parseFeatureMap(objectMapper.readValue(json, HashMap.class)); } catch (IOException e) { throw new IllegalArgumentException("Cannot parse json as Feature " + json, e); } } private FeatureJsonParser(); @Supp...
FeatureJsonParser { @SuppressWarnings("unchecked") public static Feature parseFeature(String json) { try { return parseFeatureMap(objectMapper.readValue(json, HashMap.class)); } catch (IOException e) { throw new IllegalArgumentException("Cannot parse json as Feature " + json, e); } } private FeatureJsonParser(); @Supp...
@Test public void testSerialisation() { Feature[] features = { new Feature("f1"), new Feature("f2")}; Assert.assertNotNull(FeatureJsonParser.featureArrayToJson(features)); Assert.assertNotNull(FeatureJsonParser.featureArrayToJson(null)); }
public static String featureArrayToJson(Feature[] features) { StringBuilder sb = new StringBuilder(); sb.append("["); if (features != null) { boolean first = true; for (Feature feature : features) { sb.append(first ? "" : ","); sb.append(feature.toJson()); first = false; } } sb.append("]"); return sb.toString(); }
FeatureJsonParser { public static String featureArrayToJson(Feature[] features) { StringBuilder sb = new StringBuilder(); sb.append("["); if (features != null) { boolean first = true; for (Feature feature : features) { sb.append(first ? "" : ","); sb.append(feature.toJson()); first = false; } } sb.append("]"); return s...
FeatureJsonParser { public static String featureArrayToJson(Feature[] features) { StringBuilder sb = new StringBuilder(); sb.append("["); if (features != null) { boolean first = true; for (Feature feature : features) { sb.append(first ? "" : ","); sb.append(feature.toJson()); first = false; } } sb.append("]"); return s...
FeatureJsonParser { public static String featureArrayToJson(Feature[] features) { StringBuilder sb = new StringBuilder(); sb.append("["); if (features != null) { boolean first = true; for (Feature feature : features) { sb.append(first ? "" : ","); sb.append(feature.toJson()); first = false; } } sb.append("]"); return s...
FeatureJsonParser { public static String featureArrayToJson(Feature[] features) { StringBuilder sb = new StringBuilder(); sb.append("["); if (features != null) { boolean first = true; for (Feature feature : features) { sb.append(first ? "" : ","); sb.append(feature.toJson()); first = false; } } sb.append("]"); return s...
@Test public void testParseFlipStrategyAsJson() { Assert.assertNull(FeatureJsonParser.parseFlipStrategyAsJson("f1", "")); Assert.assertNull(FeatureJsonParser.parseFlipStrategyAsJson("f1", null)); String fExp = "{\"initParams\":{\"weight\":\"0.6\"},\"type\":\"org.ff4j.strategy.PonderationStrategy\"}"; Assert.assertNotNu...
@SuppressWarnings("unchecked") public static FlippingStrategy parseFlipStrategyAsJson(String uid, String json) { if (null == json || "".equals(json)) { return null; } try { return parseFlipStrategy(uid, (HashMap<String, Object>) objectMapper.readValue(json, HashMap.class)); } catch (Exception e) { throw new IllegalArgu...
FeatureJsonParser { @SuppressWarnings("unchecked") public static FlippingStrategy parseFlipStrategyAsJson(String uid, String json) { if (null == json || "".equals(json)) { return null; } try { return parseFlipStrategy(uid, (HashMap<String, Object>) objectMapper.readValue(json, HashMap.class)); } catch (Exception e) { t...
FeatureJsonParser { @SuppressWarnings("unchecked") public static FlippingStrategy parseFlipStrategyAsJson(String uid, String json) { if (null == json || "".equals(json)) { return null; } try { return parseFlipStrategy(uid, (HashMap<String, Object>) objectMapper.readValue(json, HashMap.class)); } catch (Exception e) { t...
FeatureJsonParser { @SuppressWarnings("unchecked") public static FlippingStrategy parseFlipStrategyAsJson(String uid, String json) { if (null == json || "".equals(json)) { return null; } try { return parseFlipStrategy(uid, (HashMap<String, Object>) objectMapper.readValue(json, HashMap.class)); } catch (Exception e) { t...
FeatureJsonParser { @SuppressWarnings("unchecked") public static FlippingStrategy parseFlipStrategyAsJson(String uid, String json) { if (null == json || "".equals(json)) { return null; } try { return parseFlipStrategy(uid, (HashMap<String, Object>) objectMapper.readValue(json, HashMap.class)); } catch (Exception e) { t...
@Test(expected = IllegalArgumentException.class) public void testParseFlipStrategyAsJsonError() { FeatureJsonParser.parseFlipStrategyAsJson("f1", "something:invalid"); }
@SuppressWarnings("unchecked") public static FlippingStrategy parseFlipStrategyAsJson(String uid, String json) { if (null == json || "".equals(json)) { return null; } try { return parseFlipStrategy(uid, (HashMap<String, Object>) objectMapper.readValue(json, HashMap.class)); } catch (Exception e) { throw new IllegalArgu...
FeatureJsonParser { @SuppressWarnings("unchecked") public static FlippingStrategy parseFlipStrategyAsJson(String uid, String json) { if (null == json || "".equals(json)) { return null; } try { return parseFlipStrategy(uid, (HashMap<String, Object>) objectMapper.readValue(json, HashMap.class)); } catch (Exception e) { t...
FeatureJsonParser { @SuppressWarnings("unchecked") public static FlippingStrategy parseFlipStrategyAsJson(String uid, String json) { if (null == json || "".equals(json)) { return null; } try { return parseFlipStrategy(uid, (HashMap<String, Object>) objectMapper.readValue(json, HashMap.class)); } catch (Exception e) { t...
FeatureJsonParser { @SuppressWarnings("unchecked") public static FlippingStrategy parseFlipStrategyAsJson(String uid, String json) { if (null == json || "".equals(json)) { return null; } try { return parseFlipStrategy(uid, (HashMap<String, Object>) objectMapper.readValue(json, HashMap.class)); } catch (Exception e) { t...
FeatureJsonParser { @SuppressWarnings("unchecked") public static FlippingStrategy parseFlipStrategyAsJson(String uid, String json) { if (null == json || "".equals(json)) { return null; } try { return parseFlipStrategy(uid, (HashMap<String, Object>) objectMapper.readValue(json, HashMap.class)); } catch (Exception e) { t...
@Test(expected = IllegalArgumentException.class) public void testparseFeatureArrayError() { FeatureJsonParser.parseFeatureArray("something:invalid"); }
@SuppressWarnings("unchecked") public static Feature[] parseFeatureArray(String json) { if (null == json || "".equals(json)) { return null; } try { List<LinkedHashMap<String, Object>> flipMap = objectMapper.readValue(json, List.class); Feature[] fArray = new Feature[flipMap.size()]; int idx = 0; for (LinkedHashMap<Stri...
FeatureJsonParser { @SuppressWarnings("unchecked") public static Feature[] parseFeatureArray(String json) { if (null == json || "".equals(json)) { return null; } try { List<LinkedHashMap<String, Object>> flipMap = objectMapper.readValue(json, List.class); Feature[] fArray = new Feature[flipMap.size()]; int idx = 0; for...
FeatureJsonParser { @SuppressWarnings("unchecked") public static Feature[] parseFeatureArray(String json) { if (null == json || "".equals(json)) { return null; } try { List<LinkedHashMap<String, Object>> flipMap = objectMapper.readValue(json, List.class); Feature[] fArray = new Feature[flipMap.size()]; int idx = 0; for...
FeatureJsonParser { @SuppressWarnings("unchecked") public static Feature[] parseFeatureArray(String json) { if (null == json || "".equals(json)) { return null; } try { List<LinkedHashMap<String, Object>> flipMap = objectMapper.readValue(json, List.class); Feature[] fArray = new Feature[flipMap.size()]; int idx = 0; for...
FeatureJsonParser { @SuppressWarnings("unchecked") public static Feature[] parseFeatureArray(String json) { if (null == json || "".equals(json)) { return null; } try { List<LinkedHashMap<String, Object>> flipMap = objectMapper.readValue(json, List.class); Feature[] fArray = new Feature[flipMap.size()]; int idx = 0; for...
@Test public void testparseFeatureArrayEmpty() { Assert.assertNull(FeatureJsonParser.parseFeatureArray(null)); Assert.assertNull(FeatureJsonParser.parseFeatureArray("")); }
@SuppressWarnings("unchecked") public static Feature[] parseFeatureArray(String json) { if (null == json || "".equals(json)) { return null; } try { List<LinkedHashMap<String, Object>> flipMap = objectMapper.readValue(json, List.class); Feature[] fArray = new Feature[flipMap.size()]; int idx = 0; for (LinkedHashMap<Stri...
FeatureJsonParser { @SuppressWarnings("unchecked") public static Feature[] parseFeatureArray(String json) { if (null == json || "".equals(json)) { return null; } try { List<LinkedHashMap<String, Object>> flipMap = objectMapper.readValue(json, List.class); Feature[] fArray = new Feature[flipMap.size()]; int idx = 0; for...
FeatureJsonParser { @SuppressWarnings("unchecked") public static Feature[] parseFeatureArray(String json) { if (null == json || "".equals(json)) { return null; } try { List<LinkedHashMap<String, Object>> flipMap = objectMapper.readValue(json, List.class); Feature[] fArray = new Feature[flipMap.size()]; int idx = 0; for...
FeatureJsonParser { @SuppressWarnings("unchecked") public static Feature[] parseFeatureArray(String json) { if (null == json || "".equals(json)) { return null; } try { List<LinkedHashMap<String, Object>> flipMap = objectMapper.readValue(json, List.class); Feature[] fArray = new Feature[flipMap.size()]; int idx = 0; for...
FeatureJsonParser { @SuppressWarnings("unchecked") public static Feature[] parseFeatureArray(String json) { if (null == json || "".equals(json)) { return null; } try { List<LinkedHashMap<String, Object>> flipMap = objectMapper.readValue(json, List.class); Feature[] fArray = new Feature[flipMap.size()]; int idx = 0; for...
@Test public void testMarshaling() { ff4j.setAuthorizationsManager(new AuthorizationsManager() { public String toJson() { return "dummy"; } public Set<String> listAllPermissions() { return new HashSet<>(); } public Set<String> getCurrentUserPermissions() { return new HashSet<>(); } public String getCurrentUserName() { ...
@SuppressWarnings("unchecked") public static Event parseEvent(String json) { try { return parseEventMap(objectMapper.readValue(json, HashMap.class)); } catch (IOException e) { throw new IllegalArgumentException("Cannot parse json as Event " + json, e); } }
EventJsonParser { @SuppressWarnings("unchecked") public static Event parseEvent(String json) { try { return parseEventMap(objectMapper.readValue(json, HashMap.class)); } catch (IOException e) { throw new IllegalArgumentException("Cannot parse json as Event " + json, e); } } }
EventJsonParser { @SuppressWarnings("unchecked") public static Event parseEvent(String json) { try { return parseEventMap(objectMapper.readValue(json, HashMap.class)); } catch (IOException e) { throw new IllegalArgumentException("Cannot parse json as Event " + json, e); } } private EventJsonParser(); }
EventJsonParser { @SuppressWarnings("unchecked") public static Event parseEvent(String json) { try { return parseEventMap(objectMapper.readValue(json, HashMap.class)); } catch (IOException e) { throw new IllegalArgumentException("Cannot parse json as Event " + json, e); } } private EventJsonParser(); @SuppressWarnings...
EventJsonParser { @SuppressWarnings("unchecked") public static Event parseEvent(String json) { try { return parseEventMap(objectMapper.readValue(json, HashMap.class)); } catch (IOException e) { throw new IllegalArgumentException("Cannot parse json as Event " + json, e); } } private EventJsonParser(); @SuppressWarnings...
@Test(expected = IllegalArgumentException.class) public void testInvalidJsonGetIllegalArgument() { EventJsonParser.parseEvent("something:invald"); }
@SuppressWarnings("unchecked") public static Event parseEvent(String json) { try { return parseEventMap(objectMapper.readValue(json, HashMap.class)); } catch (IOException e) { throw new IllegalArgumentException("Cannot parse json as Event " + json, e); } }
EventJsonParser { @SuppressWarnings("unchecked") public static Event parseEvent(String json) { try { return parseEventMap(objectMapper.readValue(json, HashMap.class)); } catch (IOException e) { throw new IllegalArgumentException("Cannot parse json as Event " + json, e); } } }
EventJsonParser { @SuppressWarnings("unchecked") public static Event parseEvent(String json) { try { return parseEventMap(objectMapper.readValue(json, HashMap.class)); } catch (IOException e) { throw new IllegalArgumentException("Cannot parse json as Event " + json, e); } } private EventJsonParser(); }
EventJsonParser { @SuppressWarnings("unchecked") public static Event parseEvent(String json) { try { return parseEventMap(objectMapper.readValue(json, HashMap.class)); } catch (IOException e) { throw new IllegalArgumentException("Cannot parse json as Event " + json, e); } } private EventJsonParser(); @SuppressWarnings...
EventJsonParser { @SuppressWarnings("unchecked") public static Event parseEvent(String json) { try { return parseEventMap(objectMapper.readValue(json, HashMap.class)); } catch (IOException e) { throw new IllegalArgumentException("Cannot parse json as Event " + json, e); } } private EventJsonParser(); @SuppressWarnings...
@Test public void testSerialisation() { Event event1 = new Event(); event1.setUuid("e1"); Event event2 = new Event(); event2.setUuid("e2"); Event[] events = {event1, event2}; Assert.assertNotNull(EventJsonParser.eventArrayToJson(events)); Assert.assertNotNull(EventJsonParser.eventArrayToJson(null)); }
public static String eventArrayToJson(Event[] events) { StringBuilder sb = new StringBuilder(); sb.append("["); if (events != null) { boolean first = true; for (Event event : events) { sb.append(first ? "" : ","); sb.append(event.toJson()); first = false; } } sb.append("]"); return sb.toString(); }
EventJsonParser { public static String eventArrayToJson(Event[] events) { StringBuilder sb = new StringBuilder(); sb.append("["); if (events != null) { boolean first = true; for (Event event : events) { sb.append(first ? "" : ","); sb.append(event.toJson()); first = false; } } sb.append("]"); return sb.toString(); } }
EventJsonParser { public static String eventArrayToJson(Event[] events) { StringBuilder sb = new StringBuilder(); sb.append("["); if (events != null) { boolean first = true; for (Event event : events) { sb.append(first ? "" : ","); sb.append(event.toJson()); first = false; } } sb.append("]"); return sb.toString(); } pr...
EventJsonParser { public static String eventArrayToJson(Event[] events) { StringBuilder sb = new StringBuilder(); sb.append("["); if (events != null) { boolean first = true; for (Event event : events) { sb.append(first ? "" : ","); sb.append(event.toJson()); first = false; } } sb.append("]"); return sb.toString(); } pr...
EventJsonParser { public static String eventArrayToJson(Event[] events) { StringBuilder sb = new StringBuilder(); sb.append("["); if (events != null) { boolean first = true; for (Event event : events) { sb.append(first ? "" : ","); sb.append(event.toJson()); first = false; } } sb.append("]"); return sb.toString(); } pr...
@Test(expected = IllegalArgumentException.class) public void testparseEventArrayError() { EventJsonParser.parseEventArray("something:invalid"); }
@SuppressWarnings("unchecked") public static Event[] parseEventArray(String json) { if (null == json || "".equals(json)) { return null; } try { List<LinkedHashMap<String, Object>> evtMap = objectMapper.readValue(json, List.class); Event[] eArray = new Event[evtMap.size()]; int idx = 0; for (LinkedHashMap<String, Object...
EventJsonParser { @SuppressWarnings("unchecked") public static Event[] parseEventArray(String json) { if (null == json || "".equals(json)) { return null; } try { List<LinkedHashMap<String, Object>> evtMap = objectMapper.readValue(json, List.class); Event[] eArray = new Event[evtMap.size()]; int idx = 0; for (LinkedHash...
EventJsonParser { @SuppressWarnings("unchecked") public static Event[] parseEventArray(String json) { if (null == json || "".equals(json)) { return null; } try { List<LinkedHashMap<String, Object>> evtMap = objectMapper.readValue(json, List.class); Event[] eArray = new Event[evtMap.size()]; int idx = 0; for (LinkedHash...
EventJsonParser { @SuppressWarnings("unchecked") public static Event[] parseEventArray(String json) { if (null == json || "".equals(json)) { return null; } try { List<LinkedHashMap<String, Object>> evtMap = objectMapper.readValue(json, List.class); Event[] eArray = new Event[evtMap.size()]; int idx = 0; for (LinkedHash...
EventJsonParser { @SuppressWarnings("unchecked") public static Event[] parseEventArray(String json) { if (null == json || "".equals(json)) { return null; } try { List<LinkedHashMap<String, Object>> evtMap = objectMapper.readValue(json, List.class); Event[] eArray = new Event[evtMap.size()]; int idx = 0; for (LinkedHash...
@Test public void importProperties_should_be_same_asXMLImport() { InputStream xmlFile = getClass().getClassLoader().getResourceAsStream("test-ff4j-features.xml"); InputStream ymlFile = getClass().getClassLoader().getResourceAsStream("test-ff4j-features.properties"); XmlConfig xmlConfig = new XmlParser().parseConfigurat...
@Override public FF4jConfiguration parseConfigurationFile(InputStream inputStream) { Util.assertNotNull(inputStream, "Cannot read file stream is empty, check readability and path."); try { Properties props = new Properties(); props.load(inputStream); return parseConfiguration(props); } catch (IOException e) { throw new...
PropertiesParser implements FF4jConfigurationParser<FF4jConfiguration> { @Override public FF4jConfiguration parseConfigurationFile(InputStream inputStream) { Util.assertNotNull(inputStream, "Cannot read file stream is empty, check readability and path."); try { Properties props = new Properties(); props.load(inputStrea...
PropertiesParser implements FF4jConfigurationParser<FF4jConfiguration> { @Override public FF4jConfiguration parseConfigurationFile(InputStream inputStream) { Util.assertNotNull(inputStream, "Cannot read file stream is empty, check readability and path."); try { Properties props = new Properties(); props.load(inputStrea...
PropertiesParser implements FF4jConfigurationParser<FF4jConfiguration> { @Override public FF4jConfiguration parseConfigurationFile(InputStream inputStream) { Util.assertNotNull(inputStream, "Cannot read file stream is empty, check readability and path."); try { Properties props = new Properties(); props.load(inputStrea...
PropertiesParser implements FF4jConfigurationParser<FF4jConfiguration> { @Override public FF4jConfiguration parseConfigurationFile(InputStream inputStream) { Util.assertNotNull(inputStream, "Cannot read file stream is empty, check readability and path."); try { Properties props = new Properties(); props.load(inputStrea...
@Test public void testparseFeatureArrayEmpty() { Assert.assertNull(EventJsonParser.parseEventArray(null)); Assert.assertNull(EventJsonParser.parseEventArray("")); }
@SuppressWarnings("unchecked") public static Event[] parseEventArray(String json) { if (null == json || "".equals(json)) { return null; } try { List<LinkedHashMap<String, Object>> evtMap = objectMapper.readValue(json, List.class); Event[] eArray = new Event[evtMap.size()]; int idx = 0; for (LinkedHashMap<String, Object...
EventJsonParser { @SuppressWarnings("unchecked") public static Event[] parseEventArray(String json) { if (null == json || "".equals(json)) { return null; } try { List<LinkedHashMap<String, Object>> evtMap = objectMapper.readValue(json, List.class); Event[] eArray = new Event[evtMap.size()]; int idx = 0; for (LinkedHash...
EventJsonParser { @SuppressWarnings("unchecked") public static Event[] parseEventArray(String json) { if (null == json || "".equals(json)) { return null; } try { List<LinkedHashMap<String, Object>> evtMap = objectMapper.readValue(json, List.class); Event[] eArray = new Event[evtMap.size()]; int idx = 0; for (LinkedHash...
EventJsonParser { @SuppressWarnings("unchecked") public static Event[] parseEventArray(String json) { if (null == json || "".equals(json)) { return null; } try { List<LinkedHashMap<String, Object>> evtMap = objectMapper.readValue(json, List.class); Event[] eArray = new Event[evtMap.size()]; int idx = 0; for (LinkedHash...
EventJsonParser { @SuppressWarnings("unchecked") public static Event[] parseEventArray(String json) { if (null == json || "".equals(json)) { return null; } try { List<LinkedHashMap<String, Object>> evtMap = objectMapper.readValue(json, List.class); Event[] eArray = new Event[evtMap.size()]; int idx = 0; for (LinkedHash...
@Override @Test public void clear() { Map<String, Property<?>> before = testedStore.readAllProperties(); Assert.assertFalse(before.isEmpty()); testedStore.clear(); Assert.assertTrue(testedStore.readAllProperties().isEmpty()); }
@Override public void clear() { Set<String> names = listPropertyFullNames(); if (!Util.isEmpty(names)) { client.deleteParameters(new DeleteParametersRequest().withNames(names)); } }
PropertyStoreAwsSSM extends AbstractPropertyStore { @Override public void clear() { Set<String> names = listPropertyFullNames(); if (!Util.isEmpty(names)) { client.deleteParameters(new DeleteParametersRequest().withNames(names)); } } }
PropertyStoreAwsSSM extends AbstractPropertyStore { @Override public void clear() { Set<String> names = listPropertyFullNames(); if (!Util.isEmpty(names)) { client.deleteParameters(new DeleteParametersRequest().withNames(names)); } } PropertyStoreAwsSSM(String path); PropertyStoreAwsSSM(AWSSimpleSystemsManagement clie...
PropertyStoreAwsSSM extends AbstractPropertyStore { @Override public void clear() { Set<String> names = listPropertyFullNames(); if (!Util.isEmpty(names)) { client.deleteParameters(new DeleteParametersRequest().withNames(names)); } } PropertyStoreAwsSSM(String path); PropertyStoreAwsSSM(AWSSimpleSystemsManagement clie...
PropertyStoreAwsSSM extends AbstractPropertyStore { @Override public void clear() { Set<String> names = listPropertyFullNames(); if (!Util.isEmpty(names)) { client.deleteParameters(new DeleteParametersRequest().withNames(names)); } } PropertyStoreAwsSSM(String path); PropertyStoreAwsSSM(AWSSimpleSystemsManagement clie...
@Test public void testSubSet() { Assert.assertTrue(ff4jConf.containsKey("name")); Configuration conf2 = ff4jConf.subset("prop"); Assert.assertTrue(conf2.containsKey("propInt")); Assert.assertFalse(conf2.containsKey("name")); }
@Override public Configuration subset(String prefix) { Map < String, Property<?>> myProps = ff4jStore().readAllProperties(); PropertyStore ps = new InMemoryPropertyStore(); for (Map.Entry< String, Property<?>> prop : myProps.entrySet()) { if (prop.getKey().startsWith(prefix)) { ps.createProperty(prop.getValue()); } } r...
FF4jConfiguration extends AbstractConfiguration { @Override public Configuration subset(String prefix) { Map < String, Property<?>> myProps = ff4jStore().readAllProperties(); PropertyStore ps = new InMemoryPropertyStore(); for (Map.Entry< String, Property<?>> prop : myProps.entrySet()) { if (prop.getKey().startsWith(pr...
FF4jConfiguration extends AbstractConfiguration { @Override public Configuration subset(String prefix) { Map < String, Property<?>> myProps = ff4jStore().readAllProperties(); PropertyStore ps = new InMemoryPropertyStore(); for (Map.Entry< String, Property<?>> prop : myProps.entrySet()) { if (prop.getKey().startsWith(pr...
FF4jConfiguration extends AbstractConfiguration { @Override public Configuration subset(String prefix) { Map < String, Property<?>> myProps = ff4jStore().readAllProperties(); PropertyStore ps = new InMemoryPropertyStore(); for (Map.Entry< String, Property<?>> prop : myProps.entrySet()) { if (prop.getKey().startsWith(pr...
FF4jConfiguration extends AbstractConfiguration { @Override public Configuration subset(String prefix) { Map < String, Property<?>> myProps = ff4jStore().readAllProperties(); PropertyStore ps = new InMemoryPropertyStore(); for (Map.Entry< String, Property<?>> prop : myProps.entrySet()) { if (prop.getKey().startsWith(pr...
@Test public void testAddProperty() { Assert.assertFalse(ff4jConf.containsKey("myNewProp")); ff4jConf.addProperty("myNewProp", "hello"); Assert.assertTrue(ff4jConf.containsKey("myNewProp")); Assert.assertTrue(pStore.existProperty("myNewProp")); Assert.assertEquals("hello", pStore.readProperty("myNewProp").asString()); ...
@Override public void addProperty(String key, Object value) { ff4jStore().createProperty(PropertyFactory.createProperty(key, value)); }
FF4jConfiguration extends AbstractConfiguration { @Override public void addProperty(String key, Object value) { ff4jStore().createProperty(PropertyFactory.createProperty(key, value)); } }
FF4jConfiguration extends AbstractConfiguration { @Override public void addProperty(String key, Object value) { ff4jStore().createProperty(PropertyFactory.createProperty(key, value)); } FF4jConfiguration(); FF4jConfiguration(PropertyStore ff4jPropertyStore); }
FF4jConfiguration extends AbstractConfiguration { @Override public void addProperty(String key, Object value) { ff4jStore().createProperty(PropertyFactory.createProperty(key, value)); } FF4jConfiguration(); FF4jConfiguration(PropertyStore ff4jPropertyStore); @Override Configuration subset(String prefix); @Override Pro...
FF4jConfiguration extends AbstractConfiguration { @Override public void addProperty(String key, Object value) { ff4jStore().createProperty(PropertyFactory.createProperty(key, value)); } FF4jConfiguration(); FF4jConfiguration(PropertyStore ff4jPropertyStore); @Override Configuration subset(String prefix); @Override Pro...
@Test public void testAddPropertyDirect() { Assert.assertFalse(ff4jConf.containsKey("myNewProp")); ff4jConf.addPropertyDirect("myNewProp", "hello"); Assert.assertTrue(ff4jConf.containsKey("myNewProp")); Assert.assertTrue(pStore.existProperty("myNewProp")); Assert.assertEquals("hello", pStore.readProperty("myNewProp").a...
@Override protected void addPropertyDirect(String key, Object value) { ff4jStore().createProperty(PropertyFactory.createProperty(key, value)); }
FF4jConfiguration extends AbstractConfiguration { @Override protected void addPropertyDirect(String key, Object value) { ff4jStore().createProperty(PropertyFactory.createProperty(key, value)); } }
FF4jConfiguration extends AbstractConfiguration { @Override protected void addPropertyDirect(String key, Object value) { ff4jStore().createProperty(PropertyFactory.createProperty(key, value)); } FF4jConfiguration(); FF4jConfiguration(PropertyStore ff4jPropertyStore); }
FF4jConfiguration extends AbstractConfiguration { @Override protected void addPropertyDirect(String key, Object value) { ff4jStore().createProperty(PropertyFactory.createProperty(key, value)); } FF4jConfiguration(); FF4jConfiguration(PropertyStore ff4jPropertyStore); @Override Configuration subset(String prefix); @Ove...
FF4jConfiguration extends AbstractConfiguration { @Override protected void addPropertyDirect(String key, Object value) { ff4jStore().createProperty(PropertyFactory.createProperty(key, value)); } FF4jConfiguration(); FF4jConfiguration(PropertyStore ff4jPropertyStore); @Override Configuration subset(String prefix); @Ove...
@Test public void testClearProperty() { Assert.assertTrue(ff4jConf.containsKey("propInt")); ff4jConf.clearProperty("propInt"); Assert.assertFalse(ff4jConf.containsKey("propInt")); Assert.assertFalse(pStore.existProperty("myNewProp")); }
@Override public void clearProperty(String key) { ff4jStore().deleteProperty(key); }
FF4jConfiguration extends AbstractConfiguration { @Override public void clearProperty(String key) { ff4jStore().deleteProperty(key); } }
FF4jConfiguration extends AbstractConfiguration { @Override public void clearProperty(String key) { ff4jStore().deleteProperty(key); } FF4jConfiguration(); FF4jConfiguration(PropertyStore ff4jPropertyStore); }
FF4jConfiguration extends AbstractConfiguration { @Override public void clearProperty(String key) { ff4jStore().deleteProperty(key); } FF4jConfiguration(); FF4jConfiguration(PropertyStore ff4jPropertyStore); @Override Configuration subset(String prefix); @Override Properties getProperties(String key); @Override boolea...
FF4jConfiguration extends AbstractConfiguration { @Override public void clearProperty(String key) { ff4jStore().deleteProperty(key); } FF4jConfiguration(); FF4jConfiguration(PropertyStore ff4jPropertyStore); @Override Configuration subset(String prefix); @Override Properties getProperties(String key); @Override boolea...
@Test public void testClear() { Assert.assertTrue(ff4jConf.containsKey("propInt")); ff4jConf.clear(); Assert.assertFalse(ff4jConf.containsKey("propInt")); Assert.assertTrue(ff4jConf.isEmpty()); Assert.assertTrue(pStore.isEmpty()); }
@Override public void clear() { ff4jStore().clear(); }
FF4jConfiguration extends AbstractConfiguration { @Override public void clear() { ff4jStore().clear(); } }
FF4jConfiguration extends AbstractConfiguration { @Override public void clear() { ff4jStore().clear(); } FF4jConfiguration(); FF4jConfiguration(PropertyStore ff4jPropertyStore); }
FF4jConfiguration extends AbstractConfiguration { @Override public void clear() { ff4jStore().clear(); } FF4jConfiguration(); FF4jConfiguration(PropertyStore ff4jPropertyStore); @Override Configuration subset(String prefix); @Override Properties getProperties(String key); @Override boolean isEmpty(); @Override boolean...
FF4jConfiguration extends AbstractConfiguration { @Override public void clear() { ff4jStore().clear(); } FF4jConfiguration(); FF4jConfiguration(PropertyStore ff4jPropertyStore); @Override Configuration subset(String prefix); @Override Properties getProperties(String key); @Override boolean isEmpty(); @Override boolean...
@Test public void testgetKeys() { Assert.assertTrue(ff4jConf.containsKey("propInt")); Assert.assertTrue(ff4jConf.containsKey("propString")); Assert.assertTrue(ff4jConf.getKeys().hasNext()); Iterator<String> propsKeys = ff4jConf.getKeys("prop"); Assert.assertTrue(propsKeys.hasNext()); }
@Override public Iterator<String> getKeys(String prefix) { Set< String > setOfNames = ff4jStore().listPropertyNames(); Set< String > results = new HashSet<String>(); if (setOfNames != null && setOfNames.size() > 0) { for (String name : setOfNames) { if (name.startsWith(prefix)) { results.add(name); } } } return results...
FF4jConfiguration extends AbstractConfiguration { @Override public Iterator<String> getKeys(String prefix) { Set< String > setOfNames = ff4jStore().listPropertyNames(); Set< String > results = new HashSet<String>(); if (setOfNames != null && setOfNames.size() > 0) { for (String name : setOfNames) { if (name.startsWith(...
FF4jConfiguration extends AbstractConfiguration { @Override public Iterator<String> getKeys(String prefix) { Set< String > setOfNames = ff4jStore().listPropertyNames(); Set< String > results = new HashSet<String>(); if (setOfNames != null && setOfNames.size() > 0) { for (String name : setOfNames) { if (name.startsWith(...
FF4jConfiguration extends AbstractConfiguration { @Override public Iterator<String> getKeys(String prefix) { Set< String > setOfNames = ff4jStore().listPropertyNames(); Set< String > results = new HashSet<String>(); if (setOfNames != null && setOfNames.size() > 0) { for (String name : setOfNames) { if (name.startsWith(...
FF4jConfiguration extends AbstractConfiguration { @Override public Iterator<String> getKeys(String prefix) { Set< String > setOfNames = ff4jStore().listPropertyNames(); Set< String > results = new HashSet<String>(); if (setOfNames != null && setOfNames.size() > 0) { for (String name : setOfNames) { if (name.startsWith(...
@Test public void testClone() { LogoEnvPLS e2 = (LogoEnvPLS) e1.clone(); assertEquals(e1, e2); assertNotSame(e1,e2); assertEquals(e1.getClass(),e2.getClass()); }
@Override public Object clone() { Set<TurtlePLSInLogo>[][] turtleSet = new Set[this.width][this.height]; Set<Mark>[][] markSet = new Set[this.width][this.height]; for(int x = 0; x < this.width; x++) { for(int y = 0; y < this.height; y++) { turtleSet[x][y] = new HashSet(); markSet[x][y] = new HashSet(); if (!this.marks[...
LogoEnvPLS extends AbstractLocalStateOfEnvironment implements Cloneable { @Override public Object clone() { Set<TurtlePLSInLogo>[][] turtleSet = new Set[this.width][this.height]; Set<Mark>[][] markSet = new Set[this.width][this.height]; for(int x = 0; x < this.width; x++) { for(int y = 0; y < this.height; y++) { turtle...
LogoEnvPLS extends AbstractLocalStateOfEnvironment implements Cloneable { @Override public Object clone() { Set<TurtlePLSInLogo>[][] turtleSet = new Set[this.width][this.height]; Set<Mark>[][] markSet = new Set[this.width][this.height]; for(int x = 0; x < this.width; x++) { for(int y = 0; y < this.height; y++) { turtle...
LogoEnvPLS extends AbstractLocalStateOfEnvironment implements Cloneable { @Override public Object clone() { Set<TurtlePLSInLogo>[][] turtleSet = new Set[this.width][this.height]; Set<Mark>[][] markSet = new Set[this.width][this.height]; for(int x = 0; x < this.width; x++) { for(int y = 0; y < this.height; y++) { turtle...
LogoEnvPLS extends AbstractLocalStateOfEnvironment implements Cloneable { @Override public Object clone() { Set<TurtlePLSInLogo>[][] turtleSet = new Set[this.width][this.height]; Set<Mark>[][] markSet = new Set[this.width][this.height]; for(int x = 0; x < this.width; x++) { for(int y = 0; y < this.height; y++) { turtle...
@Test public void stripCrLf() throws Exception { assertThat(Util.stripCrLf("")).isEqualTo(""); assertThat(Util.stripCrLf("\n\rtest\r\n")).isEqualTo("\\n\\rtest\\r\\n"); }
@Nonnull public static String stripCrLf(@Nonnull final String text) { final char[] src = text.toCharArray(); final StringBuilder dest = new StringBuilder(src.length + 10); for (final char ch : src) { switch (ch) { case 10: dest.append("\\n"); break; case 13: dest.append("\\r"); break; default: dest.append(ch); } } retu...
Util { @Nonnull public static String stripCrLf(@Nonnull final String text) { final char[] src = text.toCharArray(); final StringBuilder dest = new StringBuilder(src.length + 10); for (final char ch : src) { switch (ch) { case 10: dest.append("\\n"); break; case 13: dest.append("\\r"); break; default: dest.append(ch); }...
Util { @Nonnull public static String stripCrLf(@Nonnull final String text) { final char[] src = text.toCharArray(); final StringBuilder dest = new StringBuilder(src.length + 10); for (final char ch : src) { switch (ch) { case 10: dest.append("\\n"); break; case 13: dest.append("\\r"); break; default: dest.append(ch); }...
Util { @Nonnull public static String stripCrLf(@Nonnull final String text) { final char[] src = text.toCharArray(); final StringBuilder dest = new StringBuilder(src.length + 10); for (final char ch : src) { switch (ch) { case 10: dest.append("\\n"); break; case 13: dest.append("\\r"); break; default: dest.append(ch); }...
Util { @Nonnull public static String stripCrLf(@Nonnull final String text) { final char[] src = text.toCharArray(); final StringBuilder dest = new StringBuilder(src.length + 10); for (final char ch : src) { switch (ch) { case 10: dest.append("\\n"); break; case 13: dest.append("\\r"); break; default: dest.append(ch); }...
@Test public void testAttrs() { final LogContext ctx = Mockito.mock(LogContext.class); when(ctx.getAttr(eq("attr1"))).thenReturn("value1"); when(ctx.getAttr(eq("attr2"))).thenReturn(null); when(ctx.getAttr(eq("attr3"))).thenReturn(new Object() { @Override public String toString() { return "to-string"; } }); String resu...
@Override public String format(@Nonnull final LogContext log) { final StringBuilder builder = new StringBuilder(); for (final Token token : tokens) { token.append(log, builder); } return builder.toString(); }
SimpleTextFormat implements Format { @Override public String format(@Nonnull final LogContext log) { final StringBuilder builder = new StringBuilder(); for (final Token token : tokens) { token.append(log, builder); } return builder.toString(); } }
SimpleTextFormat implements Format { @Override public String format(@Nonnull final LogContext log) { final StringBuilder builder = new StringBuilder(); for (final Token token : tokens) { token.append(log, builder); } return builder.toString(); } SimpleTextFormat(@Nonnull final String format); SimpleTextFormat(@Nonnull...
SimpleTextFormat implements Format { @Override public String format(@Nonnull final LogContext log) { final StringBuilder builder = new StringBuilder(); for (final Token token : tokens) { token.append(log, builder); } return builder.toString(); } SimpleTextFormat(@Nonnull final String format); SimpleTextFormat(@Nonnull...
SimpleTextFormat implements Format { @Override public String format(@Nonnull final LogContext log) { final StringBuilder builder = new StringBuilder(); for (final Token token : tokens) { token.append(log, builder); } return builder.toString(); } SimpleTextFormat(@Nonnull final String format); SimpleTextFormat(@Nonnull...
@Test public void currentThrowExceptionIfNoLogContext() throws Exception { try { SmartLog.current(); } catch (Exception e) { Assertions.assertThat(e).hasMessage("Loggable context is absent"); } }
@Nonnull public static LogContext current() { final Deque<LogContext> contextQueue = CONTEXTS.get(); if (!contextQueue.isEmpty()) { return contextQueue.peek(); } else { throw new RuntimeException("Loggable context is absent"); } }
SmartLog { @Nonnull public static LogContext current() { final Deque<LogContext> contextQueue = CONTEXTS.get(); if (!contextQueue.isEmpty()) { return contextQueue.peek(); } else { throw new RuntimeException("Loggable context is absent"); } } }
SmartLog { @Nonnull public static LogContext current() { final Deque<LogContext> contextQueue = CONTEXTS.get(); if (!contextQueue.isEmpty()) { return contextQueue.peek(); } else { throw new RuntimeException("Loggable context is absent"); } } }
SmartLog { @Nonnull public static LogContext current() { final Deque<LogContext> contextQueue = CONTEXTS.get(); if (!contextQueue.isEmpty()) { return contextQueue.peek(); } else { throw new RuntimeException("Loggable context is absent"); } } @Nonnull static LogContext start(@Nonnull final Output output); @Nonnull stat...
SmartLog { @Nonnull public static LogContext current() { final Deque<LogContext> contextQueue = CONTEXTS.get(); if (!contextQueue.isEmpty()) { return contextQueue.peek(); } else { throw new RuntimeException("Loggable context is absent"); } } @Nonnull static LogContext start(@Nonnull final Output output); @Nonnull stat...
@Test public void finishThrowExceptionIfNoLogContext() throws Exception { try { SmartLog.finish(); } catch (Exception e) { Assertions.assertThat(e).hasMessage("Loggable context is absent"); } }
public static void finish() { final Deque<LogContext> list = CONTEXTS.get(); if (!list.isEmpty()) { final LogContext ctx = list.pop(); final Object loggableObject = ctx.loggableObject(); if (loggableObject != null && loggableObject instanceof LoggableCallback) { final LoggableCallback callback = (LoggableCallback) logg...
SmartLog { public static void finish() { final Deque<LogContext> list = CONTEXTS.get(); if (!list.isEmpty()) { final LogContext ctx = list.pop(); final Object loggableObject = ctx.loggableObject(); if (loggableObject != null && loggableObject instanceof LoggableCallback) { final LoggableCallback callback = (LoggableCal...
SmartLog { public static void finish() { final Deque<LogContext> list = CONTEXTS.get(); if (!list.isEmpty()) { final LogContext ctx = list.pop(); final Object loggableObject = ctx.loggableObject(); if (loggableObject != null && loggableObject instanceof LoggableCallback) { final LoggableCallback callback = (LoggableCal...
SmartLog { public static void finish() { final Deque<LogContext> list = CONTEXTS.get(); if (!list.isEmpty()) { final LogContext ctx = list.pop(); final Object loggableObject = ctx.loggableObject(); if (loggableObject != null && loggableObject instanceof LoggableCallback) { final LoggableCallback callback = (LoggableCal...
SmartLog { public static void finish() { final Deque<LogContext> list = CONTEXTS.get(); if (!list.isEmpty()) { final LogContext ctx = list.pop(); final Object loggableObject = ctx.loggableObject(); if (loggableObject != null && loggableObject instanceof LoggableCallback) { final LoggableCallback callback = (LoggableCal...
@Test public void doNotWriteDebugLogIfDisabled() throws Exception { when(logger.isDebugEnabled()).thenReturn(false); when(ctx.level()).thenReturn(LogLevel.DEBUG); output.write(ctx); Mockito.verify(logger, never()).debug(anyString()); Mockito.verify(logger).isDebugEnabled(); }
@Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : suppressedThrowables) { throwable...
Slf4JOutput implements Output { @Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : s...
Slf4JOutput implements Output { @Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : s...
Slf4JOutput implements Output { @Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : s...
Slf4JOutput implements Output { @Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : s...
@Test public void doNotWriteInfoLogIfDisabled() throws Exception { when(logger.isInfoEnabled()).thenReturn(false); when(ctx.level()).thenReturn(LogLevel.INFO); output.write(ctx); Mockito.verify(logger, never()).info(anyString()); Mockito.verify(logger).isInfoEnabled(); }
@Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : suppressedThrowables) { throwable...
Slf4JOutput implements Output { @Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : s...
Slf4JOutput implements Output { @Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : s...
Slf4JOutput implements Output { @Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : s...
Slf4JOutput implements Output { @Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : s...
@Test public void doNotWriteWarnLogIfDisabled() throws Exception { when(logger.isWarnEnabled()).thenReturn(false); when(ctx.level()).thenReturn(LogLevel.WARN); output.write(ctx); Mockito.verify(logger, never()).warn(anyString()); Mockito.verify(logger).isWarnEnabled(); }
@Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : suppressedThrowables) { throwable...
Slf4JOutput implements Output { @Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : s...
Slf4JOutput implements Output { @Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : s...
Slf4JOutput implements Output { @Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : s...
Slf4JOutput implements Output { @Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : s...
@Test public void doNotWriteErrorLogIfDisabled() throws Exception { when(logger.isErrorEnabled()).thenReturn(false); when(ctx.level()).thenReturn(LogLevel.ERROR); output.write(ctx); Mockito.verify(logger, never()).error(anyString()); Mockito.verify(logger).isErrorEnabled(); }
@Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : suppressedThrowables) { throwable...
Slf4JOutput implements Output { @Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : s...
Slf4JOutput implements Output { @Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : s...
Slf4JOutput implements Output { @Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : s...
Slf4JOutput implements Output { @Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : s...
@Test public void testLogDebug() throws Exception { when(logger.isDebugEnabled()).thenReturn(true); when(ctx.level()).thenReturn(LogLevel.DEBUG); output.write(ctx); Mockito.verify(logger).debug(anyString()); }
@Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : suppressedThrowables) { throwable...
Slf4JOutput implements Output { @Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : s...
Slf4JOutput implements Output { @Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : s...
Slf4JOutput implements Output { @Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : s...
Slf4JOutput implements Output { @Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : s...
@Test public void testLogInfo() throws Exception { when(logger.isInfoEnabled()).thenReturn(true); when(ctx.level()).thenReturn(LogLevel.INFO); output.write(ctx); Mockito.verify(logger).info(anyString()); }
@Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : suppressedThrowables) { throwable...
Slf4JOutput implements Output { @Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : s...
Slf4JOutput implements Output { @Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : s...
Slf4JOutput implements Output { @Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : s...
Slf4JOutput implements Output { @Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : s...
@Test public void testLogWarn() throws Exception { when(logger.isWarnEnabled()).thenReturn(true); when(ctx.level()).thenReturn(LogLevel.WARN); output.write(ctx); Mockito.verify(logger).warn(anyString()); }
@Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : suppressedThrowables) { throwable...
Slf4JOutput implements Output { @Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : s...
Slf4JOutput implements Output { @Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : s...
Slf4JOutput implements Output { @Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : s...
Slf4JOutput implements Output { @Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : s...
@Test public void findRootEnclosingClass() throws Exception { assertThat(Util.findRootEnclosingClass(UtilTest.class)).isSameAs(UtilTest.class); }
@Nonnull public static Class findRootEnclosingClass(@Nonnull final Class clazz) { Class curr = clazz; while (true) { Class declaringClass = curr.getEnclosingClass(); if (declaringClass != null) { curr = declaringClass; } else { return curr; } } }
Util { @Nonnull public static Class findRootEnclosingClass(@Nonnull final Class clazz) { Class curr = clazz; while (true) { Class declaringClass = curr.getEnclosingClass(); if (declaringClass != null) { curr = declaringClass; } else { return curr; } } } }
Util { @Nonnull public static Class findRootEnclosingClass(@Nonnull final Class clazz) { Class curr = clazz; while (true) { Class declaringClass = curr.getEnclosingClass(); if (declaringClass != null) { curr = declaringClass; } else { return curr; } } } }
Util { @Nonnull public static Class findRootEnclosingClass(@Nonnull final Class clazz) { Class curr = clazz; while (true) { Class declaringClass = curr.getEnclosingClass(); if (declaringClass != null) { curr = declaringClass; } else { return curr; } } } @Nonnull static String stripCrLf(@Nonnull final String text); @No...
Util { @Nonnull public static Class findRootEnclosingClass(@Nonnull final Class clazz) { Class curr = clazz; while (true) { Class declaringClass = curr.getEnclosingClass(); if (declaringClass != null) { curr = declaringClass; } else { return curr; } } } @Nonnull static String stripCrLf(@Nonnull final String text); @No...
@Test public void testLogError() throws Exception { when(logger.isErrorEnabled()).thenReturn(true); when(ctx.level()).thenReturn(LogLevel.ERROR); output.write(ctx); Mockito.verify(logger).error(anyString()); }
@Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : suppressedThrowables) { throwable...
Slf4JOutput implements Output { @Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : s...
Slf4JOutput implements Output { @Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : s...
Slf4JOutput implements Output { @Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : s...
Slf4JOutput implements Output { @Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : s...
@Test public void testLogInfoIfLogLevelNull() throws Exception { when(logger.isInfoEnabled()).thenReturn(true); when(ctx.level()).thenReturn(null); output.write(ctx); Mockito.verify(logger).info(anyString()); }
@Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : suppressedThrowables) { throwable...
Slf4JOutput implements Output { @Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : s...
Slf4JOutput implements Output { @Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : s...
Slf4JOutput implements Output { @Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : s...
Slf4JOutput implements Output { @Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : s...
@Test public void testLogDebugWithThrowable() throws Exception { final Exception exception = new Exception(); when(logger.isDebugEnabled()).thenReturn(true); when(ctx.level()).thenReturn(LogLevel.DEBUG); when(ctx.throwable()).thenReturn(exception); output.write(ctx); Mockito.verify(logger).debug(anyString(), eq(excepti...
@Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : suppressedThrowables) { throwable...
Slf4JOutput implements Output { @Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : s...
Slf4JOutput implements Output { @Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : s...
Slf4JOutput implements Output { @Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : s...
Slf4JOutput implements Output { @Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : s...
@Test public void testLogInfogWithThrowable() throws Exception { final Exception exception = new Exception(); when(logger.isInfoEnabled()).thenReturn(true); when(ctx.level()).thenReturn(LogLevel.INFO); when(ctx.throwable()).thenReturn(exception); output.write(ctx); Mockito.verify(logger).info(anyString(), eq(exception)...
@Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : suppressedThrowables) { throwable...
Slf4JOutput implements Output { @Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : s...
Slf4JOutput implements Output { @Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : s...
Slf4JOutput implements Output { @Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : s...
Slf4JOutput implements Output { @Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : s...
@Test public void testLogWarngWithThrowable() throws Exception { final Exception exception = new Exception(); when(logger.isWarnEnabled()).thenReturn(true); when(ctx.level()).thenReturn(LogLevel.WARN); when(ctx.throwable()).thenReturn(exception); output.write(ctx); Mockito.verify(logger).warn(anyString(), eq(exception)...
@Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : suppressedThrowables) { throwable...
Slf4JOutput implements Output { @Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : s...
Slf4JOutput implements Output { @Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : s...
Slf4JOutput implements Output { @Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : s...
Slf4JOutput implements Output { @Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : s...
@Test public void testLogErrorgWithThrowable() throws Exception { final Exception exception = new Exception(); when(logger.isErrorEnabled()).thenReturn(true); when(ctx.level()).thenReturn(LogLevel.ERROR); when(ctx.throwable()).thenReturn(exception); output.write(ctx); Mockito.verify(logger).error(anyString(), eq(except...
@Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : suppressedThrowables) { throwable...
Slf4JOutput implements Output { @Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : s...
Slf4JOutput implements Output { @Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : s...
Slf4JOutput implements Output { @Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : s...
Slf4JOutput implements Output { @Override public void write(final LogContext log) { final LogLevel level = log.level(); final Throwable throwable = log.throwable(); final ArrayList<Throwable> suppressedThrowables = log.suppressedThrowables(); if (throwable != null && suppressedThrowables != null) { for (Throwable t : s...
@Test public void testFailFastIfNoLogger() { try { Slf4JOutput.create() .build(); Assert.fail(); } catch (Exception e) { assertThat(e).hasMessage("Logger is absent"); } }
public static Builder create() { return new Builder(); }
Slf4JOutput implements Output { public static Builder create() { return new Builder(); } }
Slf4JOutput implements Output { public static Builder create() { return new Builder(); } Slf4JOutput(final Builder builder); }
Slf4JOutput implements Output { public static Builder create() { return new Builder(); } Slf4JOutput(final Builder builder); static Builder create(); @Override void write(final LogContext log); @Nonnull Logger getLogger(); @Nullable Format getFormat(); @Nullable Boolean getReplaceCrLf(); }
Slf4JOutput implements Output { public static Builder create() { return new Builder(); } Slf4JOutput(final Builder builder); static Builder create(); @Override void write(final LogContext log); @Nonnull Logger getLogger(); @Nullable Format getFormat(); @Nullable Boolean getReplaceCrLf(); }
@Test public void findRootEnclosingClassForAnonymousClass() throws Exception { Class<? extends Object> internalClass = new Object() { }.getClass(); assertThat(Util.findRootEnclosingClass(internalClass)).isSameAs(UtilTest.class); }
@Nonnull public static Class findRootEnclosingClass(@Nonnull final Class clazz) { Class curr = clazz; while (true) { Class declaringClass = curr.getEnclosingClass(); if (declaringClass != null) { curr = declaringClass; } else { return curr; } } }
Util { @Nonnull public static Class findRootEnclosingClass(@Nonnull final Class clazz) { Class curr = clazz; while (true) { Class declaringClass = curr.getEnclosingClass(); if (declaringClass != null) { curr = declaringClass; } else { return curr; } } } }
Util { @Nonnull public static Class findRootEnclosingClass(@Nonnull final Class clazz) { Class curr = clazz; while (true) { Class declaringClass = curr.getEnclosingClass(); if (declaringClass != null) { curr = declaringClass; } else { return curr; } } } }
Util { @Nonnull public static Class findRootEnclosingClass(@Nonnull final Class clazz) { Class curr = clazz; while (true) { Class declaringClass = curr.getEnclosingClass(); if (declaringClass != null) { curr = declaringClass; } else { return curr; } } } @Nonnull static String stripCrLf(@Nonnull final String text); @No...
Util { @Nonnull public static Class findRootEnclosingClass(@Nonnull final Class clazz) { Class curr = clazz; while (true) { Class declaringClass = curr.getEnclosingClass(); if (declaringClass != null) { curr = declaringClass; } else { return curr; } } } @Nonnull static String stripCrLf(@Nonnull final String text); @No...
@Test public void findRootEnclosingClassForInternalClass() throws Exception { assertThat(Util.findRootEnclosingClass(InternalClass.class)).isSameAs(UtilTest.class); }
@Nonnull public static Class findRootEnclosingClass(@Nonnull final Class clazz) { Class curr = clazz; while (true) { Class declaringClass = curr.getEnclosingClass(); if (declaringClass != null) { curr = declaringClass; } else { return curr; } } }
Util { @Nonnull public static Class findRootEnclosingClass(@Nonnull final Class clazz) { Class curr = clazz; while (true) { Class declaringClass = curr.getEnclosingClass(); if (declaringClass != null) { curr = declaringClass; } else { return curr; } } } }
Util { @Nonnull public static Class findRootEnclosingClass(@Nonnull final Class clazz) { Class curr = clazz; while (true) { Class declaringClass = curr.getEnclosingClass(); if (declaringClass != null) { curr = declaringClass; } else { return curr; } } } }
Util { @Nonnull public static Class findRootEnclosingClass(@Nonnull final Class clazz) { Class curr = clazz; while (true) { Class declaringClass = curr.getEnclosingClass(); if (declaringClass != null) { curr = declaringClass; } else { return curr; } } } @Nonnull static String stripCrLf(@Nonnull final String text); @No...
Util { @Nonnull public static Class findRootEnclosingClass(@Nonnull final Class clazz) { Class curr = clazz; while (true) { Class declaringClass = curr.getEnclosingClass(); if (declaringClass != null) { curr = declaringClass; } else { return curr; } } } @Nonnull static String stripCrLf(@Nonnull final String text); @No...
@Test public void testTitle() { final LogContext ctx = Mockito.mock(LogContext.class); when(ctx.title()).thenReturn("test-title"); String result = new SimpleTextFormat("[${title}]").format(ctx); Assertions.assertThat(result).isEqualTo("[test-title]"); }
@Override public String format(@Nonnull final LogContext log) { final StringBuilder builder = new StringBuilder(); for (final Token token : tokens) { token.append(log, builder); } return builder.toString(); }
SimpleTextFormat implements Format { @Override public String format(@Nonnull final LogContext log) { final StringBuilder builder = new StringBuilder(); for (final Token token : tokens) { token.append(log, builder); } return builder.toString(); } }
SimpleTextFormat implements Format { @Override public String format(@Nonnull final LogContext log) { final StringBuilder builder = new StringBuilder(); for (final Token token : tokens) { token.append(log, builder); } return builder.toString(); } SimpleTextFormat(@Nonnull final String format); SimpleTextFormat(@Nonnull...
SimpleTextFormat implements Format { @Override public String format(@Nonnull final LogContext log) { final StringBuilder builder = new StringBuilder(); for (final Token token : tokens) { token.append(log, builder); } return builder.toString(); } SimpleTextFormat(@Nonnull final String format); SimpleTextFormat(@Nonnull...
SimpleTextFormat implements Format { @Override public String format(@Nonnull final LogContext log) { final StringBuilder builder = new StringBuilder(); for (final Token token : tokens) { token.append(log, builder); } return builder.toString(); } SimpleTextFormat(@Nonnull final String format); SimpleTextFormat(@Nonnull...
@Test public void testResult() { final LogContext ctx = Mockito.mock(LogContext.class); when(ctx.result()).thenReturn("test-result"); String result = new SimpleTextFormat("[${result}]").format(ctx); Assertions.assertThat(result).isEqualTo("[test-result]"); }
@Override public String format(@Nonnull final LogContext log) { final StringBuilder builder = new StringBuilder(); for (final Token token : tokens) { token.append(log, builder); } return builder.toString(); }
SimpleTextFormat implements Format { @Override public String format(@Nonnull final LogContext log) { final StringBuilder builder = new StringBuilder(); for (final Token token : tokens) { token.append(log, builder); } return builder.toString(); } }
SimpleTextFormat implements Format { @Override public String format(@Nonnull final LogContext log) { final StringBuilder builder = new StringBuilder(); for (final Token token : tokens) { token.append(log, builder); } return builder.toString(); } SimpleTextFormat(@Nonnull final String format); SimpleTextFormat(@Nonnull...
SimpleTextFormat implements Format { @Override public String format(@Nonnull final LogContext log) { final StringBuilder builder = new StringBuilder(); for (final Token token : tokens) { token.append(log, builder); } return builder.toString(); } SimpleTextFormat(@Nonnull final String format); SimpleTextFormat(@Nonnull...
SimpleTextFormat implements Format { @Override public String format(@Nonnull final LogContext log) { final StringBuilder builder = new StringBuilder(); for (final Token token : tokens) { token.append(log, builder); } return builder.toString(); } SimpleTextFormat(@Nonnull final String format); SimpleTextFormat(@Nonnull...
@Test public void testResultNull() { final LogContext ctx = Mockito.mock(LogContext.class); when(ctx.result()).thenReturn(null); String result = new SimpleTextFormat("[${result}]").format(ctx); Assertions.assertThat(result).isEqualTo("[]"); }
@Override public String format(@Nonnull final LogContext log) { final StringBuilder builder = new StringBuilder(); for (final Token token : tokens) { token.append(log, builder); } return builder.toString(); }
SimpleTextFormat implements Format { @Override public String format(@Nonnull final LogContext log) { final StringBuilder builder = new StringBuilder(); for (final Token token : tokens) { token.append(log, builder); } return builder.toString(); } }
SimpleTextFormat implements Format { @Override public String format(@Nonnull final LogContext log) { final StringBuilder builder = new StringBuilder(); for (final Token token : tokens) { token.append(log, builder); } return builder.toString(); } SimpleTextFormat(@Nonnull final String format); SimpleTextFormat(@Nonnull...
SimpleTextFormat implements Format { @Override public String format(@Nonnull final LogContext log) { final StringBuilder builder = new StringBuilder(); for (final Token token : tokens) { token.append(log, builder); } return builder.toString(); } SimpleTextFormat(@Nonnull final String format); SimpleTextFormat(@Nonnull...
SimpleTextFormat implements Format { @Override public String format(@Nonnull final LogContext log) { final StringBuilder builder = new StringBuilder(); for (final Token token : tokens) { token.append(log, builder); } return builder.toString(); } SimpleTextFormat(@Nonnull final String format); SimpleTextFormat(@Nonnull...
@Test public void testResultToString() { final LogContext ctx = Mockito.mock(LogContext.class); when(ctx.result()).thenReturn(new Object() { @Override public String toString() { return "to-string"; } }); String result = new SimpleTextFormat("[${result}]").format(ctx); Assertions.assertThat(result).isEqualTo("[to-string...
@Override public String format(@Nonnull final LogContext log) { final StringBuilder builder = new StringBuilder(); for (final Token token : tokens) { token.append(log, builder); } return builder.toString(); }
SimpleTextFormat implements Format { @Override public String format(@Nonnull final LogContext log) { final StringBuilder builder = new StringBuilder(); for (final Token token : tokens) { token.append(log, builder); } return builder.toString(); } }
SimpleTextFormat implements Format { @Override public String format(@Nonnull final LogContext log) { final StringBuilder builder = new StringBuilder(); for (final Token token : tokens) { token.append(log, builder); } return builder.toString(); } SimpleTextFormat(@Nonnull final String format); SimpleTextFormat(@Nonnull...
SimpleTextFormat implements Format { @Override public String format(@Nonnull final LogContext log) { final StringBuilder builder = new StringBuilder(); for (final Token token : tokens) { token.append(log, builder); } return builder.toString(); } SimpleTextFormat(@Nonnull final String format); SimpleTextFormat(@Nonnull...
SimpleTextFormat implements Format { @Override public String format(@Nonnull final LogContext log) { final StringBuilder builder = new StringBuilder(); for (final Token token : tokens) { token.append(log, builder); } return builder.toString(); } SimpleTextFormat(@Nonnull final String format); SimpleTextFormat(@Nonnull...
@Test public void testTrace() { final LogContext ctx = Mockito.mock(LogContext.class); when(ctx.trace()).thenReturn("test-trace"); String result = new SimpleTextFormat("[${trace}]").format(ctx); Assertions.assertThat(result).isEqualTo("[test-trace]"); }
@Override public String format(@Nonnull final LogContext log) { final StringBuilder builder = new StringBuilder(); for (final Token token : tokens) { token.append(log, builder); } return builder.toString(); }
SimpleTextFormat implements Format { @Override public String format(@Nonnull final LogContext log) { final StringBuilder builder = new StringBuilder(); for (final Token token : tokens) { token.append(log, builder); } return builder.toString(); } }
SimpleTextFormat implements Format { @Override public String format(@Nonnull final LogContext log) { final StringBuilder builder = new StringBuilder(); for (final Token token : tokens) { token.append(log, builder); } return builder.toString(); } SimpleTextFormat(@Nonnull final String format); SimpleTextFormat(@Nonnull...
SimpleTextFormat implements Format { @Override public String format(@Nonnull final LogContext log) { final StringBuilder builder = new StringBuilder(); for (final Token token : tokens) { token.append(log, builder); } return builder.toString(); } SimpleTextFormat(@Nonnull final String format); SimpleTextFormat(@Nonnull...
SimpleTextFormat implements Format { @Override public String format(@Nonnull final LogContext log) { final StringBuilder builder = new StringBuilder(); for (final Token token : tokens) { token.append(log, builder); } return builder.toString(); } SimpleTextFormat(@Nonnull final String format); SimpleTextFormat(@Nonnull...
@Test public void testTime() { final LogContext ctx = Mockito.mock(LogContext.class); when(ctx.startTime()).thenReturn(100L); when(ctx.endTime()).thenReturn(300L); String result = new SimpleTextFormat("[${time}]").format(ctx); Assertions.assertThat(result).isEqualTo("[200]"); }
@Override public String format(@Nonnull final LogContext log) { final StringBuilder builder = new StringBuilder(); for (final Token token : tokens) { token.append(log, builder); } return builder.toString(); }
SimpleTextFormat implements Format { @Override public String format(@Nonnull final LogContext log) { final StringBuilder builder = new StringBuilder(); for (final Token token : tokens) { token.append(log, builder); } return builder.toString(); } }
SimpleTextFormat implements Format { @Override public String format(@Nonnull final LogContext log) { final StringBuilder builder = new StringBuilder(); for (final Token token : tokens) { token.append(log, builder); } return builder.toString(); } SimpleTextFormat(@Nonnull final String format); SimpleTextFormat(@Nonnull...
SimpleTextFormat implements Format { @Override public String format(@Nonnull final LogContext log) { final StringBuilder builder = new StringBuilder(); for (final Token token : tokens) { token.append(log, builder); } return builder.toString(); } SimpleTextFormat(@Nonnull final String format); SimpleTextFormat(@Nonnull...
SimpleTextFormat implements Format { @Override public String format(@Nonnull final LogContext log) { final StringBuilder builder = new StringBuilder(); for (final Token token : tokens) { token.append(log, builder); } return builder.toString(); } SimpleTextFormat(@Nonnull final String format); SimpleTextFormat(@Nonnull...
@Test public void createWithAbsolutePath() throws URISyntaxException { URI schemaUri = getClass().getResource("/schema/address.json").toURI(); Schema schema = new SchemaStore().create(schemaUri, "#/."); assertThat(schema, is(notNullValue())); assertThat(schema.getId(), is(equalTo(schemaUri))); assertThat(schema.getCont...
public synchronized Schema create(URI id, String refFragmentPathDelimiters) { URI normalizedId = id.normalize(); if (!schemas.containsKey(normalizedId)) { URI baseId = removeFragment(id).normalize(); JsonNode baseContent = contentResolver.resolve(baseId); Schema baseSchema = new Schema(baseId, baseContent, null); if (n...
SchemaStore { public synchronized Schema create(URI id, String refFragmentPathDelimiters) { URI normalizedId = id.normalize(); if (!schemas.containsKey(normalizedId)) { URI baseId = removeFragment(id).normalize(); JsonNode baseContent = contentResolver.resolve(baseId); Schema baseSchema = new Schema(baseId, baseContent...
SchemaStore { public synchronized Schema create(URI id, String refFragmentPathDelimiters) { URI normalizedId = id.normalize(); if (!schemas.containsKey(normalizedId)) { URI baseId = removeFragment(id).normalize(); JsonNode baseContent = contentResolver.resolve(baseId); Schema baseSchema = new Schema(baseId, baseContent...
SchemaStore { public synchronized Schema create(URI id, String refFragmentPathDelimiters) { URI normalizedId = id.normalize(); if (!schemas.containsKey(normalizedId)) { URI baseId = removeFragment(id).normalize(); JsonNode baseContent = contentResolver.resolve(baseId); Schema baseSchema = new Schema(baseId, baseContent...
SchemaStore { public synchronized Schema create(URI id, String refFragmentPathDelimiters) { URI normalizedId = id.normalize(); if (!schemas.containsKey(normalizedId)) { URI baseId = removeFragment(id).normalize(); JsonNode baseContent = contentResolver.resolve(baseId); Schema baseSchema = new Schema(baseId, baseContent...
@Test public void arrayWithUniqueItemsProducesSet() { JCodeModel codeModel = new JCodeModel(); JPackage jpackage = codeModel._package(getClass().getPackage().getName()); ObjectMapper mapper = new ObjectMapper(); ObjectNode itemsNode = mapper.createObjectNode(); itemsNode.put("type", "integer"); ObjectNode propertyNode ...
@Override public JClass apply(String nodeName, JsonNode node, JsonNode parent, JPackage jpackage, Schema schema) { boolean uniqueItems = node.has("uniqueItems") && node.get("uniqueItems").asBoolean(); boolean rootSchemaIsArray = !schema.isGenerated(); JType itemType; if (node.has("items")) { itemType = ruleFactory.getS...
ArrayRule implements Rule<JPackage, JClass> { @Override public JClass apply(String nodeName, JsonNode node, JsonNode parent, JPackage jpackage, Schema schema) { boolean uniqueItems = node.has("uniqueItems") && node.get("uniqueItems").asBoolean(); boolean rootSchemaIsArray = !schema.isGenerated(); JType itemType; if (no...
ArrayRule implements Rule<JPackage, JClass> { @Override public JClass apply(String nodeName, JsonNode node, JsonNode parent, JPackage jpackage, Schema schema) { boolean uniqueItems = node.has("uniqueItems") && node.get("uniqueItems").asBoolean(); boolean rootSchemaIsArray = !schema.isGenerated(); JType itemType; if (no...
ArrayRule implements Rule<JPackage, JClass> { @Override public JClass apply(String nodeName, JsonNode node, JsonNode parent, JPackage jpackage, Schema schema) { boolean uniqueItems = node.has("uniqueItems") && node.get("uniqueItems").asBoolean(); boolean rootSchemaIsArray = !schema.isGenerated(); JType itemType; if (no...
ArrayRule implements Rule<JPackage, JClass> { @Override public JClass apply(String nodeName, JsonNode node, JsonNode parent, JPackage jpackage, Schema schema) { boolean uniqueItems = node.has("uniqueItems") && node.get("uniqueItems").asBoolean(); boolean rootSchemaIsArray = !schema.isGenerated(); JType itemType; if (no...
@Test public void arrayWithNonUniqueItemsProducesList() { JCodeModel codeModel = new JCodeModel(); JPackage jpackage = codeModel._package(getClass().getPackage().getName()); ObjectMapper mapper = new ObjectMapper(); ObjectNode itemsNode = mapper.createObjectNode(); itemsNode.put("type", "number"); ObjectNode propertyNo...
@Override public JClass apply(String nodeName, JsonNode node, JsonNode parent, JPackage jpackage, Schema schema) { boolean uniqueItems = node.has("uniqueItems") && node.get("uniqueItems").asBoolean(); boolean rootSchemaIsArray = !schema.isGenerated(); JType itemType; if (node.has("items")) { itemType = ruleFactory.getS...
ArrayRule implements Rule<JPackage, JClass> { @Override public JClass apply(String nodeName, JsonNode node, JsonNode parent, JPackage jpackage, Schema schema) { boolean uniqueItems = node.has("uniqueItems") && node.get("uniqueItems").asBoolean(); boolean rootSchemaIsArray = !schema.isGenerated(); JType itemType; if (no...
ArrayRule implements Rule<JPackage, JClass> { @Override public JClass apply(String nodeName, JsonNode node, JsonNode parent, JPackage jpackage, Schema schema) { boolean uniqueItems = node.has("uniqueItems") && node.get("uniqueItems").asBoolean(); boolean rootSchemaIsArray = !schema.isGenerated(); JType itemType; if (no...
ArrayRule implements Rule<JPackage, JClass> { @Override public JClass apply(String nodeName, JsonNode node, JsonNode parent, JPackage jpackage, Schema schema) { boolean uniqueItems = node.has("uniqueItems") && node.get("uniqueItems").asBoolean(); boolean rootSchemaIsArray = !schema.isGenerated(); JType itemType; if (no...
ArrayRule implements Rule<JPackage, JClass> { @Override public JClass apply(String nodeName, JsonNode node, JsonNode parent, JPackage jpackage, Schema schema) { boolean uniqueItems = node.has("uniqueItems") && node.get("uniqueItems").asBoolean(); boolean rootSchemaIsArray = !schema.isGenerated(); JType itemType; if (no...
@Test public void arrayOfPrimitivesProducesCollectionOfWrapperTypes() { JCodeModel codeModel = new JCodeModel(); JPackage jpackage = codeModel._package(getClass().getPackage().getName()); ObjectMapper mapper = new ObjectMapper(); ObjectNode itemsNode = mapper.createObjectNode(); itemsNode.put("type", "number"); ObjectN...
@Override public JClass apply(String nodeName, JsonNode node, JsonNode parent, JPackage jpackage, Schema schema) { boolean uniqueItems = node.has("uniqueItems") && node.get("uniqueItems").asBoolean(); boolean rootSchemaIsArray = !schema.isGenerated(); JType itemType; if (node.has("items")) { itemType = ruleFactory.getS...
ArrayRule implements Rule<JPackage, JClass> { @Override public JClass apply(String nodeName, JsonNode node, JsonNode parent, JPackage jpackage, Schema schema) { boolean uniqueItems = node.has("uniqueItems") && node.get("uniqueItems").asBoolean(); boolean rootSchemaIsArray = !schema.isGenerated(); JType itemType; if (no...
ArrayRule implements Rule<JPackage, JClass> { @Override public JClass apply(String nodeName, JsonNode node, JsonNode parent, JPackage jpackage, Schema schema) { boolean uniqueItems = node.has("uniqueItems") && node.get("uniqueItems").asBoolean(); boolean rootSchemaIsArray = !schema.isGenerated(); JType itemType; if (no...
ArrayRule implements Rule<JPackage, JClass> { @Override public JClass apply(String nodeName, JsonNode node, JsonNode parent, JPackage jpackage, Schema schema) { boolean uniqueItems = node.has("uniqueItems") && node.get("uniqueItems").asBoolean(); boolean rootSchemaIsArray = !schema.isGenerated(); JType itemType; if (no...
ArrayRule implements Rule<JPackage, JClass> { @Override public JClass apply(String nodeName, JsonNode node, JsonNode parent, JPackage jpackage, Schema schema) { boolean uniqueItems = node.has("uniqueItems") && node.get("uniqueItems").asBoolean(); boolean rootSchemaIsArray = !schema.isGenerated(); JType itemType; if (no...
@Test public void arrayDefaultsToNonUnique() { JCodeModel codeModel = new JCodeModel(); JPackage jpackage = codeModel._package(getClass().getPackage().getName()); ObjectMapper mapper = new ObjectMapper(); ObjectNode itemsNode = mapper.createObjectNode(); itemsNode.put("type", "boolean"); ObjectNode propertyNode = mappe...
@Override public JClass apply(String nodeName, JsonNode node, JsonNode parent, JPackage jpackage, Schema schema) { boolean uniqueItems = node.has("uniqueItems") && node.get("uniqueItems").asBoolean(); boolean rootSchemaIsArray = !schema.isGenerated(); JType itemType; if (node.has("items")) { itemType = ruleFactory.getS...
ArrayRule implements Rule<JPackage, JClass> { @Override public JClass apply(String nodeName, JsonNode node, JsonNode parent, JPackage jpackage, Schema schema) { boolean uniqueItems = node.has("uniqueItems") && node.get("uniqueItems").asBoolean(); boolean rootSchemaIsArray = !schema.isGenerated(); JType itemType; if (no...
ArrayRule implements Rule<JPackage, JClass> { @Override public JClass apply(String nodeName, JsonNode node, JsonNode parent, JPackage jpackage, Schema schema) { boolean uniqueItems = node.has("uniqueItems") && node.get("uniqueItems").asBoolean(); boolean rootSchemaIsArray = !schema.isGenerated(); JType itemType; if (no...
ArrayRule implements Rule<JPackage, JClass> { @Override public JClass apply(String nodeName, JsonNode node, JsonNode parent, JPackage jpackage, Schema schema) { boolean uniqueItems = node.has("uniqueItems") && node.get("uniqueItems").asBoolean(); boolean rootSchemaIsArray = !schema.isGenerated(); JType itemType; if (no...
ArrayRule implements Rule<JPackage, JClass> { @Override public JClass apply(String nodeName, JsonNode node, JsonNode parent, JPackage jpackage, Schema schema) { boolean uniqueItems = node.has("uniqueItems") && node.get("uniqueItems").asBoolean(); boolean rootSchemaIsArray = !schema.isGenerated(); JType itemType; if (no...
@Test public void shouldAddNotFoundField() { JFieldRef var = rule.getOrAddNotFoundVar(type); assertThat(var, notNullValue()); }
JFieldRef getOrAddNotFoundVar(JDefinedClass jclass) { jclass.field(PROTECTED | STATIC | FINAL, Object.class, NOT_FOUND_VALUE_FIELD, _new(jclass.owner()._ref(Object.class))); return jclass.staticRef(NOT_FOUND_VALUE_FIELD); }
DynamicPropertiesRule implements Rule<JDefinedClass, JDefinedClass> { JFieldRef getOrAddNotFoundVar(JDefinedClass jclass) { jclass.field(PROTECTED | STATIC | FINAL, Object.class, NOT_FOUND_VALUE_FIELD, _new(jclass.owner()._ref(Object.class))); return jclass.staticRef(NOT_FOUND_VALUE_FIELD); } }
DynamicPropertiesRule implements Rule<JDefinedClass, JDefinedClass> { JFieldRef getOrAddNotFoundVar(JDefinedClass jclass) { jclass.field(PROTECTED | STATIC | FINAL, Object.class, NOT_FOUND_VALUE_FIELD, _new(jclass.owner()._ref(Object.class))); return jclass.staticRef(NOT_FOUND_VALUE_FIELD); } DynamicPropertiesRule(Rule...
DynamicPropertiesRule implements Rule<JDefinedClass, JDefinedClass> { JFieldRef getOrAddNotFoundVar(JDefinedClass jclass) { jclass.field(PROTECTED | STATIC | FINAL, Object.class, NOT_FOUND_VALUE_FIELD, _new(jclass.owner()._ref(Object.class))); return jclass.staticRef(NOT_FOUND_VALUE_FIELD); } DynamicPropertiesRule(Rule...
DynamicPropertiesRule implements Rule<JDefinedClass, JDefinedClass> { JFieldRef getOrAddNotFoundVar(JDefinedClass jclass) { jclass.field(PROTECTED | STATIC | FINAL, Object.class, NOT_FOUND_VALUE_FIELD, _new(jclass.owner()._ref(Object.class))); return jclass.staticRef(NOT_FOUND_VALUE_FIELD); } DynamicPropertiesRule(Rule...
@Test public void testMinLength() { when(config.isIncludeJsr303Annotations()).thenReturn(true); final int minValue = new Random().nextInt(); when(subNode.asInt()).thenReturn(minValue); when(node.get("minLength")).thenReturn(subNode); when(fieldVar.annotate(Size.class)).thenReturn(annotation); when(node.has("minLength")...
@Override public JFieldVar apply(String nodeName, JsonNode node, JsonNode parent, JFieldVar field, Schema currentSchema) { if (ruleFactory.getGenerationConfig().isIncludeJsr303Annotations() && (node.has("minLength") || node.has("maxLength")) && isApplicableType(field)) { JAnnotationUse annotation = field.annotate(Size....
MinLengthMaxLengthRule implements Rule<JFieldVar, JFieldVar> { @Override public JFieldVar apply(String nodeName, JsonNode node, JsonNode parent, JFieldVar field, Schema currentSchema) { if (ruleFactory.getGenerationConfig().isIncludeJsr303Annotations() && (node.has("minLength") || node.has("maxLength")) && isApplicable...
MinLengthMaxLengthRule implements Rule<JFieldVar, JFieldVar> { @Override public JFieldVar apply(String nodeName, JsonNode node, JsonNode parent, JFieldVar field, Schema currentSchema) { if (ruleFactory.getGenerationConfig().isIncludeJsr303Annotations() && (node.has("minLength") || node.has("maxLength")) && isApplicable...
MinLengthMaxLengthRule implements Rule<JFieldVar, JFieldVar> { @Override public JFieldVar apply(String nodeName, JsonNode node, JsonNode parent, JFieldVar field, Schema currentSchema) { if (ruleFactory.getGenerationConfig().isIncludeJsr303Annotations() && (node.has("minLength") || node.has("maxLength")) && isApplicable...
MinLengthMaxLengthRule implements Rule<JFieldVar, JFieldVar> { @Override public JFieldVar apply(String nodeName, JsonNode node, JsonNode parent, JFieldVar field, Schema currentSchema) { if (ruleFactory.getGenerationConfig().isIncludeJsr303Annotations() && (node.has("minLength") || node.has("maxLength")) && isApplicable...
@Test public void testMaxLength() { when(config.isIncludeJsr303Annotations()).thenReturn(true); final int maxValue = new Random().nextInt(); when(subNode.asInt()).thenReturn(maxValue); when(node.get("maxLength")).thenReturn(subNode); when(fieldVar.annotate(Size.class)).thenReturn(annotation); when(node.has("maxLength")...
@Override public JFieldVar apply(String nodeName, JsonNode node, JsonNode parent, JFieldVar field, Schema currentSchema) { if (ruleFactory.getGenerationConfig().isIncludeJsr303Annotations() && (node.has("minLength") || node.has("maxLength")) && isApplicableType(field)) { JAnnotationUse annotation = field.annotate(Size....
MinLengthMaxLengthRule implements Rule<JFieldVar, JFieldVar> { @Override public JFieldVar apply(String nodeName, JsonNode node, JsonNode parent, JFieldVar field, Schema currentSchema) { if (ruleFactory.getGenerationConfig().isIncludeJsr303Annotations() && (node.has("minLength") || node.has("maxLength")) && isApplicable...
MinLengthMaxLengthRule implements Rule<JFieldVar, JFieldVar> { @Override public JFieldVar apply(String nodeName, JsonNode node, JsonNode parent, JFieldVar field, Schema currentSchema) { if (ruleFactory.getGenerationConfig().isIncludeJsr303Annotations() && (node.has("minLength") || node.has("maxLength")) && isApplicable...
MinLengthMaxLengthRule implements Rule<JFieldVar, JFieldVar> { @Override public JFieldVar apply(String nodeName, JsonNode node, JsonNode parent, JFieldVar field, Schema currentSchema) { if (ruleFactory.getGenerationConfig().isIncludeJsr303Annotations() && (node.has("minLength") || node.has("maxLength")) && isApplicable...
MinLengthMaxLengthRule implements Rule<JFieldVar, JFieldVar> { @Override public JFieldVar apply(String nodeName, JsonNode node, JsonNode parent, JFieldVar field, Schema currentSchema) { if (ruleFactory.getGenerationConfig().isIncludeJsr303Annotations() && (node.has("minLength") || node.has("maxLength")) && isApplicable...
@Test public void testMaxAndMinLength() { when(config.isIncludeJsr303Annotations()).thenReturn(true); final int minValue = new Random().nextInt(); final int maxValue = new Random().nextInt(); JsonNode maxSubNode = Mockito.mock(JsonNode.class); when(subNode.asInt()).thenReturn(minValue); when(maxSubNode.asInt()).thenRet...
@Override public JFieldVar apply(String nodeName, JsonNode node, JsonNode parent, JFieldVar field, Schema currentSchema) { if (ruleFactory.getGenerationConfig().isIncludeJsr303Annotations() && (node.has("minLength") || node.has("maxLength")) && isApplicableType(field)) { JAnnotationUse annotation = field.annotate(Size....
MinLengthMaxLengthRule implements Rule<JFieldVar, JFieldVar> { @Override public JFieldVar apply(String nodeName, JsonNode node, JsonNode parent, JFieldVar field, Schema currentSchema) { if (ruleFactory.getGenerationConfig().isIncludeJsr303Annotations() && (node.has("minLength") || node.has("maxLength")) && isApplicable...
MinLengthMaxLengthRule implements Rule<JFieldVar, JFieldVar> { @Override public JFieldVar apply(String nodeName, JsonNode node, JsonNode parent, JFieldVar field, Schema currentSchema) { if (ruleFactory.getGenerationConfig().isIncludeJsr303Annotations() && (node.has("minLength") || node.has("maxLength")) && isApplicable...
MinLengthMaxLengthRule implements Rule<JFieldVar, JFieldVar> { @Override public JFieldVar apply(String nodeName, JsonNode node, JsonNode parent, JFieldVar field, Schema currentSchema) { if (ruleFactory.getGenerationConfig().isIncludeJsr303Annotations() && (node.has("minLength") || node.has("maxLength")) && isApplicable...
MinLengthMaxLengthRule implements Rule<JFieldVar, JFieldVar> { @Override public JFieldVar apply(String nodeName, JsonNode node, JsonNode parent, JFieldVar field, Schema currentSchema) { if (ruleFactory.getGenerationConfig().isIncludeJsr303Annotations() && (node.has("minLength") || node.has("maxLength")) && isApplicable...
@Test public void testMaxAndMinLengthGenericsOnType() { when(config.isIncludeJsr303Annotations()).thenReturn(true); final int minValue = new Random().nextInt(); final int maxValue = new Random().nextInt(); JsonNode maxSubNode = Mockito.mock(JsonNode.class); when(subNode.asInt()).thenReturn(minValue); when(maxSubNode.as...
@Override public JFieldVar apply(String nodeName, JsonNode node, JsonNode parent, JFieldVar field, Schema currentSchema) { if (ruleFactory.getGenerationConfig().isIncludeJsr303Annotations() && (node.has("minLength") || node.has("maxLength")) && isApplicableType(field)) { JAnnotationUse annotation = field.annotate(Size....
MinLengthMaxLengthRule implements Rule<JFieldVar, JFieldVar> { @Override public JFieldVar apply(String nodeName, JsonNode node, JsonNode parent, JFieldVar field, Schema currentSchema) { if (ruleFactory.getGenerationConfig().isIncludeJsr303Annotations() && (node.has("minLength") || node.has("maxLength")) && isApplicable...
MinLengthMaxLengthRule implements Rule<JFieldVar, JFieldVar> { @Override public JFieldVar apply(String nodeName, JsonNode node, JsonNode parent, JFieldVar field, Schema currentSchema) { if (ruleFactory.getGenerationConfig().isIncludeJsr303Annotations() && (node.has("minLength") || node.has("maxLength")) && isApplicable...
MinLengthMaxLengthRule implements Rule<JFieldVar, JFieldVar> { @Override public JFieldVar apply(String nodeName, JsonNode node, JsonNode parent, JFieldVar field, Schema currentSchema) { if (ruleFactory.getGenerationConfig().isIncludeJsr303Annotations() && (node.has("minLength") || node.has("maxLength")) && isApplicable...
MinLengthMaxLengthRule implements Rule<JFieldVar, JFieldVar> { @Override public JFieldVar apply(String nodeName, JsonNode node, JsonNode parent, JFieldVar field, Schema currentSchema) { if (ruleFactory.getGenerationConfig().isIncludeJsr303Annotations() && (node.has("minLength") || node.has("maxLength")) && isApplicable...
@Test public void testNotUsed() { when(config.isIncludeJsr303Annotations()).thenReturn(true); when(node.has("minLength")).thenReturn(false); when(node.has("maxLength")).thenReturn(false); when(fieldVar.type().boxify().fullName()).thenReturn(fieldClass.getTypeName()); JFieldVar result = rule.apply("node", node, null, fi...
@Override public JFieldVar apply(String nodeName, JsonNode node, JsonNode parent, JFieldVar field, Schema currentSchema) { if (ruleFactory.getGenerationConfig().isIncludeJsr303Annotations() && (node.has("minLength") || node.has("maxLength")) && isApplicableType(field)) { JAnnotationUse annotation = field.annotate(Size....
MinLengthMaxLengthRule implements Rule<JFieldVar, JFieldVar> { @Override public JFieldVar apply(String nodeName, JsonNode node, JsonNode parent, JFieldVar field, Schema currentSchema) { if (ruleFactory.getGenerationConfig().isIncludeJsr303Annotations() && (node.has("minLength") || node.has("maxLength")) && isApplicable...
MinLengthMaxLengthRule implements Rule<JFieldVar, JFieldVar> { @Override public JFieldVar apply(String nodeName, JsonNode node, JsonNode parent, JFieldVar field, Schema currentSchema) { if (ruleFactory.getGenerationConfig().isIncludeJsr303Annotations() && (node.has("minLength") || node.has("maxLength")) && isApplicable...
MinLengthMaxLengthRule implements Rule<JFieldVar, JFieldVar> { @Override public JFieldVar apply(String nodeName, JsonNode node, JsonNode parent, JFieldVar field, Schema currentSchema) { if (ruleFactory.getGenerationConfig().isIncludeJsr303Annotations() && (node.has("minLength") || node.has("maxLength")) && isApplicable...
MinLengthMaxLengthRule implements Rule<JFieldVar, JFieldVar> { @Override public JFieldVar apply(String nodeName, JsonNode node, JsonNode parent, JFieldVar field, Schema currentSchema) { if (ruleFactory.getGenerationConfig().isIncludeJsr303Annotations() && (node.has("minLength") || node.has("maxLength")) && isApplicable...
@Test public void correctTestForJava7() { assertThat(LanguageFeatures.canUseJava7(mockConfig(version)), equalTo(versionSpec.canUse7)); }
public static boolean canUseJava7(GenerationConfig config) { return !LESS_THAN_7.contains(config.getTargetVersion()); }
LanguageFeatures { public static boolean canUseJava7(GenerationConfig config) { return !LESS_THAN_7.contains(config.getTargetVersion()); } }
LanguageFeatures { public static boolean canUseJava7(GenerationConfig config) { return !LESS_THAN_7.contains(config.getTargetVersion()); } }
LanguageFeatures { public static boolean canUseJava7(GenerationConfig config) { return !LESS_THAN_7.contains(config.getTargetVersion()); } static boolean canUseJava7(GenerationConfig config); static boolean canUseJava8(GenerationConfig config); }
LanguageFeatures { public static boolean canUseJava7(GenerationConfig config) { return !LESS_THAN_7.contains(config.getTargetVersion()); } static boolean canUseJava7(GenerationConfig config); static boolean canUseJava8(GenerationConfig config); }
@Test public void jsrDisable() { when(config.isIncludeJsr303Annotations()).thenReturn(false); JFieldVar result = rule.apply("node", node, null, fieldVar, null); assertSame(fieldVar, result); verify(fieldVar, never()).annotate(Size.class); verify(annotation, never()).param(anyString(), anyInt()); }
@Override public JFieldVar apply(String nodeName, JsonNode node, JsonNode parent, JFieldVar field, Schema currentSchema) { if (ruleFactory.getGenerationConfig().isIncludeJsr303Annotations() && (node.has("minLength") || node.has("maxLength")) && isApplicableType(field)) { JAnnotationUse annotation = field.annotate(Size....
MinLengthMaxLengthRule implements Rule<JFieldVar, JFieldVar> { @Override public JFieldVar apply(String nodeName, JsonNode node, JsonNode parent, JFieldVar field, Schema currentSchema) { if (ruleFactory.getGenerationConfig().isIncludeJsr303Annotations() && (node.has("minLength") || node.has("maxLength")) && isApplicable...
MinLengthMaxLengthRule implements Rule<JFieldVar, JFieldVar> { @Override public JFieldVar apply(String nodeName, JsonNode node, JsonNode parent, JFieldVar field, Schema currentSchema) { if (ruleFactory.getGenerationConfig().isIncludeJsr303Annotations() && (node.has("minLength") || node.has("maxLength")) && isApplicable...
MinLengthMaxLengthRule implements Rule<JFieldVar, JFieldVar> { @Override public JFieldVar apply(String nodeName, JsonNode node, JsonNode parent, JFieldVar field, Schema currentSchema) { if (ruleFactory.getGenerationConfig().isIncludeJsr303Annotations() && (node.has("minLength") || node.has("maxLength")) && isApplicable...
MinLengthMaxLengthRule implements Rule<JFieldVar, JFieldVar> { @Override public JFieldVar apply(String nodeName, JsonNode node, JsonNode parent, JFieldVar field, Schema currentSchema) { if (ruleFactory.getGenerationConfig().isIncludeJsr303Annotations() && (node.has("minLength") || node.has("maxLength")) && isApplicable...
@Test public void missingArgsCausesHelp() throws IOException { ArgsForTest args = (ArgsForTest) new ArgsForTest().parse(new String[] {}); assertThat(args.status, is(1)); assertThat(new String(systemErrCapture.toByteArray(), StandardCharsets.UTF_8), is(containsString("--target"))); assertThat(new String(systemErrCapture...
public Arguments parse(String[] args) { JCommander jCommander = new JCommander(this); jCommander.setProgramName("jsonschema2pojo"); try { jCommander.parse(args); if (this.showHelp) { jCommander.usage(); exit(EXIT_OKAY); } } catch (ParameterException e) { System.err.println(e.getMessage()); jCommander.usage(); exit(EXIT...
Arguments implements GenerationConfig { public Arguments parse(String[] args) { JCommander jCommander = new JCommander(this); jCommander.setProgramName("jsonschema2pojo"); try { jCommander.parse(args); if (this.showHelp) { jCommander.usage(); exit(EXIT_OKAY); } } catch (ParameterException e) { System.err.println(e.getM...
Arguments implements GenerationConfig { public Arguments parse(String[] args) { JCommander jCommander = new JCommander(this); jCommander.setProgramName("jsonschema2pojo"); try { jCommander.parse(args); if (this.showHelp) { jCommander.usage(); exit(EXIT_OKAY); } } catch (ParameterException e) { System.err.println(e.getM...
Arguments implements GenerationConfig { public Arguments parse(String[] args) { JCommander jCommander = new JCommander(this); jCommander.setProgramName("jsonschema2pojo"); try { jCommander.parse(args); if (this.showHelp) { jCommander.usage(); exit(EXIT_OKAY); } } catch (ParameterException e) { System.err.println(e.getM...
Arguments implements GenerationConfig { public Arguments parse(String[] args) { JCommander jCommander = new JCommander(this); jCommander.setProgramName("jsonschema2pojo"); try { jCommander.parse(args); if (this.showHelp) { jCommander.usage(); exit(EXIT_OKAY); } } catch (ParameterException e) { System.err.println(e.getM...
@Test public void requestingHelpCausesHelp() throws IOException { ArgsForTest args = (ArgsForTest) new ArgsForTest().parse(new String[] { "--help" }); assertThat(args.status, is(notNullValue())); assertThat(new String(systemOutCapture.toByteArray(), StandardCharsets.UTF_8), is(containsString("Usage: jsonschema2pojo")))...
public Arguments parse(String[] args) { JCommander jCommander = new JCommander(this); jCommander.setProgramName("jsonschema2pojo"); try { jCommander.parse(args); if (this.showHelp) { jCommander.usage(); exit(EXIT_OKAY); } } catch (ParameterException e) { System.err.println(e.getMessage()); jCommander.usage(); exit(EXIT...
Arguments implements GenerationConfig { public Arguments parse(String[] args) { JCommander jCommander = new JCommander(this); jCommander.setProgramName("jsonschema2pojo"); try { jCommander.parse(args); if (this.showHelp) { jCommander.usage(); exit(EXIT_OKAY); } } catch (ParameterException e) { System.err.println(e.getM...
Arguments implements GenerationConfig { public Arguments parse(String[] args) { JCommander jCommander = new JCommander(this); jCommander.setProgramName("jsonschema2pojo"); try { jCommander.parse(args); if (this.showHelp) { jCommander.usage(); exit(EXIT_OKAY); } } catch (ParameterException e) { System.err.println(e.getM...
Arguments implements GenerationConfig { public Arguments parse(String[] args) { JCommander jCommander = new JCommander(this); jCommander.setProgramName("jsonschema2pojo"); try { jCommander.parse(args); if (this.showHelp) { jCommander.usage(); exit(EXIT_OKAY); } } catch (ParameterException e) { System.err.println(e.getM...
Arguments implements GenerationConfig { public Arguments parse(String[] args) { JCommander jCommander = new JCommander(this); jCommander.setProgramName("jsonschema2pojo"); try { jCommander.parse(args); if (this.showHelp) { jCommander.usage(); exit(EXIT_OKAY); } } catch (ParameterException e) { System.err.println(e.getM...
@Test @SuppressWarnings("unchecked") public void classIsCreatedFromFullyQualifiedClassName() { Class<Annotator> clazz = converter.convert(Annotator.class.getName()); assertThat(clazz, is(equalTo(Annotator.class))); }
@Override public Class convert(String value) { if (isBlank(value)) { throw new ParameterException(getErrorString("a blank value", "a class")); } try { return Class.forName(value); } catch (ClassNotFoundException e) { throw new ParameterException(getErrorString(value, "a class")); } }
ClassConverter extends BaseConverter<Class> { @Override public Class convert(String value) { if (isBlank(value)) { throw new ParameterException(getErrorString("a blank value", "a class")); } try { return Class.forName(value); } catch (ClassNotFoundException e) { throw new ParameterException(getErrorString(value, "a cla...
ClassConverter extends BaseConverter<Class> { @Override public Class convert(String value) { if (isBlank(value)) { throw new ParameterException(getErrorString("a blank value", "a class")); } try { return Class.forName(value); } catch (ClassNotFoundException e) { throw new ParameterException(getErrorString(value, "a cla...
ClassConverter extends BaseConverter<Class> { @Override public Class convert(String value) { if (isBlank(value)) { throw new ParameterException(getErrorString("a blank value", "a class")); } try { return Class.forName(value); } catch (ClassNotFoundException e) { throw new ParameterException(getErrorString(value, "a cla...
ClassConverter extends BaseConverter<Class> { @Override public Class convert(String value) { if (isBlank(value)) { throw new ParameterException(getErrorString("a blank value", "a class")); } try { return Class.forName(value); } catch (ClassNotFoundException e) { throw new ParameterException(getErrorString(value, "a cla...
@Test(expected = ParameterException.class) public void invalidClassNameThrowsParameterException() { converter.convert("some garbage.name"); }
@Override public Class convert(String value) { if (isBlank(value)) { throw new ParameterException(getErrorString("a blank value", "a class")); } try { return Class.forName(value); } catch (ClassNotFoundException e) { throw new ParameterException(getErrorString(value, "a class")); } }
ClassConverter extends BaseConverter<Class> { @Override public Class convert(String value) { if (isBlank(value)) { throw new ParameterException(getErrorString("a blank value", "a class")); } try { return Class.forName(value); } catch (ClassNotFoundException e) { throw new ParameterException(getErrorString(value, "a cla...
ClassConverter extends BaseConverter<Class> { @Override public Class convert(String value) { if (isBlank(value)) { throw new ParameterException(getErrorString("a blank value", "a class")); } try { return Class.forName(value); } catch (ClassNotFoundException e) { throw new ParameterException(getErrorString(value, "a cla...
ClassConverter extends BaseConverter<Class> { @Override public Class convert(String value) { if (isBlank(value)) { throw new ParameterException(getErrorString("a blank value", "a class")); } try { return Class.forName(value); } catch (ClassNotFoundException e) { throw new ParameterException(getErrorString(value, "a cla...
ClassConverter extends BaseConverter<Class> { @Override public Class convert(String value) { if (isBlank(value)) { throw new ParameterException(getErrorString("a blank value", "a class")); } try { return Class.forName(value); } catch (ClassNotFoundException e) { throw new ParameterException(getErrorString(value, "a cla...
@Test(expected = ParameterException.class) public void nullValueThrowsParameterException() { converter.convert(null); }
@Override public Class convert(String value) { if (isBlank(value)) { throw new ParameterException(getErrorString("a blank value", "a class")); } try { return Class.forName(value); } catch (ClassNotFoundException e) { throw new ParameterException(getErrorString(value, "a class")); } }
ClassConverter extends BaseConverter<Class> { @Override public Class convert(String value) { if (isBlank(value)) { throw new ParameterException(getErrorString("a blank value", "a class")); } try { return Class.forName(value); } catch (ClassNotFoundException e) { throw new ParameterException(getErrorString(value, "a cla...
ClassConverter extends BaseConverter<Class> { @Override public Class convert(String value) { if (isBlank(value)) { throw new ParameterException(getErrorString("a blank value", "a class")); } try { return Class.forName(value); } catch (ClassNotFoundException e) { throw new ParameterException(getErrorString(value, "a cla...
ClassConverter extends BaseConverter<Class> { @Override public Class convert(String value) { if (isBlank(value)) { throw new ParameterException(getErrorString("a blank value", "a class")); } try { return Class.forName(value); } catch (ClassNotFoundException e) { throw new ParameterException(getErrorString(value, "a cla...
ClassConverter extends BaseConverter<Class> { @Override public Class convert(String value) { if (isBlank(value)) { throw new ParameterException(getErrorString("a blank value", "a class")); } try { return Class.forName(value); } catch (ClassNotFoundException e) { throw new ParameterException(getErrorString(value, "a cla...