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 checkForwardIsLazy() { impl.isLazy(); Mockito.verify(mapAttr, Mockito.times(1)).isLazy(); }
@Override public boolean isLazy() { return mapAttr.isLazy(); }
MetaMapAttribute extends MetaAttribute { @Override public boolean isLazy() { return mapAttr.isLazy(); } }
MetaMapAttribute extends MetaAttribute { @Override public boolean isLazy() { return mapAttr.isLazy(); } MetaMapAttribute(MetaMapType mapType, MetaAttribute mapAttr, String keyString); }
MetaMapAttribute extends MetaAttribute { @Override public boolean isLazy() { return mapAttr.isLazy(); } MetaMapAttribute(MetaMapType mapType, MetaAttribute mapAttr, String keyString); @Override MetaType getType(); @Override Object getValue(Object dataObject); @Override void setValue(Object dataObject, Object value); Ob...
MetaMapAttribute extends MetaAttribute { @Override public boolean isLazy() { return mapAttr.isLazy(); } MetaMapAttribute(MetaMapType mapType, MetaAttribute mapAttr, String keyString); @Override MetaType getType(); @Override Object getValue(Object dataObject); @Override void setValue(Object dataObject, Object value); Ob...
@Test public void checkForwardIsDerived() { impl.isDerived(); Mockito.verify(mapAttr, Mockito.times(1)).isDerived(); }
@Override public boolean isDerived() { return mapAttr.isDerived(); }
MetaMapAttribute extends MetaAttribute { @Override public boolean isDerived() { return mapAttr.isDerived(); } }
MetaMapAttribute extends MetaAttribute { @Override public boolean isDerived() { return mapAttr.isDerived(); } MetaMapAttribute(MetaMapType mapType, MetaAttribute mapAttr, String keyString); }
MetaMapAttribute extends MetaAttribute { @Override public boolean isDerived() { return mapAttr.isDerived(); } MetaMapAttribute(MetaMapType mapType, MetaAttribute mapAttr, String keyString); @Override MetaType getType(); @Override Object getValue(Object dataObject); @Override void setValue(Object dataObject, Object valu...
MetaMapAttribute extends MetaAttribute { @Override public boolean isDerived() { return mapAttr.isDerived(); } MetaMapAttribute(MetaMapType mapType, MetaAttribute mapAttr, String keyString); @Override MetaType getType(); @Override Object getValue(Object dataObject); @Override void setValue(Object dataObject, Object valu...
@Test(expected = UnsupportedOperationException.class) public void checkGetAnnotationsNotSupported() { impl.getAnnotations(); }
@Override public Collection<Annotation> getAnnotations() { throw new UnsupportedOperationException(); }
MetaMapAttribute extends MetaAttribute { @Override public Collection<Annotation> getAnnotations() { throw new UnsupportedOperationException(); } }
MetaMapAttribute extends MetaAttribute { @Override public Collection<Annotation> getAnnotations() { throw new UnsupportedOperationException(); } MetaMapAttribute(MetaMapType mapType, MetaAttribute mapAttr, String keyString); }
MetaMapAttribute extends MetaAttribute { @Override public Collection<Annotation> getAnnotations() { throw new UnsupportedOperationException(); } MetaMapAttribute(MetaMapType mapType, MetaAttribute mapAttr, String keyString); @Override MetaType getType(); @Override Object getValue(Object dataObject); @Override void setV...
MetaMapAttribute extends MetaAttribute { @Override public Collection<Annotation> getAnnotations() { throw new UnsupportedOperationException(); } MetaMapAttribute(MetaMapType mapType, MetaAttribute mapAttr, String keyString); @Override MetaType getType(); @Override Object getValue(Object dataObject); @Override void setV...
@Test(expected = UnsupportedOperationException.class) public void checkGetAnnotationNotSupported() { impl.getAnnotation(null); }
@Override public <T extends Annotation> T getAnnotation(Class<T> clazz) { throw new UnsupportedOperationException(); }
MetaMapAttribute extends MetaAttribute { @Override public <T extends Annotation> T getAnnotation(Class<T> clazz) { throw new UnsupportedOperationException(); } }
MetaMapAttribute extends MetaAttribute { @Override public <T extends Annotation> T getAnnotation(Class<T> clazz) { throw new UnsupportedOperationException(); } MetaMapAttribute(MetaMapType mapType, MetaAttribute mapAttr, String keyString); }
MetaMapAttribute extends MetaAttribute { @Override public <T extends Annotation> T getAnnotation(Class<T> clazz) { throw new UnsupportedOperationException(); } MetaMapAttribute(MetaMapType mapType, MetaAttribute mapAttr, String keyString); @Override MetaType getType(); @Override Object getValue(Object dataObject); @Ove...
MetaMapAttribute extends MetaAttribute { @Override public <T extends Annotation> T getAnnotation(Class<T> clazz) { throw new UnsupportedOperationException(); } MetaMapAttribute(MetaMapType mapType, MetaAttribute mapAttr, String keyString); @Override MetaType getType(); @Override Object getValue(Object dataObject); @Ove...
@Test(expected = UnsupportedOperationException.class) public void checkSetOppositeAttributeNotSupported() { impl.setOppositeAttribute(null); }
public void setOppositeAttribute(MetaAttribute oppositeAttr) { throw new UnsupportedOperationException(); }
MetaMapAttribute extends MetaAttribute { public void setOppositeAttribute(MetaAttribute oppositeAttr) { throw new UnsupportedOperationException(); } }
MetaMapAttribute extends MetaAttribute { public void setOppositeAttribute(MetaAttribute oppositeAttr) { throw new UnsupportedOperationException(); } MetaMapAttribute(MetaMapType mapType, MetaAttribute mapAttr, String keyString); }
MetaMapAttribute extends MetaAttribute { public void setOppositeAttribute(MetaAttribute oppositeAttr) { throw new UnsupportedOperationException(); } MetaMapAttribute(MetaMapType mapType, MetaAttribute mapAttr, String keyString); @Override MetaType getType(); @Override Object getValue(Object dataObject); @Override void ...
MetaMapAttribute extends MetaAttribute { public void setOppositeAttribute(MetaAttribute oppositeAttr) { throw new UnsupportedOperationException(); } MetaMapAttribute(MetaMapType mapType, MetaAttribute mapAttr, String keyString); @Override MetaType getType(); @Override Object getValue(Object dataObject); @Override void ...
@Test public void checkForwardIsAssociation() { impl.isAssociation(); Mockito.verify(mapAttr, Mockito.times(1)).isAssociation(); }
@Override public boolean isAssociation() { return mapAttr.isAssociation(); }
MetaMapAttribute extends MetaAttribute { @Override public boolean isAssociation() { return mapAttr.isAssociation(); } }
MetaMapAttribute extends MetaAttribute { @Override public boolean isAssociation() { return mapAttr.isAssociation(); } MetaMapAttribute(MetaMapType mapType, MetaAttribute mapAttr, String keyString); }
MetaMapAttribute extends MetaAttribute { @Override public boolean isAssociation() { return mapAttr.isAssociation(); } MetaMapAttribute(MetaMapType mapType, MetaAttribute mapAttr, String keyString); @Override MetaType getType(); @Override Object getValue(Object dataObject); @Override void setValue(Object dataObject, Obj...
MetaMapAttribute extends MetaAttribute { @Override public boolean isAssociation() { return mapAttr.isAssociation(); } MetaMapAttribute(MetaMapType mapType, MetaAttribute mapAttr, String keyString); @Override MetaType getType(); @Override Object getValue(Object dataObject); @Override void setValue(Object dataObject, Obj...
@Test(expected = UnsupportedOperationException.class) public void getVersionNotSupported() { impl.isVersion(); }
@Override public boolean isVersion() { throw new UnsupportedOperationException(); }
MetaMapAttribute extends MetaAttribute { @Override public boolean isVersion() { throw new UnsupportedOperationException(); } }
MetaMapAttribute extends MetaAttribute { @Override public boolean isVersion() { throw new UnsupportedOperationException(); } MetaMapAttribute(MetaMapType mapType, MetaAttribute mapAttr, String keyString); }
MetaMapAttribute extends MetaAttribute { @Override public boolean isVersion() { throw new UnsupportedOperationException(); } MetaMapAttribute(MetaMapType mapType, MetaAttribute mapAttr, String keyString); @Override MetaType getType(); @Override Object getValue(Object dataObject); @Override void setValue(Object dataObje...
MetaMapAttribute extends MetaAttribute { @Override public boolean isVersion() { throw new UnsupportedOperationException(); } MetaMapAttribute(MetaMapType mapType, MetaAttribute mapAttr, String keyString); @Override MetaType getType(); @Override Object getValue(Object dataObject); @Override void setValue(Object dataObje...
@Test(expected = UnsupportedOperationException.class) public void isIdNotSupported() { impl.isId(); }
public boolean isId() { throw new UnsupportedOperationException(); }
MetaMapAttribute extends MetaAttribute { public boolean isId() { throw new UnsupportedOperationException(); } }
MetaMapAttribute extends MetaAttribute { public boolean isId() { throw new UnsupportedOperationException(); } MetaMapAttribute(MetaMapType mapType, MetaAttribute mapAttr, String keyString); }
MetaMapAttribute extends MetaAttribute { public boolean isId() { throw new UnsupportedOperationException(); } MetaMapAttribute(MetaMapType mapType, MetaAttribute mapAttr, String keyString); @Override MetaType getType(); @Override Object getValue(Object dataObject); @Override void setValue(Object dataObject, Object valu...
MetaMapAttribute extends MetaAttribute { public boolean isId() { throw new UnsupportedOperationException(); } MetaMapAttribute(MetaMapType mapType, MetaAttribute mapAttr, String keyString); @Override MetaType getType(); @Override Object getValue(Object dataObject); @Override void setValue(Object dataObject, Object valu...
@Test(expected = UnsupportedOperationException.class) public void getOppositeAttributeNotSupported() { impl.getOppositeAttribute(); }
@Override public MetaAttribute getOppositeAttribute() { throw new UnsupportedOperationException(); }
MetaMapAttribute extends MetaAttribute { @Override public MetaAttribute getOppositeAttribute() { throw new UnsupportedOperationException(); } }
MetaMapAttribute extends MetaAttribute { @Override public MetaAttribute getOppositeAttribute() { throw new UnsupportedOperationException(); } MetaMapAttribute(MetaMapType mapType, MetaAttribute mapAttr, String keyString); }
MetaMapAttribute extends MetaAttribute { @Override public MetaAttribute getOppositeAttribute() { throw new UnsupportedOperationException(); } MetaMapAttribute(MetaMapType mapType, MetaAttribute mapAttr, String keyString); @Override MetaType getType(); @Override Object getValue(Object dataObject); @Override void setValu...
MetaMapAttribute extends MetaAttribute { @Override public MetaAttribute getOppositeAttribute() { throw new UnsupportedOperationException(); } MetaMapAttribute(MetaMapType mapType, MetaAttribute mapAttr, String keyString); @Override MetaType getType(); @Override Object getValue(Object dataObject); @Override void setValu...
@Test public void and() { Assert.assertEquals(ResourcePermission.DELETE, ResourcePermission.DELETE.or(ResourcePermission.DELETE)); Assert.assertEquals(ResourcePermission.GET, ResourcePermission.GET.or(ResourcePermission.GET)); Assert.assertTrue(ResourcePermission.GET.and(ResourcePermission.DELETE).isEmpty()); }
public ResourcePermission and(ResourcePermission other) { boolean mergePush = postAllowed && other.postAllowed; boolean mergeGet = getAllowed && other.getAllowed; boolean mergePatch = patchAllowed && other.patchAllowed; boolean mergeDelete = deleteAllowed && other.deleteAllowed; return new ResourcePermission(mergePush,...
ResourcePermission { public ResourcePermission and(ResourcePermission other) { boolean mergePush = postAllowed && other.postAllowed; boolean mergeGet = getAllowed && other.getAllowed; boolean mergePatch = patchAllowed && other.patchAllowed; boolean mergeDelete = deleteAllowed && other.deleteAllowed; return new Resource...
ResourcePermission { public ResourcePermission and(ResourcePermission other) { boolean mergePush = postAllowed && other.postAllowed; boolean mergeGet = getAllowed && other.getAllowed; boolean mergePatch = patchAllowed && other.patchAllowed; boolean mergeDelete = deleteAllowed && other.deleteAllowed; return new Resource...
ResourcePermission { public ResourcePermission and(ResourcePermission other) { boolean mergePush = postAllowed && other.postAllowed; boolean mergeGet = getAllowed && other.getAllowed; boolean mergePatch = patchAllowed && other.patchAllowed; boolean mergeDelete = deleteAllowed && other.deleteAllowed; return new Resource...
ResourcePermission { public ResourcePermission and(ResourcePermission other) { boolean mergePush = postAllowed && other.postAllowed; boolean mergeGet = getAllowed && other.getAllowed; boolean mergePatch = patchAllowed && other.patchAllowed; boolean mergeDelete = deleteAllowed && other.deleteAllowed; return new Resource...
@Test(expected = UnsupportedOperationException.class) public void getValueNotSupported() { impl.getValue(null); }
@Override public Object getValue(Object dataObject) { throw new UnsupportedOperationException(); }
MetaMapAttribute extends MetaAttribute { @Override public Object getValue(Object dataObject) { throw new UnsupportedOperationException(); } }
MetaMapAttribute extends MetaAttribute { @Override public Object getValue(Object dataObject) { throw new UnsupportedOperationException(); } MetaMapAttribute(MetaMapType mapType, MetaAttribute mapAttr, String keyString); }
MetaMapAttribute extends MetaAttribute { @Override public Object getValue(Object dataObject) { throw new UnsupportedOperationException(); } MetaMapAttribute(MetaMapType mapType, MetaAttribute mapAttr, String keyString); @Override MetaType getType(); @Override Object getValue(Object dataObject); @Override void setValue(...
MetaMapAttribute extends MetaAttribute { @Override public Object getValue(Object dataObject) { throw new UnsupportedOperationException(); } MetaMapAttribute(MetaMapType mapType, MetaAttribute mapAttr, String keyString); @Override MetaType getType(); @Override Object getValue(Object dataObject); @Override void setValue(...
@Test(expected = UnsupportedOperationException.class) public void addValueNotSupported() { impl.addValue(null, null); }
@Override public void addValue(Object dataObject, Object value) { throw new UnsupportedOperationException(); }
MetaMapAttribute extends MetaAttribute { @Override public void addValue(Object dataObject, Object value) { throw new UnsupportedOperationException(); } }
MetaMapAttribute extends MetaAttribute { @Override public void addValue(Object dataObject, Object value) { throw new UnsupportedOperationException(); } MetaMapAttribute(MetaMapType mapType, MetaAttribute mapAttr, String keyString); }
MetaMapAttribute extends MetaAttribute { @Override public void addValue(Object dataObject, Object value) { throw new UnsupportedOperationException(); } MetaMapAttribute(MetaMapType mapType, MetaAttribute mapAttr, String keyString); @Override MetaType getType(); @Override Object getValue(Object dataObject); @Override vo...
MetaMapAttribute extends MetaAttribute { @Override public void addValue(Object dataObject, Object value) { throw new UnsupportedOperationException(); } MetaMapAttribute(MetaMapType mapType, MetaAttribute mapAttr, String keyString); @Override MetaType getType(); @Override Object getValue(Object dataObject); @Override vo...
@Test(expected = UnsupportedOperationException.class) public void removeValueNotSupported() { impl.removeValue(null, null); }
@Override public void removeValue(Object dataObject, Object value) { throw new UnsupportedOperationException(); }
MetaMapAttribute extends MetaAttribute { @Override public void removeValue(Object dataObject, Object value) { throw new UnsupportedOperationException(); } }
MetaMapAttribute extends MetaAttribute { @Override public void removeValue(Object dataObject, Object value) { throw new UnsupportedOperationException(); } MetaMapAttribute(MetaMapType mapType, MetaAttribute mapAttr, String keyString); }
MetaMapAttribute extends MetaAttribute { @Override public void removeValue(Object dataObject, Object value) { throw new UnsupportedOperationException(); } MetaMapAttribute(MetaMapType mapType, MetaAttribute mapAttr, String keyString); @Override MetaType getType(); @Override Object getValue(Object dataObject); @Override...
MetaMapAttribute extends MetaAttribute { @Override public void removeValue(Object dataObject, Object value) { throw new UnsupportedOperationException(); } MetaMapAttribute(MetaMapType mapType, MetaAttribute mapAttr, String keyString); @Override MetaType getType(); @Override Object getValue(Object dataObject); @Override...
@Test(expected = UnsupportedOperationException.class) public void setValueNotSupported() { impl.setValue(null, null); }
@Override public void setValue(Object dataObject, Object value) { throw new UnsupportedOperationException(); }
MetaMapAttribute extends MetaAttribute { @Override public void setValue(Object dataObject, Object value) { throw new UnsupportedOperationException(); } }
MetaMapAttribute extends MetaAttribute { @Override public void setValue(Object dataObject, Object value) { throw new UnsupportedOperationException(); } MetaMapAttribute(MetaMapType mapType, MetaAttribute mapAttr, String keyString); }
MetaMapAttribute extends MetaAttribute { @Override public void setValue(Object dataObject, Object value) { throw new UnsupportedOperationException(); } MetaMapAttribute(MetaMapType mapType, MetaAttribute mapAttr, String keyString); @Override MetaType getType(); @Override Object getValue(Object dataObject); @Override vo...
MetaMapAttribute extends MetaAttribute { @Override public void setValue(Object dataObject, Object value) { throw new UnsupportedOperationException(); } MetaMapAttribute(MetaMapType mapType, MetaAttribute mapAttr, String keyString); @Override MetaType getType(); @Override Object getValue(Object dataObject); @Override vo...
@Test public void testToKeyStringWithNull() { MetaKey key = new MetaKey(); Assert.assertNull(key.toKeyString(null)); }
public String toKeyString(Object id) { if (id == null) { return null; } PreconditionUtil.assertEquals("compound primary key not supported", 1, elements.size()); MetaAttribute keyAttr = elements.get(0); MetaType keyType = keyAttr.getType(); if (keyType instanceof MetaDataObject) { MetaDataObject embType = (MetaDataObjec...
MetaKey extends MetaElement { public String toKeyString(Object id) { if (id == null) { return null; } PreconditionUtil.assertEquals("compound primary key not supported", 1, elements.size()); MetaAttribute keyAttr = elements.get(0); MetaType keyType = keyAttr.getType(); if (keyType instanceof MetaDataObject) { MetaDataO...
MetaKey extends MetaElement { public String toKeyString(Object id) { if (id == null) { return null; } PreconditionUtil.assertEquals("compound primary key not supported", 1, elements.size()); MetaAttribute keyAttr = elements.get(0); MetaType keyType = keyAttr.getType(); if (keyType instanceof MetaDataObject) { MetaDataO...
MetaKey extends MetaElement { public String toKeyString(Object id) { if (id == null) { return null; } PreconditionUtil.assertEquals("compound primary key not supported", 1, elements.size()); MetaAttribute keyAttr = elements.get(0); MetaType keyType = keyAttr.getType(); if (keyType instanceof MetaDataObject) { MetaDataO...
MetaKey extends MetaElement { public String toKeyString(Object id) { if (id == null) { return null; } PreconditionUtil.assertEquals("compound primary key not supported", 1, elements.size()); MetaAttribute keyAttr = elements.get(0); MetaType keyType = keyAttr.getType(); if (keyType instanceof MetaDataObject) { MetaDataO...
@Test(expected = IllegalStateException.class) public void checkDataObjectCast() { new MetaKey().asDataObject(); }
public MetaDataObject asDataObject() { if (!(this instanceof MetaDataObject)) { throw new IllegalStateException(getName() + " not a MetaDataObject"); } return (MetaDataObject) this; }
MetaElement implements Cloneable { public MetaDataObject asDataObject() { if (!(this instanceof MetaDataObject)) { throw new IllegalStateException(getName() + " not a MetaDataObject"); } return (MetaDataObject) this; } }
MetaElement implements Cloneable { public MetaDataObject asDataObject() { if (!(this instanceof MetaDataObject)) { throw new IllegalStateException(getName() + " not a MetaDataObject"); } return (MetaDataObject) this; } }
MetaElement implements Cloneable { public MetaDataObject asDataObject() { if (!(this instanceof MetaDataObject)) { throw new IllegalStateException(getName() + " not a MetaDataObject"); } return (MetaDataObject) this; } MetaElement getParent(); void setParent(MetaElement parent); List<MetaElement> getChildren(); void s...
MetaElement implements Cloneable { public MetaDataObject asDataObject() { if (!(this instanceof MetaDataObject)) { throw new IllegalStateException(getName() + " not a MetaDataObject"); } return (MetaDataObject) this; } MetaElement getParent(); void setParent(MetaElement parent); List<MetaElement> getChildren(); void s...
@Test(expected = IllegalStateException.class) public void checkTypeCast() { new MetaKey().asType(); }
public MetaType asType() { if (!(this instanceof MetaType)) { throw new IllegalStateException(getName() + " not a MetaEntity"); } return (MetaType) this; }
MetaElement implements Cloneable { public MetaType asType() { if (!(this instanceof MetaType)) { throw new IllegalStateException(getName() + " not a MetaEntity"); } return (MetaType) this; } }
MetaElement implements Cloneable { public MetaType asType() { if (!(this instanceof MetaType)) { throw new IllegalStateException(getName() + " not a MetaEntity"); } return (MetaType) this; } }
MetaElement implements Cloneable { public MetaType asType() { if (!(this instanceof MetaType)) { throw new IllegalStateException(getName() + " not a MetaEntity"); } return (MetaType) this; } MetaElement getParent(); void setParent(MetaElement parent); List<MetaElement> getChildren(); void setChildren(List<MetaElement>...
MetaElement implements Cloneable { public MetaType asType() { if (!(this instanceof MetaType)) { throw new IllegalStateException(getName() + " not a MetaEntity"); } return (MetaType) this; } MetaElement getParent(); void setParent(MetaElement parent); List<MetaElement> getChildren(); void setChildren(List<MetaElement>...
@Test public void testGetResourceType() { Assert.assertEquals(TestEntity.class, repo.getResourceClass()); }
@Override public Class<T> getResourceClass() { return repositoryConfig.getResourceClass(); }
JpaEntityRepositoryBase extends JpaRepositoryBase<T> implements ResourceRepository<T, I>, ResourceRegistryAware { @Override public Class<T> getResourceClass() { return repositoryConfig.getResourceClass(); } }
JpaEntityRepositoryBase extends JpaRepositoryBase<T> implements ResourceRepository<T, I>, ResourceRegistryAware { @Override public Class<T> getResourceClass() { return repositoryConfig.getResourceClass(); } JpaEntityRepositoryBase(Class<T> entityClass); JpaEntityRepositoryBase(JpaRepositoryConfig<T> config); }
JpaEntityRepositoryBase extends JpaRepositoryBase<T> implements ResourceRepository<T, I>, ResourceRegistryAware { @Override public Class<T> getResourceClass() { return repositoryConfig.getResourceClass(); } JpaEntityRepositoryBase(Class<T> entityClass); JpaEntityRepositoryBase(JpaRepositoryConfig<T> config); JpaQuer...
JpaEntityRepositoryBase extends JpaRepositoryBase<T> implements ResourceRepository<T, I>, ResourceRegistryAware { @Override public Class<T> getResourceClass() { return repositoryConfig.getResourceClass(); } JpaEntityRepositoryBase(Class<T> entityClass); JpaEntityRepositoryBase(JpaRepositoryConfig<T> config); JpaQuer...
@Test public void testGetEntityType() { Assert.assertEquals(TestEntity.class, repo.getEntityClass()); }
public Class<?> getEntityClass() { return repositoryConfig.getEntityClass(); }
JpaEntityRepositoryBase extends JpaRepositoryBase<T> implements ResourceRepository<T, I>, ResourceRegistryAware { public Class<?> getEntityClass() { return repositoryConfig.getEntityClass(); } }
JpaEntityRepositoryBase extends JpaRepositoryBase<T> implements ResourceRepository<T, I>, ResourceRegistryAware { public Class<?> getEntityClass() { return repositoryConfig.getEntityClass(); } JpaEntityRepositoryBase(Class<T> entityClass); JpaEntityRepositoryBase(JpaRepositoryConfig<T> config); }
JpaEntityRepositoryBase extends JpaRepositoryBase<T> implements ResourceRepository<T, I>, ResourceRegistryAware { public Class<?> getEntityClass() { return repositoryConfig.getEntityClass(); } JpaEntityRepositoryBase(Class<T> entityClass); JpaEntityRepositoryBase(JpaRepositoryConfig<T> config); JpaQueryFactory getQu...
JpaEntityRepositoryBase extends JpaRepositoryBase<T> implements ResourceRepository<T, I>, ResourceRegistryAware { public Class<?> getEntityClass() { return repositoryConfig.getEntityClass(); } JpaEntityRepositoryBase(Class<T> entityClass); JpaEntityRepositoryBase(JpaRepositoryConfig<T> config); JpaQueryFactory getQu...
@Test public void testFindAll() { QuerySpec querySpec = new QuerySpec(TestEntity.class); List<TestEntity> list = repo.findAll(querySpec); Assert.assertEquals(numTestEntities, list.size()); }
@Override public ResourceList<T> findAll(Collection<I> ids, QuerySpec querySpec) { String idField = getIdField().getUnderlyingName(); QuerySpec idQuerySpec = querySpec.clone(); idQuerySpec.addFilter(new FilterSpec(Arrays.asList(idField), FilterOperator.EQ, ids)); return findAll(idQuerySpec); }
JpaEntityRepositoryBase extends JpaRepositoryBase<T> implements ResourceRepository<T, I>, ResourceRegistryAware { @Override public ResourceList<T> findAll(Collection<I> ids, QuerySpec querySpec) { String idField = getIdField().getUnderlyingName(); QuerySpec idQuerySpec = querySpec.clone(); idQuerySpec.addFilter(new F...
JpaEntityRepositoryBase extends JpaRepositoryBase<T> implements ResourceRepository<T, I>, ResourceRegistryAware { @Override public ResourceList<T> findAll(Collection<I> ids, QuerySpec querySpec) { String idField = getIdField().getUnderlyingName(); QuerySpec idQuerySpec = querySpec.clone(); idQuerySpec.addFilter(new F...
JpaEntityRepositoryBase extends JpaRepositoryBase<T> implements ResourceRepository<T, I>, ResourceRegistryAware { @Override public ResourceList<T> findAll(Collection<I> ids, QuerySpec querySpec) { String idField = getIdField().getUnderlyingName(); QuerySpec idQuerySpec = querySpec.clone(); idQuerySpec.addFilter(new F...
JpaEntityRepositoryBase extends JpaRepositoryBase<T> implements ResourceRepository<T, I>, ResourceRegistryAware { @Override public ResourceList<T> findAll(Collection<I> ids, QuerySpec querySpec) { String idField = getIdField().getUnderlyingName(); QuerySpec idQuerySpec = querySpec.clone(); idQuerySpec.addFilter(new F...
@Test public void or() { Assert.assertEquals(ResourcePermission.DELETE, ResourcePermission.DELETE.or(ResourcePermission.DELETE)); Assert.assertEquals(ResourcePermission.GET, ResourcePermission.GET.or(ResourcePermission.GET)); Assert.assertEquals(ResourcePermission.create(false, true, false, true), ResourcePermission.GE...
public ResourcePermission or(ResourcePermission other) { boolean mergePush = postAllowed || other.postAllowed; boolean mergeGet = getAllowed || other.getAllowed; boolean mergePatch = patchAllowed || other.patchAllowed; boolean mergeDelete = deleteAllowed || other.deleteAllowed; return new ResourcePermission(mergePush, ...
ResourcePermission { public ResourcePermission or(ResourcePermission other) { boolean mergePush = postAllowed || other.postAllowed; boolean mergeGet = getAllowed || other.getAllowed; boolean mergePatch = patchAllowed || other.patchAllowed; boolean mergeDelete = deleteAllowed || other.deleteAllowed; return new ResourceP...
ResourcePermission { public ResourcePermission or(ResourcePermission other) { boolean mergePush = postAllowed || other.postAllowed; boolean mergeGet = getAllowed || other.getAllowed; boolean mergePatch = patchAllowed || other.patchAllowed; boolean mergeDelete = deleteAllowed || other.deleteAllowed; return new ResourceP...
ResourcePermission { public ResourcePermission or(ResourcePermission other) { boolean mergePush = postAllowed || other.postAllowed; boolean mergeGet = getAllowed || other.getAllowed; boolean mergePatch = patchAllowed || other.patchAllowed; boolean mergeDelete = deleteAllowed || other.deleteAllowed; return new ResourceP...
ResourcePermission { public ResourcePermission or(ResourcePermission other) { boolean mergePush = postAllowed || other.postAllowed; boolean mergeGet = getAllowed || other.getAllowed; boolean mergePatch = patchAllowed || other.patchAllowed; boolean mergeDelete = deleteAllowed || other.deleteAllowed; return new ResourceP...
@Test public void testService() { MyService myService = new MyService(); User user = new User("John", "john@yahoo.com"); user.setDateOfBirth(LocalDate.of(1980, Month.APRIL, 20)); logger.info("Age of user {} is {}", () -> user.getName(), () -> myService.calculateUserAge(user)); }
public int calculateUserAge(User user) { return Period.between(user.getDateOfBirth(), LocalDate.now()).getYears(); }
MyService { public int calculateUserAge(User user) { return Period.between(user.getDateOfBirth(), LocalDate.now()).getYears(); } }
MyService { public int calculateUserAge(User user) { return Period.between(user.getDateOfBirth(), LocalDate.now()).getYears(); } }
MyService { public int calculateUserAge(User user) { return Period.between(user.getDateOfBirth(), LocalDate.now()).getYears(); } int calculateUserAge(User user); }
MyService { public int calculateUserAge(User user) { return Period.between(user.getDateOfBirth(), LocalDate.now()).getYears(); } int calculateUserAge(User user); }
@Test public void testParameter() { Employee employee = new Employee("john@gmail.com", "John", 2000); if (logger.isDebugEnabled()) { logger.debug("The bonus for employee: " + employee.getName() + " is " + employeeService.calculateBonus(employee)); } logger.debug("The bonus for employee {} is {}", employee.getName(), em...
public double calculateBonus(Employee user) { return 0.1 * user.getSalary(); }
EmployeeService { public double calculateBonus(Employee user) { return 0.1 * user.getSalary(); } }
EmployeeService { public double calculateBonus(Employee user) { return 0.1 * user.getSalary(); } }
EmployeeService { public double calculateBonus(Employee user) { return 0.1 * user.getSalary(); } double calculateBonus(Employee user); }
EmployeeService { public double calculateBonus(Employee user) { return 0.1 * user.getSalary(); } double calculateBonus(Employee user); }
@Test public void testDeviceIdentifier() { Assert.assertNotNull(Castle.clientId()); }
public static String clientId() { return instance.identifier; }
Castle { public static String clientId() { return instance.identifier; } }
Castle { public static String clientId() { return instance.identifier; } private Castle(Application application, CastleConfiguration castleConfiguration); }
Castle { public static String clientId() { return instance.identifier; } private Castle(Application application, CastleConfiguration castleConfiguration); static void configure(Application application, CastleConfiguration configuration); static void configure(Application application, String publishableKey); static voi...
Castle { public static String clientId() { return instance.identifier; } private Castle(Application application, CastleConfiguration castleConfiguration); static void configure(Application application, CastleConfiguration configuration); static void configure(Application application, String publishableKey); static voi...
@Test public void testflushIfNeeded() { boolean flushed = Castle.flushIfNeeded("https: Assert.assertTrue(flushed); flushed = Castle.flushIfNeeded("https: Assert.assertFalse(flushed); }
public static boolean flushIfNeeded(String url) { if (isUrlWhiteListed(url)) { flush(); return true; } return false; }
Castle { public static boolean flushIfNeeded(String url) { if (isUrlWhiteListed(url)) { flush(); return true; } return false; } }
Castle { public static boolean flushIfNeeded(String url) { if (isUrlWhiteListed(url)) { flush(); return true; } return false; } private Castle(Application application, CastleConfiguration castleConfiguration); }
Castle { public static boolean flushIfNeeded(String url) { if (isUrlWhiteListed(url)) { flush(); return true; } return false; } private Castle(Application application, CastleConfiguration castleConfiguration); static void configure(Application application, CastleConfiguration configuration); static void configure(Appl...
Castle { public static boolean flushIfNeeded(String url) { if (isUrlWhiteListed(url)) { flush(); return true; } return false; } private Castle(Application application, CastleConfiguration castleConfiguration); static void configure(Application application, CastleConfiguration configuration); static void configure(Appl...
@Test public void testReset() { Castle.reset(); Assert.assertNull(Castle.userId()); }
public static void reset() { Castle.flush(); Castle.userId(null); Castle.userSignature(null); }
Castle { public static void reset() { Castle.flush(); Castle.userId(null); Castle.userSignature(null); } }
Castle { public static void reset() { Castle.flush(); Castle.userId(null); Castle.userSignature(null); } private Castle(Application application, CastleConfiguration castleConfiguration); }
Castle { public static void reset() { Castle.flush(); Castle.userId(null); Castle.userSignature(null); } private Castle(Application application, CastleConfiguration castleConfiguration); static void configure(Application application, CastleConfiguration configuration); static void configure(Application application, St...
Castle { public static void reset() { Castle.flush(); Castle.userId(null); Castle.userSignature(null); } private Castle(Application application, CastleConfiguration castleConfiguration); static void configure(Application application, CastleConfiguration configuration); static void configure(Application application, St...
@Test public void testRequestInterceptor() throws IOException { Request request = new Request.Builder() .url("https: .build(); Response response = client.newCall(request).execute(); Assert.assertEquals(Castle.clientId(), response.request().header(Castle.clientIdHeaderName)); request = new Request.Builder() .url("https:...
public static String clientId() { return instance.identifier; }
Castle { public static String clientId() { return instance.identifier; } }
Castle { public static String clientId() { return instance.identifier; } private Castle(Application application, CastleConfiguration castleConfiguration); }
Castle { public static String clientId() { return instance.identifier; } private Castle(Application application, CastleConfiguration castleConfiguration); static void configure(Application application, CastleConfiguration configuration); static void configure(Application application, String publishableKey); static voi...
Castle { public static String clientId() { return instance.identifier; } private Castle(Application application, CastleConfiguration castleConfiguration); static void configure(Application application, CastleConfiguration configuration); static void configure(Application application, String publishableKey); static voi...
@Test public void testWhiteList() { Assert.assertFalse(Castle.isUrlWhiteListed("invalid url")); }
static boolean isUrlWhiteListed(String urlString) { try { URL url = new URL(urlString); String baseUrl = url.getProtocol() + ": if (Castle.configuration().baseURLWhiteList() != null && !Castle.configuration().baseURLWhiteList().isEmpty()) { if (Castle.configuration().baseURLWhiteList().contains(baseUrl)) { return true;...
Castle { static boolean isUrlWhiteListed(String urlString) { try { URL url = new URL(urlString); String baseUrl = url.getProtocol() + ": if (Castle.configuration().baseURLWhiteList() != null && !Castle.configuration().baseURLWhiteList().isEmpty()) { if (Castle.configuration().baseURLWhiteList().contains(baseUrl)) { ret...
Castle { static boolean isUrlWhiteListed(String urlString) { try { URL url = new URL(urlString); String baseUrl = url.getProtocol() + ": if (Castle.configuration().baseURLWhiteList() != null && !Castle.configuration().baseURLWhiteList().isEmpty()) { if (Castle.configuration().baseURLWhiteList().contains(baseUrl)) { ret...
Castle { static boolean isUrlWhiteListed(String urlString) { try { URL url = new URL(urlString); String baseUrl = url.getProtocol() + ": if (Castle.configuration().baseURLWhiteList() != null && !Castle.configuration().baseURLWhiteList().isEmpty()) { if (Castle.configuration().baseURLWhiteList().contains(baseUrl)) { ret...
Castle { static boolean isUrlWhiteListed(String urlString) { try { URL url = new URL(urlString); String baseUrl = url.getProtocol() + ": if (Castle.configuration().baseURLWhiteList() != null && !Castle.configuration().baseURLWhiteList().isEmpty()) { if (Castle.configuration().baseURLWhiteList().contains(baseUrl)) { ret...
@Test @Config(manifest = "AndroidManifest.xml") public void testUserAgent() { String regex = "[a-zA-Z0-9\\s._-]+/[0-9]+\\.[0-9]+\\.?[0-9]*(-[a-zA-Z0-9]*)? \\([a-zA-Z0-9-_.]+\\) \\([a-zA-Z0-9\\s]+; Android [0-9]+\\.?[0-9]*; Castle [0-9]+\\.[0-9]+\\.?[0-9]*(-[a-zA-Z0-9]*)?\\)"; Pattern pattern = Pattern.compile(regex); M...
public static String userAgent() { return Utils.sanitizeHeader(String.format(Locale.US, "%s/%s (%d) (%s %s; Android %s; Castle %s)", instance.appName, instance.appVersion, instance.appBuild, Build.MANUFACTURER, Build.MODEL, Build.VERSION.RELEASE, BuildConfig.VERSION_NAME)); }
Castle { public static String userAgent() { return Utils.sanitizeHeader(String.format(Locale.US, "%s/%s (%d) (%s %s; Android %s; Castle %s)", instance.appName, instance.appVersion, instance.appBuild, Build.MANUFACTURER, Build.MODEL, Build.VERSION.RELEASE, BuildConfig.VERSION_NAME)); } }
Castle { public static String userAgent() { return Utils.sanitizeHeader(String.format(Locale.US, "%s/%s (%d) (%s %s; Android %s; Castle %s)", instance.appName, instance.appVersion, instance.appBuild, Build.MANUFACTURER, Build.MODEL, Build.VERSION.RELEASE, BuildConfig.VERSION_NAME)); } private Castle(Application applic...
Castle { public static String userAgent() { return Utils.sanitizeHeader(String.format(Locale.US, "%s/%s (%d) (%s %s; Android %s; Castle %s)", instance.appName, instance.appVersion, instance.appBuild, Build.MANUFACTURER, Build.MODEL, Build.VERSION.RELEASE, BuildConfig.VERSION_NAME)); } private Castle(Application applic...
Castle { public static String userAgent() { return Utils.sanitizeHeader(String.format(Locale.US, "%s/%s (%d) (%s %s; Android %s; Castle %s)", instance.appName, instance.appVersion, instance.appBuild, Build.MANUFACTURER, Build.MODEL, Build.VERSION.RELEASE, BuildConfig.VERSION_NAME)); } private Castle(Application applic...
@Test public void testInvalidGrid() { Solve grid1 = new Solve(); int[][] grid = { { 4, 8, 3, 7, 6, 9, 2, 1, 5 }, { 1, 2, 3, 4, 5, 6, 7, 8, 9 }, { 1, 2, 3, 4, 5, 6, 7, 8, 9 }, { 1, 2, 3, 4, 5, 6, 7, 8, 9 }, { 1, 2, 3, 4, 5, 6, 7, 8, 9 }, { 1, 2, 3, 4, 5, 6, 7, 8, 9 }, { 1, 2, 3, 4, 5, 6, 7, 8, 9 }, { 1, 2, 3, 4, 5, 6, 7...
Solve() { }
Solve { Solve() { } }
Solve { Solve() { } Solve(); }
Solve { Solve() { } Solve(); int solve(int dimension, int[][] gridCopy); static int[] rc2box(int i, int j); }
Solve { Solve() { } Solve(); int solve(int dimension, int[][] gridCopy); static int[] rc2box(int i, int j); }
@Test public void testGameGrid() { Solve grid1 = new Solve(); GameGrid grid = new GameGrid(9); assertTrue(0< grid1.solve(9, grid.grid)); }
Solve() { }
Solve { Solve() { } }
Solve { Solve() { } Solve(); }
Solve { Solve() { } Solve(); int solve(int dimension, int[][] gridCopy); static int[] rc2box(int i, int j); }
Solve { Solve() { } Solve(); int solve(int dimension, int[][] gridCopy); static int[] rc2box(int i, int j); }
@Test public void find() throws Exception { this.mockMvc.perform(get("/matrix/find/42;q=11;r=22")) .andExpect(status().isOk()) .andExpect(content().string("4211")); }
@RequestMapping(path = "/find/{petId}", method = RequestMethod.GET) @ResponseBody public String find(@PathVariable String petId, @MatrixVariable int q) { logger.info("petId:{},q:{}",petId,q); return petId + q; }
MatrixController { @RequestMapping(path = "/find/{petId}", method = RequestMethod.GET) @ResponseBody public String find(@PathVariable String petId, @MatrixVariable int q) { logger.info("petId:{},q:{}",petId,q); return petId + q; } }
MatrixController { @RequestMapping(path = "/find/{petId}", method = RequestMethod.GET) @ResponseBody public String find(@PathVariable String petId, @MatrixVariable int q) { logger.info("petId:{},q:{}",petId,q); return petId + q; } }
MatrixController { @RequestMapping(path = "/find/{petId}", method = RequestMethod.GET) @ResponseBody public String find(@PathVariable String petId, @MatrixVariable int q) { logger.info("petId:{},q:{}",petId,q); return petId + q; } @RequestMapping(path = "/find/{petId}", method = RequestMethod.GET) @ResponseBody String...
MatrixController { @RequestMapping(path = "/find/{petId}", method = RequestMethod.GET) @ResponseBody public String find(@PathVariable String petId, @MatrixVariable int q) { logger.info("petId:{},q:{}",petId,q); return petId + q; } @RequestMapping(path = "/find/{petId}", method = RequestMethod.GET) @ResponseBody String...
@Test public void find1() throws Exception { this.mockMvc.perform(get("/matrix/owners/42;q=11/pets/11;q=22")) .andExpect(status().isOk()) .andExpect(content().string("33")); }
@RequestMapping(path = "/owners/{ownerId}/pets/{petId}", method = RequestMethod.GET) @ResponseBody public String find1( @MatrixVariable(name="q", pathVar="ownerId") int q1, @MatrixVariable(name="q", pathVar="petId") int q2) { return String.valueOf(q1+q2); }
MatrixController { @RequestMapping(path = "/owners/{ownerId}/pets/{petId}", method = RequestMethod.GET) @ResponseBody public String find1( @MatrixVariable(name="q", pathVar="ownerId") int q1, @MatrixVariable(name="q", pathVar="petId") int q2) { return String.valueOf(q1+q2); } }
MatrixController { @RequestMapping(path = "/owners/{ownerId}/pets/{petId}", method = RequestMethod.GET) @ResponseBody public String find1( @MatrixVariable(name="q", pathVar="ownerId") int q1, @MatrixVariable(name="q", pathVar="petId") int q2) { return String.valueOf(q1+q2); } }
MatrixController { @RequestMapping(path = "/owners/{ownerId}/pets/{petId}", method = RequestMethod.GET) @ResponseBody public String find1( @MatrixVariable(name="q", pathVar="ownerId") int q1, @MatrixVariable(name="q", pathVar="petId") int q2) { return String.valueOf(q1+q2); } @RequestMapping(path = "/find/{petId}", me...
MatrixController { @RequestMapping(path = "/owners/{ownerId}/pets/{petId}", method = RequestMethod.GET) @ResponseBody public String find1( @MatrixVariable(name="q", pathVar="ownerId") int q1, @MatrixVariable(name="q", pathVar="petId") int q2) { return String.valueOf(q1+q2); } @RequestMapping(path = "/find/{petId}", me...
@Test public void getUser() throws Exception { logger.info("JsonControllerTest getUser is running"); this.mockMvc.perform(get("/json/get").accept(MediaType.parseMediaType("application/json;charset=UTF-8"))) .andExpect(status().isOk()).andExpect(content().contentType("application/json;charset=UTF-8")) .andExpect(jsonPat...
@RequestMapping(path = "/get",method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @ResponseBody public User get(){ return new User(20,"李四","F"); }
JsonController { @RequestMapping(path = "/get",method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @ResponseBody public User get(){ return new User(20,"李四","F"); } }
JsonController { @RequestMapping(path = "/get",method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @ResponseBody public User get(){ return new User(20,"李四","F"); } }
JsonController { @RequestMapping(path = "/get",method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @ResponseBody public User get(){ return new User(20,"李四","F"); } @RequestMapping(path = "/get",method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @ResponseBody User ge...
JsonController { @RequestMapping(path = "/get",method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @ResponseBody public User get(){ return new User(20,"李四","F"); } @RequestMapping(path = "/get",method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @ResponseBody User ge...
@Test public void postUser() throws Exception { logger.info("JsonControllerTest postUser is running"); this.mockMvc.perform(post("/json/post/haha").accept(MediaType.parseMediaType("application/json;charset=UTF-8"))) .andExpect(status().isOk()).andExpect(content().contentType("application/json;charset=UTF-8")) .andExpec...
@RequestMapping(path = "/post/{name}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @ResponseBody public User post(@PathVariable String name, Model model){ logger.info("name : {}",name); return new User(20,name,"男"); }
JsonController { @RequestMapping(path = "/post/{name}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @ResponseBody public User post(@PathVariable String name, Model model){ logger.info("name : {}",name); return new User(20,name,"男"); } }
JsonController { @RequestMapping(path = "/post/{name}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @ResponseBody public User post(@PathVariable String name, Model model){ logger.info("name : {}",name); return new User(20,name,"男"); } }
JsonController { @RequestMapping(path = "/post/{name}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @ResponseBody public User post(@PathVariable String name, Model model){ logger.info("name : {}",name); return new User(20,name,"男"); } @RequestMapping(path = "/get",method = RequestMet...
JsonController { @RequestMapping(path = "/post/{name}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @ResponseBody public User post(@PathVariable String name, Model model){ logger.info("name : {}",name); return new User(20,name,"男"); } @RequestMapping(path = "/get",method = RequestMet...
@Test public void getUser() throws Exception { logger.info("XmlControllerTest getUser is running"); this.mockMvc.perform(get("/xml/get")).andExpect(status().isOk()).andExpect(content().contentType ("application/xml")).andExpect(xpath("/user/name", new HashMap<String, String>()).string("张三")); }
@RequestMapping(path = "/get",method = RequestMethod.GET,produces = MediaType.APPLICATION_XML_VALUE) @ResponseBody public User get(){ return new User(21,"张三","男"); }
XmlController { @RequestMapping(path = "/get",method = RequestMethod.GET,produces = MediaType.APPLICATION_XML_VALUE) @ResponseBody public User get(){ return new User(21,"张三","男"); } }
XmlController { @RequestMapping(path = "/get",method = RequestMethod.GET,produces = MediaType.APPLICATION_XML_VALUE) @ResponseBody public User get(){ return new User(21,"张三","男"); } }
XmlController { @RequestMapping(path = "/get",method = RequestMethod.GET,produces = MediaType.APPLICATION_XML_VALUE) @ResponseBody public User get(){ return new User(21,"张三","男"); } @RequestMapping(path = "/get",method = RequestMethod.GET,produces = MediaType.APPLICATION_XML_VALUE) @ResponseBody User get(); @RequestMa...
XmlController { @RequestMapping(path = "/get",method = RequestMethod.GET,produces = MediaType.APPLICATION_XML_VALUE) @ResponseBody public User get(){ return new User(21,"张三","男"); } @RequestMapping(path = "/get",method = RequestMethod.GET,produces = MediaType.APPLICATION_XML_VALUE) @ResponseBody User get(); @RequestMa...
@Test public void postUser() throws Exception { logger.info("XmlControllerTest postUser is running"); User user = new User(10, "王五", "男"); String content = JaxbUtils.toXml(user); logger.info("content:{}", content); this.mockMvc.perform(post("/xml/post").contentType(MediaType.APPLICATION_XML_VALUE).content(content)) .an...
@RequestMapping(path = "/post",method = RequestMethod.POST,produces = MediaType.APPLICATION_XML_VALUE,consumes = MediaType.APPLICATION_XML_VALUE) @ResponseBody public User post(@RequestBody User user){ logger.info(user.toString()); return user; }
XmlController { @RequestMapping(path = "/post",method = RequestMethod.POST,produces = MediaType.APPLICATION_XML_VALUE,consumes = MediaType.APPLICATION_XML_VALUE) @ResponseBody public User post(@RequestBody User user){ logger.info(user.toString()); return user; } }
XmlController { @RequestMapping(path = "/post",method = RequestMethod.POST,produces = MediaType.APPLICATION_XML_VALUE,consumes = MediaType.APPLICATION_XML_VALUE) @ResponseBody public User post(@RequestBody User user){ logger.info(user.toString()); return user; } }
XmlController { @RequestMapping(path = "/post",method = RequestMethod.POST,produces = MediaType.APPLICATION_XML_VALUE,consumes = MediaType.APPLICATION_XML_VALUE) @ResponseBody public User post(@RequestBody User user){ logger.info(user.toString()); return user; } @RequestMapping(path = "/get",method = RequestMethod.GET...
XmlController { @RequestMapping(path = "/post",method = RequestMethod.POST,produces = MediaType.APPLICATION_XML_VALUE,consumes = MediaType.APPLICATION_XML_VALUE) @ResponseBody public User post(@RequestBody User user){ logger.info(user.toString()); return user; } @RequestMapping(path = "/get",method = RequestMethod.GET...
@Test public void postHouse() throws Exception { logger.info("XmlControllerTest postHouse is running"); User user = new User(30, "王五", "男"); House house = new House(user,"南京"); String content = JaxbUtils.toXml(house); logger.info("content:{}", content); this.mockMvc.perform(post("/xml/postHouse").contentType(MediaType....
@RequestMapping(path = "/postHouse",method = RequestMethod.POST,produces = MediaType.APPLICATION_XML_VALUE,consumes = MediaType.APPLICATION_XML_VALUE) @ResponseBody public House postHouse(@RequestBody House house){ logger.info(house.toString()); return house; }
XmlController { @RequestMapping(path = "/postHouse",method = RequestMethod.POST,produces = MediaType.APPLICATION_XML_VALUE,consumes = MediaType.APPLICATION_XML_VALUE) @ResponseBody public House postHouse(@RequestBody House house){ logger.info(house.toString()); return house; } }
XmlController { @RequestMapping(path = "/postHouse",method = RequestMethod.POST,produces = MediaType.APPLICATION_XML_VALUE,consumes = MediaType.APPLICATION_XML_VALUE) @ResponseBody public House postHouse(@RequestBody House house){ logger.info(house.toString()); return house; } }
XmlController { @RequestMapping(path = "/postHouse",method = RequestMethod.POST,produces = MediaType.APPLICATION_XML_VALUE,consumes = MediaType.APPLICATION_XML_VALUE) @ResponseBody public House postHouse(@RequestBody House house){ logger.info(house.toString()); return house; } @RequestMapping(path = "/get",method = Re...
XmlController { @RequestMapping(path = "/postHouse",method = RequestMethod.POST,produces = MediaType.APPLICATION_XML_VALUE,consumes = MediaType.APPLICATION_XML_VALUE) @ResponseBody public House postHouse(@RequestBody House house){ logger.info(house.toString()); return house; } @RequestMapping(path = "/get",method = Re...
@Test public void postTest() throws Exception { User user = new User(50, "王五", "男"); String content = JSON.toJSONString(user); logger.info("content:{}", content); this.mockMvc.perform(post("/valid/post").contentType(MediaType.APPLICATION_JSON_UTF8_VALUE).content(content)) .andExpect(content().string("4211")); }
@RequestMapping(path = "/post",method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_UTF8_VALUE,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) @ResponseBody public User post(@RequestBody @Valid User user){ return user; }
ValidController { @RequestMapping(path = "/post",method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_UTF8_VALUE,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) @ResponseBody public User post(@RequestBody @Valid User user){ return user; } }
ValidController { @RequestMapping(path = "/post",method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_UTF8_VALUE,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) @ResponseBody public User post(@RequestBody @Valid User user){ return user; } }
ValidController { @RequestMapping(path = "/post",method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_UTF8_VALUE,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) @ResponseBody public User post(@RequestBody @Valid User user){ return user; } @RequestMapping(path = "/post",method = RequestMethod.POST,produc...
ValidController { @RequestMapping(path = "/post",method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_UTF8_VALUE,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) @ResponseBody public User post(@RequestBody @Valid User user){ return user; } @RequestMapping(path = "/post",method = RequestMethod.POST,produc...
@Test public void validateId(){ assertTrue(ModelRef.validateId("com.mycompany.Test")); assertTrue(ModelRef.validateId("Test_v1")); assertTrue(ModelRef.validateId("Test_v1.0")); assertFalse(ModelRef.validateId(".")); assertFalse(ModelRef.validateId("-Test")); }
static public boolean validateId(String id){ return (id != null) && (id).matches(REGEX_ID); }
ModelRef { static public boolean validateId(String id){ return (id != null) && (id).matches(REGEX_ID); } }
ModelRef { static public boolean validateId(String id){ return (id != null) && (id).matches(REGEX_ID); } ModelRef(ModelRef modelRef); ModelRef(Principal owner, String id); }
ModelRef { static public boolean validateId(String id){ return (id != null) && (id).matches(REGEX_ID); } ModelRef(ModelRef modelRef); ModelRef(Principal owner, String id); @Override int hashCode(); @Override boolean equals(Object object); Principal getOwner(); String getId(); static boolean validateId(String id); }
ModelRef { static public boolean validateId(String id){ return (id != null) && (id).matches(REGEX_ID); } ModelRef(ModelRef modelRef); ModelRef(Principal owner, String id); @Override int hashCode(); @Override boolean equals(Object object); Principal getOwner(); String getId(); static boolean validateId(String id); stat...
@Test public void getFormat() throws IOException { CsvPreference first; CsvPreference second; String csv = "1\tone\n" + "2\ttwo\n" + "3\tthree"; try(BufferedReader reader = new BufferedReader(new StringReader(csv))){ first = CsvUtil.getFormat(reader); second = CsvUtil.getFormat(reader); } assertNotSame(first.getEncoder...
static public CsvPreference getFormat(String delimiterChar, String quoteChar){ char delimiter = ','; char quote = '\"'; if(delimiterChar != null){ delimiterChar = decodeDelimiter(delimiterChar); if(delimiterChar.length() != 1){ throw new IllegalArgumentException("Invalid CSV delimiter character: \"" + delimiterChar + "...
CsvUtil { static public CsvPreference getFormat(String delimiterChar, String quoteChar){ char delimiter = ','; char quote = '\"'; if(delimiterChar != null){ delimiterChar = decodeDelimiter(delimiterChar); if(delimiterChar.length() != 1){ throw new IllegalArgumentException("Invalid CSV delimiter character: \"" + delimit...
CsvUtil { static public CsvPreference getFormat(String delimiterChar, String quoteChar){ char delimiter = ','; char quote = '\"'; if(delimiterChar != null){ delimiterChar = decodeDelimiter(delimiterChar); if(delimiterChar.length() != 1){ throw new IllegalArgumentException("Invalid CSV delimiter character: \"" + delimit...
CsvUtil { static public CsvPreference getFormat(String delimiterChar, String quoteChar){ char delimiter = ','; char quote = '\"'; if(delimiterChar != null){ delimiterChar = decodeDelimiter(delimiterChar); if(delimiterChar.length() != 1){ throw new IllegalArgumentException("Invalid CSV delimiter character: \"" + delimit...
CsvUtil { static public CsvPreference getFormat(String delimiterChar, String quoteChar){ char delimiter = ','; char quote = '\"'; if(delimiterChar != null){ delimiterChar = decodeDelimiter(delimiterChar); if(delimiterChar.length() != 1){ throw new IllegalArgumentException("Invalid CSV delimiter character: \"" + delimit...
@Test public void toResponse(){ assertEquals("Not Found", getMessage(new NotFoundException())); assertEquals("Resource \"id\" not found", getMessage(new NotFoundException("Resource \"id\" not found"))); assertEquals("Bad Request", getMessage(new BadRequestException(new IllegalArgumentException()))); assertEquals("Bad \...
@Override public Response toResponse(WebApplicationException exception){ Response response = exception.getResponse(); Throwable throwable = exception; Map<Throwable, Throwable> throwableMap = new IdentityHashMap<>(); while(true){ Throwable cause = throwable.getCause(); throwableMap.put(throwable, cause); if((cause == n...
WebApplicationExceptionMapper implements ExceptionMapper<WebApplicationException> { @Override public Response toResponse(WebApplicationException exception){ Response response = exception.getResponse(); Throwable throwable = exception; Map<Throwable, Throwable> throwableMap = new IdentityHashMap<>(); while(true){ Throwa...
WebApplicationExceptionMapper implements ExceptionMapper<WebApplicationException> { @Override public Response toResponse(WebApplicationException exception){ Response response = exception.getResponse(); Throwable throwable = exception; Map<Throwable, Throwable> throwableMap = new IdentityHashMap<>(); while(true){ Throwa...
WebApplicationExceptionMapper implements ExceptionMapper<WebApplicationException> { @Override public Response toResponse(WebApplicationException exception){ Response response = exception.getResponse(); Throwable throwable = exception; Map<Throwable, Throwable> throwableMap = new IdentityHashMap<>(); while(true){ Throwa...
WebApplicationExceptionMapper implements ExceptionMapper<WebApplicationException> { @Override public Response toResponse(WebApplicationException exception){ Response response = exception.getResponse(); Throwable throwable = exception; Map<Throwable, Throwable> throwableMap = new IdentityHashMap<>(); while(true){ Throwa...
@Test(expected = MyException.class) public void shouldInterceptInvocationException() throws Exception { final Throwable[] thrown = new Throwable[1]; final MyException decoratedException = new MyException(); foo = Decorating.proxy(new MethodMissingImpl(), Foo.class).visiting(new Decorator<Foo>() { private static final l...
public static <T> DecoratingWith<T> proxy(final Class<T> type) { return new DecoratingWith<T>(new Decorating<T, T>((T)null, type)); }
Decorating { public static <T> DecoratingWith<T> proxy(final Class<T> type) { return new DecoratingWith<T>(new Decorating<T, T>((T)null, type)); } }
Decorating { public static <T> DecoratingWith<T> proxy(final Class<T> type) { return new DecoratingWith<T>(new Decorating<T, T>((T)null, type)); } private Decorating(final U delegate, final Class<T>primaryType, final Class<?>... types); }
Decorating { public static <T> DecoratingWith<T> proxy(final Class<T> type) { return new DecoratingWith<T>(new Decorating<T, T>((T)null, type)); } private Decorating(final U delegate, final Class<T>primaryType, final Class<?>... types); static DecoratingWith<T> proxy(final Class<T> type); static DecoratingWith<T> prox...
Decorating { public static <T> DecoratingWith<T> proxy(final Class<T> type) { return new DecoratingWith<T>(new Decorating<T, T>((T)null, type)); } private Decorating(final U delegate, final Class<T>primaryType, final Class<?>... types); static DecoratingWith<T> proxy(final Class<T> type); static DecoratingWith<T> prox...
@Test public void callWithArgumentsIsDelegated() throws Exception { Foo fooMock = mock(Foo.class); Foo foo = Privileging.proxy(Foo.class).with(fooMock).executedBy(new DirectExecutor()).build(getFactory()); foo.call(42, "Arthur"); verify(fooMock).call(42, "Arthur"); }
public static <T> PrivilegingWith<T> proxy(Class<T> type) { return new PrivilegingWith<T>(new Privileging<T>(type)); }
Privileging { public static <T> PrivilegingWith<T> proxy(Class<T> type) { return new PrivilegingWith<T>(new Privileging<T>(type)); } }
Privileging { public static <T> PrivilegingWith<T> proxy(Class<T> type) { return new PrivilegingWith<T>(new Privileging<T>(type)); } private Privileging(Class<T> type); }
Privileging { public static <T> PrivilegingWith<T> proxy(Class<T> type) { return new PrivilegingWith<T>(new Privileging<T>(type)); } private Privileging(Class<T> type); static PrivilegingWith<T> proxy(Class<T> type); static PrivilegingExecutedByOrBuild<T> proxy(T target); }
Privileging { public static <T> PrivilegingWith<T> proxy(Class<T> type) { return new PrivilegingWith<T>(new Privileging<T>(type)); } private Privileging(Class<T> type); static PrivilegingWith<T> proxy(Class<T> type); static PrivilegingExecutedByOrBuild<T> proxy(T target); }
@Test public void callWillReturnValue() throws Exception { Foo fooMock = mock(Foo.class); when(fooMock.call("Arthur")).thenReturn(42); Foo foo = Privileging.proxy(Foo.class).with(fooMock).executedBy(new DirectExecutor()).build(getFactory()); assertEquals(42, foo.call("Arthur")); verify(fooMock).call("Arthur"); }
public static <T> PrivilegingWith<T> proxy(Class<T> type) { return new PrivilegingWith<T>(new Privileging<T>(type)); }
Privileging { public static <T> PrivilegingWith<T> proxy(Class<T> type) { return new PrivilegingWith<T>(new Privileging<T>(type)); } }
Privileging { public static <T> PrivilegingWith<T> proxy(Class<T> type) { return new PrivilegingWith<T>(new Privileging<T>(type)); } private Privileging(Class<T> type); }
Privileging { public static <T> PrivilegingWith<T> proxy(Class<T> type) { return new PrivilegingWith<T>(new Privileging<T>(type)); } private Privileging(Class<T> type); static PrivilegingWith<T> proxy(Class<T> type); static PrivilegingExecutedByOrBuild<T> proxy(T target); }
Privileging { public static <T> PrivilegingWith<T> proxy(Class<T> type) { return new PrivilegingWith<T>(new Privileging<T>(type)); } private Privileging(Class<T> type); static PrivilegingWith<T> proxy(Class<T> type); static PrivilegingExecutedByOrBuild<T> proxy(T target); }
@Test(expected=NoSuchElementException.class) public void callWillThrowCheckedException() throws Exception { Foo fooMock = mock(Foo.class); when(fooMock.call("Arthur")).thenThrow(new NoSuchElementException("JUnit")); Foo foo = Privileging.proxy(Foo.class).with(fooMock).executedBy(new DirectExecutor()).build(getFactory()...
public static <T> PrivilegingWith<T> proxy(Class<T> type) { return new PrivilegingWith<T>(new Privileging<T>(type)); }
Privileging { public static <T> PrivilegingWith<T> proxy(Class<T> type) { return new PrivilegingWith<T>(new Privileging<T>(type)); } }
Privileging { public static <T> PrivilegingWith<T> proxy(Class<T> type) { return new PrivilegingWith<T>(new Privileging<T>(type)); } private Privileging(Class<T> type); }
Privileging { public static <T> PrivilegingWith<T> proxy(Class<T> type) { return new PrivilegingWith<T>(new Privileging<T>(type)); } private Privileging(Class<T> type); static PrivilegingWith<T> proxy(Class<T> type); static PrivilegingExecutedByOrBuild<T> proxy(T target); }
Privileging { public static <T> PrivilegingWith<T> proxy(Class<T> type) { return new PrivilegingWith<T>(new Privileging<T>(type)); } private Privileging(Class<T> type); static PrivilegingWith<T> proxy(Class<T> type); static PrivilegingExecutedByOrBuild<T> proxy(T target); }
@Test(expected=ArithmeticException.class) public void callWillThrowRuntimeException() throws Exception { Foo fooMock = mock(Foo.class); when(fooMock.call("Arthur")).thenThrow(new ArithmeticException("JUnit")); Foo foo = Privileging.proxy(Foo.class).with(fooMock).executedBy(new DirectExecutor()).build(getFactory()); foo...
public static <T> PrivilegingWith<T> proxy(Class<T> type) { return new PrivilegingWith<T>(new Privileging<T>(type)); }
Privileging { public static <T> PrivilegingWith<T> proxy(Class<T> type) { return new PrivilegingWith<T>(new Privileging<T>(type)); } }
Privileging { public static <T> PrivilegingWith<T> proxy(Class<T> type) { return new PrivilegingWith<T>(new Privileging<T>(type)); } private Privileging(Class<T> type); }
Privileging { public static <T> PrivilegingWith<T> proxy(Class<T> type) { return new PrivilegingWith<T>(new Privileging<T>(type)); } private Privileging(Class<T> type); static PrivilegingWith<T> proxy(Class<T> type); static PrivilegingExecutedByOrBuild<T> proxy(T target); }
Privileging { public static <T> PrivilegingWith<T> proxy(Class<T> type) { return new PrivilegingWith<T>(new Privileging<T>(type)); } private Privileging(Class<T> type); static PrivilegingWith<T> proxy(Class<T> type); static PrivilegingExecutedByOrBuild<T> proxy(T target); }
@Test public void callWillCallToString() throws Exception { Foo fooMock = mock(Foo.class); when(fooMock.toString()).thenReturn("Arthur"); Foo foo = Privileging.proxy(Foo.class).with(fooMock).executedBy(new DirectExecutor()).build(getFactory()); assertEquals("Arthur", foo.toString()); }
public static <T> PrivilegingWith<T> proxy(Class<T> type) { return new PrivilegingWith<T>(new Privileging<T>(type)); }
Privileging { public static <T> PrivilegingWith<T> proxy(Class<T> type) { return new PrivilegingWith<T>(new Privileging<T>(type)); } }
Privileging { public static <T> PrivilegingWith<T> proxy(Class<T> type) { return new PrivilegingWith<T>(new Privileging<T>(type)); } private Privileging(Class<T> type); }
Privileging { public static <T> PrivilegingWith<T> proxy(Class<T> type) { return new PrivilegingWith<T>(new Privileging<T>(type)); } private Privileging(Class<T> type); static PrivilegingWith<T> proxy(Class<T> type); static PrivilegingExecutedByOrBuild<T> proxy(T target); }
Privileging { public static <T> PrivilegingWith<T> proxy(Class<T> type) { return new PrivilegingWith<T>(new Privileging<T>(type)); } private Privileging(Class<T> type); static PrivilegingWith<T> proxy(Class<T> type); static PrivilegingExecutedByOrBuild<T> proxy(T target); }
@Test public void shouldFailoverToNextOnSpecialException() { FailsOnNthCall first = new FailsOnNthCallImpl(1); FailsOnNthCall second = new FailsOnNthCallImpl(1); FailsOnNthCall failover = Failover.proxy(FailsOnNthCall.class) .with(first, second) .excepting(RuntimeException.class) .build(getFactory()); assertEquals(0, f...
public static <T> FailoverWithOrExceptingOrBuild<T> proxy(Class<T> type) { return new FailoverWithOrExceptingOrBuild<T>(new Failover<T>(type)); }
Failover { public static <T> FailoverWithOrExceptingOrBuild<T> proxy(Class<T> type) { return new FailoverWithOrExceptingOrBuild<T>(new Failover<T>(type)); } }
Failover { public static <T> FailoverWithOrExceptingOrBuild<T> proxy(Class<T> type) { return new FailoverWithOrExceptingOrBuild<T>(new Failover<T>(type)); } private Failover(Class<T> primaryType, Class<?>... types); }
Failover { public static <T> FailoverWithOrExceptingOrBuild<T> proxy(Class<T> type) { return new FailoverWithOrExceptingOrBuild<T>(new Failover<T>(type)); } private Failover(Class<T> primaryType, Class<?>... types); static FailoverWithOrExceptingOrBuild<T> proxy(Class<T> type); static FailoverWithOrExceptingOrBuild<T>...
Failover { public static <T> FailoverWithOrExceptingOrBuild<T> proxy(Class<T> type) { return new FailoverWithOrExceptingOrBuild<T>(new Failover<T>(type)); } private Failover(Class<T> primaryType, Class<?>... types); static FailoverWithOrExceptingOrBuild<T> proxy(Class<T> type); static FailoverWithOrExceptingOrBuild<T>...
@Test public void serializeWithJDK() throws IOException, ClassNotFoundException { final FailsOnNthCall failover = Failover.proxy(FailsOnNthCall.class) .with(new FailsOnNthCallImpl(1), new FailsOnNthCallImpl(1)) .excepting(RuntimeException.class) .build(getFactory()); failover.doIt(); useSerializedProxy(serializeWithJDK...
public static <T> FailoverWithOrExceptingOrBuild<T> proxy(Class<T> type) { return new FailoverWithOrExceptingOrBuild<T>(new Failover<T>(type)); }
Failover { public static <T> FailoverWithOrExceptingOrBuild<T> proxy(Class<T> type) { return new FailoverWithOrExceptingOrBuild<T>(new Failover<T>(type)); } }
Failover { public static <T> FailoverWithOrExceptingOrBuild<T> proxy(Class<T> type) { return new FailoverWithOrExceptingOrBuild<T>(new Failover<T>(type)); } private Failover(Class<T> primaryType, Class<?>... types); }
Failover { public static <T> FailoverWithOrExceptingOrBuild<T> proxy(Class<T> type) { return new FailoverWithOrExceptingOrBuild<T>(new Failover<T>(type)); } private Failover(Class<T> primaryType, Class<?>... types); static FailoverWithOrExceptingOrBuild<T> proxy(Class<T> type); static FailoverWithOrExceptingOrBuild<T>...
Failover { public static <T> FailoverWithOrExceptingOrBuild<T> proxy(Class<T> type) { return new FailoverWithOrExceptingOrBuild<T>(new Failover<T>(type)); } private Failover(Class<T> primaryType, Class<?>... types); static FailoverWithOrExceptingOrBuild<T> proxy(Class<T> type); static FailoverWithOrExceptingOrBuild<T>...
@Test public void serializeWithXStream() { final FailsOnNthCall failover = Failover.proxy(FailsOnNthCall.class) .with(new FailsOnNthCallImpl(1), new FailsOnNthCallImpl(1)) .excepting(RuntimeException.class) .build(getFactory()); failover.doIt(); useSerializedProxy(serializeWithXStream(failover)); }
public static <T> FailoverWithOrExceptingOrBuild<T> proxy(Class<T> type) { return new FailoverWithOrExceptingOrBuild<T>(new Failover<T>(type)); }
Failover { public static <T> FailoverWithOrExceptingOrBuild<T> proxy(Class<T> type) { return new FailoverWithOrExceptingOrBuild<T>(new Failover<T>(type)); } }
Failover { public static <T> FailoverWithOrExceptingOrBuild<T> proxy(Class<T> type) { return new FailoverWithOrExceptingOrBuild<T>(new Failover<T>(type)); } private Failover(Class<T> primaryType, Class<?>... types); }
Failover { public static <T> FailoverWithOrExceptingOrBuild<T> proxy(Class<T> type) { return new FailoverWithOrExceptingOrBuild<T>(new Failover<T>(type)); } private Failover(Class<T> primaryType, Class<?>... types); static FailoverWithOrExceptingOrBuild<T> proxy(Class<T> type); static FailoverWithOrExceptingOrBuild<T>...
Failover { public static <T> FailoverWithOrExceptingOrBuild<T> proxy(Class<T> type) { return new FailoverWithOrExceptingOrBuild<T>(new Failover<T>(type)); } private Failover(Class<T> primaryType, Class<?>... types); static FailoverWithOrExceptingOrBuild<T> proxy(Class<T> type); static FailoverWithOrExceptingOrBuild<T>...
@Test public void serializeWithXStreamInPureReflectionMode() { final FailsOnNthCall failover = Failover.proxy(FailsOnNthCall.class) .with(new FailsOnNthCallImpl(1), new FailsOnNthCallImpl(1)) .excepting(RuntimeException.class) .build(getFactory()); failover.doIt(); useSerializedProxy(serializeWithXStreamAndPureReflecti...
public static <T> FailoverWithOrExceptingOrBuild<T> proxy(Class<T> type) { return new FailoverWithOrExceptingOrBuild<T>(new Failover<T>(type)); }
Failover { public static <T> FailoverWithOrExceptingOrBuild<T> proxy(Class<T> type) { return new FailoverWithOrExceptingOrBuild<T>(new Failover<T>(type)); } }
Failover { public static <T> FailoverWithOrExceptingOrBuild<T> proxy(Class<T> type) { return new FailoverWithOrExceptingOrBuild<T>(new Failover<T>(type)); } private Failover(Class<T> primaryType, Class<?>... types); }
Failover { public static <T> FailoverWithOrExceptingOrBuild<T> proxy(Class<T> type) { return new FailoverWithOrExceptingOrBuild<T>(new Failover<T>(type)); } private Failover(Class<T> primaryType, Class<?>... types); static FailoverWithOrExceptingOrBuild<T> proxy(Class<T> type); static FailoverWithOrExceptingOrBuild<T>...
Failover { public static <T> FailoverWithOrExceptingOrBuild<T> proxy(Class<T> type) { return new FailoverWithOrExceptingOrBuild<T>(new Failover<T>(type)); } private Failover(Class<T> primaryType, Class<?>... types); static FailoverWithOrExceptingOrBuild<T> proxy(Class<T> type); static FailoverWithOrExceptingOrBuild<T>...
@Test public void shouldSupportIndirectRecursion() { Faculty fac = new Faculty() { public int calc(int i, Faculty fac) { return i == 1 ? 1 : i * fac.calc(i - 1, fac); } }; Faculty proxy = Delegating.proxy(Faculty.class).with(fac).build(getFactory()); assertEquals(120, fac.calc(5, fac)); assertEquals(120, proxy.calc(5, ...
public static <T> DelegatingWith<T> proxy(Class<T> type) { return new DelegatingWith<T>(new Delegating<T>(type)); }
Delegating { public static <T> DelegatingWith<T> proxy(Class<T> type) { return new DelegatingWith<T>(new Delegating<T>(type)); } }
Delegating { public static <T> DelegatingWith<T> proxy(Class<T> type) { return new DelegatingWith<T>(new Delegating<T>(type)); } private Delegating(Class<T> type); }
Delegating { public static <T> DelegatingWith<T> proxy(Class<T> type) { return new DelegatingWith<T>(new Delegating<T>(type)); } private Delegating(Class<T> type); static DelegatingWith<T> proxy(Class<T> type); }
Delegating { public static <T> DelegatingWith<T> proxy(Class<T> type) { return new DelegatingWith<T>(new Delegating<T>(type)); } private Delegating(Class<T> type); static DelegatingWith<T> proxy(Class<T> type); }
@Test public void serializeWithJDK() throws IOException, ClassNotFoundException { useSerializedProxy(serializeWithJDK( Decorating.proxy(CharSequence.class).with("Test").visiting(new AssertingDecorator()).build(getFactory()))); }
public static <T> DecoratingWith<T> proxy(final Class<T> type) { return new DecoratingWith<T>(new Decorating<T, T>((T)null, type)); }
Decorating { public static <T> DecoratingWith<T> proxy(final Class<T> type) { return new DecoratingWith<T>(new Decorating<T, T>((T)null, type)); } }
Decorating { public static <T> DecoratingWith<T> proxy(final Class<T> type) { return new DecoratingWith<T>(new Decorating<T, T>((T)null, type)); } private Decorating(final U delegate, final Class<T>primaryType, final Class<?>... types); }
Decorating { public static <T> DecoratingWith<T> proxy(final Class<T> type) { return new DecoratingWith<T>(new Decorating<T, T>((T)null, type)); } private Decorating(final U delegate, final Class<T>primaryType, final Class<?>... types); static DecoratingWith<T> proxy(final Class<T> type); static DecoratingWith<T> prox...
Decorating { public static <T> DecoratingWith<T> proxy(final Class<T> type) { return new DecoratingWith<T>(new Decorating<T, T>((T)null, type)); } private Decorating(final U delegate, final Class<T>primaryType, final Class<?>... types); static DecoratingWith<T> proxy(final Class<T> type); static DecoratingWith<T> prox...
@Test public void shouldEchoMethodNameAndArgs() throws Exception { Writer out = new StringWriter(); Simple foo = Echoing.proxy(Simple.class).to(new PrintWriter(out)).build(getFactory()); foo.doSomething(); assertContains("Simple.doSomething()", out); }
public static <T> EchoingWithOrTo<T> proxy(final Class<T> type) { return new EchoingWithOrTo<T>(new Echoing<T>(type)); }
Echoing { public static <T> EchoingWithOrTo<T> proxy(final Class<T> type) { return new EchoingWithOrTo<T>(new Echoing<T>(type)); } }
Echoing { public static <T> EchoingWithOrTo<T> proxy(final Class<T> type) { return new EchoingWithOrTo<T>(new Echoing<T>(type)); } private Echoing(final Class<T> type); }
Echoing { public static <T> EchoingWithOrTo<T> proxy(final Class<T> type) { return new EchoingWithOrTo<T>(new Echoing<T>(type)); } private Echoing(final Class<T> type); static EchoingWithOrTo<T> proxy(final Class<T> type); }
Echoing { public static <T> EchoingWithOrTo<T> proxy(final Class<T> type) { return new EchoingWithOrTo<T>(new Echoing<T>(type)); } private Echoing(final Class<T> type); static EchoingWithOrTo<T> proxy(final Class<T> type); }
@Test public void shouldDelegateCalls() throws Exception { Writer out = new StringWriter(); Simple foo = Echoing.proxy(Simple.class).with(simpleMock).to(new PrintWriter(out)).build(getFactory()); foo.doSomething(); verify(simpleMock).doSomething(); }
public static <T> EchoingWithOrTo<T> proxy(final Class<T> type) { return new EchoingWithOrTo<T>(new Echoing<T>(type)); }
Echoing { public static <T> EchoingWithOrTo<T> proxy(final Class<T> type) { return new EchoingWithOrTo<T>(new Echoing<T>(type)); } }
Echoing { public static <T> EchoingWithOrTo<T> proxy(final Class<T> type) { return new EchoingWithOrTo<T>(new Echoing<T>(type)); } private Echoing(final Class<T> type); }
Echoing { public static <T> EchoingWithOrTo<T> proxy(final Class<T> type) { return new EchoingWithOrTo<T>(new Echoing<T>(type)); } private Echoing(final Class<T> type); static EchoingWithOrTo<T> proxy(final Class<T> type); }
Echoing { public static <T> EchoingWithOrTo<T> proxy(final Class<T> type) { return new EchoingWithOrTo<T>(new Echoing<T>(type)); } private Echoing(final Class<T> type); static EchoingWithOrTo<T> proxy(final Class<T> type); }
@Test public void shouldRecursivelyReturnEchoProxiesForInterfaces() throws Exception { Inner innerMock = mock(Inner.class); Outer outerMock = mock(Outer.class); StringWriter out = new StringWriter(); Outer outer = Echoing.proxy(Outer.class).with(outerMock).to(new PrintWriter(out)).build(getFactory()); when(outerMock.ge...
public static <T> EchoingWithOrTo<T> proxy(final Class<T> type) { return new EchoingWithOrTo<T>(new Echoing<T>(type)); }
Echoing { public static <T> EchoingWithOrTo<T> proxy(final Class<T> type) { return new EchoingWithOrTo<T>(new Echoing<T>(type)); } }
Echoing { public static <T> EchoingWithOrTo<T> proxy(final Class<T> type) { return new EchoingWithOrTo<T>(new Echoing<T>(type)); } private Echoing(final Class<T> type); }
Echoing { public static <T> EchoingWithOrTo<T> proxy(final Class<T> type) { return new EchoingWithOrTo<T>(new Echoing<T>(type)); } private Echoing(final Class<T> type); static EchoingWithOrTo<T> proxy(final Class<T> type); }
Echoing { public static <T> EchoingWithOrTo<T> proxy(final Class<T> type) { return new EchoingWithOrTo<T>(new Echoing<T>(type)); } private Echoing(final Class<T> type); static EchoingWithOrTo<T> proxy(final Class<T> type); }
@Test public void shouldRecursivelyReturnEchoProxiesEvenForMissingImplementations() throws Exception { StringWriter out = new StringWriter(); Outer outer = Echoing.proxy(Outer.class).to(new PrintWriter(out)).build(getFactory()); outer.getInner().getName(); assertContains("Outer.getInner()", out); assertContains("Inner....
public static <T> EchoingWithOrTo<T> proxy(final Class<T> type) { return new EchoingWithOrTo<T>(new Echoing<T>(type)); }
Echoing { public static <T> EchoingWithOrTo<T> proxy(final Class<T> type) { return new EchoingWithOrTo<T>(new Echoing<T>(type)); } }
Echoing { public static <T> EchoingWithOrTo<T> proxy(final Class<T> type) { return new EchoingWithOrTo<T>(new Echoing<T>(type)); } private Echoing(final Class<T> type); }
Echoing { public static <T> EchoingWithOrTo<T> proxy(final Class<T> type) { return new EchoingWithOrTo<T>(new Echoing<T>(type)); } private Echoing(final Class<T> type); static EchoingWithOrTo<T> proxy(final Class<T> type); }
Echoing { public static <T> EchoingWithOrTo<T> proxy(final Class<T> type) { return new EchoingWithOrTo<T>(new Echoing<T>(type)); } private Echoing(final Class<T> type); static EchoingWithOrTo<T> proxy(final Class<T> type); }
@Test public void shouldDenyProxyGenerationForFinalClasses() throws Exception { ProxyFactory factory = new CglibProxyFactory(); assertFalse(factory.canProxy(String.class)); }
public boolean canProxy(final Class<?> type) { return !Modifier.isFinal(type.getModifiers()); }
CglibProxyFactory extends AbstractProxyFactory { public boolean canProxy(final Class<?> type) { return !Modifier.isFinal(type.getModifiers()); } }
CglibProxyFactory extends AbstractProxyFactory { public boolean canProxy(final Class<?> type) { return !Modifier.isFinal(type.getModifiers()); } CglibProxyFactory(); CglibProxyFactory(boolean interceptDuringConstruction); }
CglibProxyFactory extends AbstractProxyFactory { public boolean canProxy(final Class<?> type) { return !Modifier.isFinal(type.getModifiers()); } CglibProxyFactory(); CglibProxyFactory(boolean interceptDuringConstruction); T createProxy(final Invoker invoker, final Class<?>... types); boolean canProxy(final Class<?> ty...
CglibProxyFactory extends AbstractProxyFactory { public boolean canProxy(final Class<?> type) { return !Modifier.isFinal(type.getModifiers()); } CglibProxyFactory(); CglibProxyFactory(boolean interceptDuringConstruction); T createProxy(final Invoker invoker, final Class<?>... types); boolean canProxy(final Class<?> ty...
@Test public void mostCommonSuperclassForClassesWithACommonBaseClass() { assertEquals(Writer.class, ReflectionUtils.getMostCommonSuperclass(new StringWriter(), new OutputStreamWriter(System.out))); assertEquals(Writer.class, ReflectionUtils.getMostCommonSuperclass(new OutputStreamWriter(System.out), new StringWriter())...
public static Class<?> getMostCommonSuperclass(Object... objects) { Class<?> type = null; boolean found = false; if (objects != null && objects.length > 0) { while (!found) { for (Object object : objects) { found = true; if (object != null) { final Class<?> currenttype = object.getClass(); if (type == null) { type = cu...
ReflectionUtils { public static Class<?> getMostCommonSuperclass(Object... objects) { Class<?> type = null; boolean found = false; if (objects != null && objects.length > 0) { while (!found) { for (Object object : objects) { found = true; if (object != null) { final Class<?> currenttype = object.getClass(); if (type ==...
ReflectionUtils { public static Class<?> getMostCommonSuperclass(Object... objects) { Class<?> type = null; boolean found = false; if (objects != null && objects.length > 0) { while (!found) { for (Object object : objects) { found = true; if (object != null) { final Class<?> currenttype = object.getClass(); if (type ==...
ReflectionUtils { public static Class<?> getMostCommonSuperclass(Object... objects) { Class<?> type = null; boolean found = false; if (objects != null && objects.length > 0) { while (!found) { for (Object object : objects) { found = true; if (object != null) { final Class<?> currenttype = object.getClass(); if (type ==...
ReflectionUtils { public static Class<?> getMostCommonSuperclass(Object... objects) { Class<?> type = null; boolean found = false; if (objects != null && objects.length > 0) { while (!found) { for (Object object : objects) { found = true; if (object != null) { final Class<?> currenttype = object.getClass(); if (type ==...
@Test public void mostCommonSuperclassForClassesAreInSameHierarchy() { assertEquals(OutputStreamWriter.class, ReflectionUtils.getMostCommonSuperclass(new FileWriter(FileDescriptor.out), new OutputStreamWriter(System.out))); assertEquals(OutputStreamWriter.class, ReflectionUtils.getMostCommonSuperclass(new OutputStreamW...
public static Class<?> getMostCommonSuperclass(Object... objects) { Class<?> type = null; boolean found = false; if (objects != null && objects.length > 0) { while (!found) { for (Object object : objects) { found = true; if (object != null) { final Class<?> currenttype = object.getClass(); if (type == null) { type = cu...
ReflectionUtils { public static Class<?> getMostCommonSuperclass(Object... objects) { Class<?> type = null; boolean found = false; if (objects != null && objects.length > 0) { while (!found) { for (Object object : objects) { found = true; if (object != null) { final Class<?> currenttype = object.getClass(); if (type ==...
ReflectionUtils { public static Class<?> getMostCommonSuperclass(Object... objects) { Class<?> type = null; boolean found = false; if (objects != null && objects.length > 0) { while (!found) { for (Object object : objects) { found = true; if (object != null) { final Class<?> currenttype = object.getClass(); if (type ==...
ReflectionUtils { public static Class<?> getMostCommonSuperclass(Object... objects) { Class<?> type = null; boolean found = false; if (objects != null && objects.length > 0) { while (!found) { for (Object object : objects) { found = true; if (object != null) { final Class<?> currenttype = object.getClass(); if (type ==...
ReflectionUtils { public static Class<?> getMostCommonSuperclass(Object... objects) { Class<?> type = null; boolean found = false; if (objects != null && objects.length > 0) { while (!found) { for (Object object : objects) { found = true; if (object != null) { final Class<?> currenttype = object.getClass(); if (type ==...
@Test public void mostCommonSuperclassForClassesInSameOrDifferentHierarchy() { assertEquals(Writer.class, ReflectionUtils.getMostCommonSuperclass(new FileWriter(FileDescriptor.out), new StringWriter(), new OutputStreamWriter(System.out))); assertEquals(Writer.class, ReflectionUtils.getMostCommonSuperclass(new FileWrite...
public static Class<?> getMostCommonSuperclass(Object... objects) { Class<?> type = null; boolean found = false; if (objects != null && objects.length > 0) { while (!found) { for (Object object : objects) { found = true; if (object != null) { final Class<?> currenttype = object.getClass(); if (type == null) { type = cu...
ReflectionUtils { public static Class<?> getMostCommonSuperclass(Object... objects) { Class<?> type = null; boolean found = false; if (objects != null && objects.length > 0) { while (!found) { for (Object object : objects) { found = true; if (object != null) { final Class<?> currenttype = object.getClass(); if (type ==...
ReflectionUtils { public static Class<?> getMostCommonSuperclass(Object... objects) { Class<?> type = null; boolean found = false; if (objects != null && objects.length > 0) { while (!found) { for (Object object : objects) { found = true; if (object != null) { final Class<?> currenttype = object.getClass(); if (type ==...
ReflectionUtils { public static Class<?> getMostCommonSuperclass(Object... objects) { Class<?> type = null; boolean found = false; if (objects != null && objects.length > 0) { while (!found) { for (Object object : objects) { found = true; if (object != null) { final Class<?> currenttype = object.getClass(); if (type ==...
ReflectionUtils { public static Class<?> getMostCommonSuperclass(Object... objects) { Class<?> type = null; boolean found = false; if (objects != null && objects.length > 0) { while (!found) { for (Object object : objects) { found = true; if (object != null) { final Class<?> currenttype = object.getClass(); if (type ==...
@Test public void mostCommonSuperclassForUnmatchingObjects() { assertEquals(Object.class, ReflectionUtils.getMostCommonSuperclass(1, new OutputStreamWriter(System.out))); assertEquals(Object.class, ReflectionUtils.getMostCommonSuperclass(new OutputStreamWriter(System.out), 1)); }
public static Class<?> getMostCommonSuperclass(Object... objects) { Class<?> type = null; boolean found = false; if (objects != null && objects.length > 0) { while (!found) { for (Object object : objects) { found = true; if (object != null) { final Class<?> currenttype = object.getClass(); if (type == null) { type = cu...
ReflectionUtils { public static Class<?> getMostCommonSuperclass(Object... objects) { Class<?> type = null; boolean found = false; if (objects != null && objects.length > 0) { while (!found) { for (Object object : objects) { found = true; if (object != null) { final Class<?> currenttype = object.getClass(); if (type ==...
ReflectionUtils { public static Class<?> getMostCommonSuperclass(Object... objects) { Class<?> type = null; boolean found = false; if (objects != null && objects.length > 0) { while (!found) { for (Object object : objects) { found = true; if (object != null) { final Class<?> currenttype = object.getClass(); if (type ==...
ReflectionUtils { public static Class<?> getMostCommonSuperclass(Object... objects) { Class<?> type = null; boolean found = false; if (objects != null && objects.length > 0) { while (!found) { for (Object object : objects) { found = true; if (object != null) { final Class<?> currenttype = object.getClass(); if (type ==...
ReflectionUtils { public static Class<?> getMostCommonSuperclass(Object... objects) { Class<?> type = null; boolean found = false; if (objects != null && objects.length > 0) { while (!found) { for (Object object : objects) { found = true; if (object != null) { final Class<?> currenttype = object.getClass(); if (type ==...
@Test public void mostCommonSuperclassForEmptyArray() { assertEquals(Object.class, ReflectionUtils.getMostCommonSuperclass()); }
public static Class<?> getMostCommonSuperclass(Object... objects) { Class<?> type = null; boolean found = false; if (objects != null && objects.length > 0) { while (!found) { for (Object object : objects) { found = true; if (object != null) { final Class<?> currenttype = object.getClass(); if (type == null) { type = cu...
ReflectionUtils { public static Class<?> getMostCommonSuperclass(Object... objects) { Class<?> type = null; boolean found = false; if (objects != null && objects.length > 0) { while (!found) { for (Object object : objects) { found = true; if (object != null) { final Class<?> currenttype = object.getClass(); if (type ==...
ReflectionUtils { public static Class<?> getMostCommonSuperclass(Object... objects) { Class<?> type = null; boolean found = false; if (objects != null && objects.length > 0) { while (!found) { for (Object object : objects) { found = true; if (object != null) { final Class<?> currenttype = object.getClass(); if (type ==...
ReflectionUtils { public static Class<?> getMostCommonSuperclass(Object... objects) { Class<?> type = null; boolean found = false; if (objects != null && objects.length > 0) { while (!found) { for (Object object : objects) { found = true; if (object != null) { final Class<?> currenttype = object.getClass(); if (type ==...
ReflectionUtils { public static Class<?> getMostCommonSuperclass(Object... objects) { Class<?> type = null; boolean found = false; if (objects != null && objects.length > 0) { while (!found) { for (Object object : objects) { found = true; if (object != null) { final Class<?> currenttype = object.getClass(); if (type ==...
@Test public void serializeWithXStream() { useSerializedProxy(serializeWithXStream( Decorating.proxy(CharSequence.class).with("Test").visiting(new AssertingDecorator()).build(getFactory()))); }
public static <T> DecoratingWith<T> proxy(final Class<T> type) { return new DecoratingWith<T>(new Decorating<T, T>((T)null, type)); }
Decorating { public static <T> DecoratingWith<T> proxy(final Class<T> type) { return new DecoratingWith<T>(new Decorating<T, T>((T)null, type)); } }
Decorating { public static <T> DecoratingWith<T> proxy(final Class<T> type) { return new DecoratingWith<T>(new Decorating<T, T>((T)null, type)); } private Decorating(final U delegate, final Class<T>primaryType, final Class<?>... types); }
Decorating { public static <T> DecoratingWith<T> proxy(final Class<T> type) { return new DecoratingWith<T>(new Decorating<T, T>((T)null, type)); } private Decorating(final U delegate, final Class<T>primaryType, final Class<?>... types); static DecoratingWith<T> proxy(final Class<T> type); static DecoratingWith<T> prox...
Decorating { public static <T> DecoratingWith<T> proxy(final Class<T> type) { return new DecoratingWith<T>(new Decorating<T, T>((T)null, type)); } private Decorating(final U delegate, final Class<T>primaryType, final Class<?>... types); static DecoratingWith<T> proxy(final Class<T> type); static DecoratingWith<T> prox...
@Test public void mostCommonSuperclassForNullElements() { assertEquals(Object.class, ReflectionUtils.getMostCommonSuperclass(null, null)); }
public static Class<?> getMostCommonSuperclass(Object... objects) { Class<?> type = null; boolean found = false; if (objects != null && objects.length > 0) { while (!found) { for (Object object : objects) { found = true; if (object != null) { final Class<?> currenttype = object.getClass(); if (type == null) { type = cu...
ReflectionUtils { public static Class<?> getMostCommonSuperclass(Object... objects) { Class<?> type = null; boolean found = false; if (objects != null && objects.length > 0) { while (!found) { for (Object object : objects) { found = true; if (object != null) { final Class<?> currenttype = object.getClass(); if (type ==...
ReflectionUtils { public static Class<?> getMostCommonSuperclass(Object... objects) { Class<?> type = null; boolean found = false; if (objects != null && objects.length > 0) { while (!found) { for (Object object : objects) { found = true; if (object != null) { final Class<?> currenttype = object.getClass(); if (type ==...
ReflectionUtils { public static Class<?> getMostCommonSuperclass(Object... objects) { Class<?> type = null; boolean found = false; if (objects != null && objects.length > 0) { while (!found) { for (Object object : objects) { found = true; if (object != null) { final Class<?> currenttype = object.getClass(); if (type ==...
ReflectionUtils { public static Class<?> getMostCommonSuperclass(Object... objects) { Class<?> type = null; boolean found = false; if (objects != null && objects.length > 0) { while (!found) { for (Object object : objects) { found = true; if (object != null) { final Class<?> currenttype = object.getClass(); if (type ==...
@Test public void mostCommonSuperclassForCollections() { assertEquals(AbstractList.class, ReflectionUtils.getMostCommonSuperclass(new LinkedList<Object>(), new Vector<Object>())); }
public static Class<?> getMostCommonSuperclass(Object... objects) { Class<?> type = null; boolean found = false; if (objects != null && objects.length > 0) { while (!found) { for (Object object : objects) { found = true; if (object != null) { final Class<?> currenttype = object.getClass(); if (type == null) { type = cu...
ReflectionUtils { public static Class<?> getMostCommonSuperclass(Object... objects) { Class<?> type = null; boolean found = false; if (objects != null && objects.length > 0) { while (!found) { for (Object object : objects) { found = true; if (object != null) { final Class<?> currenttype = object.getClass(); if (type ==...
ReflectionUtils { public static Class<?> getMostCommonSuperclass(Object... objects) { Class<?> type = null; boolean found = false; if (objects != null && objects.length > 0) { while (!found) { for (Object object : objects) { found = true; if (object != null) { final Class<?> currenttype = object.getClass(); if (type ==...
ReflectionUtils { public static Class<?> getMostCommonSuperclass(Object... objects) { Class<?> type = null; boolean found = false; if (objects != null && objects.length > 0) { while (!found) { for (Object object : objects) { found = true; if (object != null) { final Class<?> currenttype = object.getClass(); if (type ==...
ReflectionUtils { public static Class<?> getMostCommonSuperclass(Object... objects) { Class<?> type = null; boolean found = false; if (objects != null && objects.length > 0) { while (!found) { for (Object object : objects) { found = true; if (object != null) { final Class<?> currenttype = object.getClass(); if (type ==...
@Test public void allInterfacesOfListShouldBeFound() { Set<Class<?>> interfaces = ReflectionUtils.getAllInterfaces(BeanContextServices.class); assertTrue(interfaces.contains(BeanContextServices.class)); assertTrue(interfaces.contains(BeanContext.class)); assertTrue(interfaces.contains(Collection.class)); assertTrue(int...
public static Set<Class<?>> getAllInterfaces(Object... objects) { final Set<Class<?>> interfaces = new HashSet<Class<?>>(); for (Object object : objects) { if (object != null) { getInterfaces(object.getClass(), interfaces); } } interfaces.remove(InvokerReference.class); return interfaces; }
ReflectionUtils { public static Set<Class<?>> getAllInterfaces(Object... objects) { final Set<Class<?>> interfaces = new HashSet<Class<?>>(); for (Object object : objects) { if (object != null) { getInterfaces(object.getClass(), interfaces); } } interfaces.remove(InvokerReference.class); return interfaces; } }
ReflectionUtils { public static Set<Class<?>> getAllInterfaces(Object... objects) { final Set<Class<?>> interfaces = new HashSet<Class<?>>(); for (Object object : objects) { if (object != null) { getInterfaces(object.getClass(), interfaces); } } interfaces.remove(InvokerReference.class); return interfaces; } private R...
ReflectionUtils { public static Set<Class<?>> getAllInterfaces(Object... objects) { final Set<Class<?>> interfaces = new HashSet<Class<?>>(); for (Object object : objects) { if (object != null) { getInterfaces(object.getClass(), interfaces); } } interfaces.remove(InvokerReference.class); return interfaces; } private R...
ReflectionUtils { public static Set<Class<?>> getAllInterfaces(Object... objects) { final Set<Class<?>> interfaces = new HashSet<Class<?>>(); for (Object object : objects) { if (object != null) { getInterfaces(object.getClass(), interfaces); } } interfaces.remove(InvokerReference.class); return interfaces; } private R...
@Test public void matchingMethodIsFound() throws Exception { Method appendChar = ReflectionUtils.getMatchingMethod(StringBuffer.class, "append", new Object[]{'c'}); Method appendCharArray = ReflectionUtils.getMatchingMethod( StringBuffer.class, "append", new Object[]{new char[]{'c'}}); Method appendShort = ReflectionUt...
public static Method getMatchingMethod(final Class<?> type, final String methodName, final Object[] args) throws NoSuchMethodException { final Object[] newArgs = args == null ? new Object[0] : args; final Method[] methods = type.getMethods(); final Set<Method> possibleMethods = new HashSet<Method>(); Method method = nu...
ReflectionUtils { public static Method getMatchingMethod(final Class<?> type, final String methodName, final Object[] args) throws NoSuchMethodException { final Object[] newArgs = args == null ? new Object[0] : args; final Method[] methods = type.getMethods(); final Set<Method> possibleMethods = new HashSet<Method>(); ...
ReflectionUtils { public static Method getMatchingMethod(final Class<?> type, final String methodName, final Object[] args) throws NoSuchMethodException { final Object[] newArgs = args == null ? new Object[0] : args; final Method[] methods = type.getMethods(); final Set<Method> possibleMethods = new HashSet<Method>(); ...
ReflectionUtils { public static Method getMatchingMethod(final Class<?> type, final String methodName, final Object[] args) throws NoSuchMethodException { final Object[] newArgs = args == null ? new Object[0] : args; final Method[] methods = type.getMethods(); final Set<Method> possibleMethods = new HashSet<Method>(); ...
ReflectionUtils { public static Method getMatchingMethod(final Class<?> type, final String methodName, final Object[] args) throws NoSuchMethodException { final Object[] newArgs = args == null ? new Object[0] : args; final Method[] methods = type.getMethods(); final Set<Method> possibleMethods = new HashSet<Method>(); ...
@Test public void matchingMethodArgumentCanBeNull() throws Exception { Method appendObject = ReflectionUtils.getMatchingMethod(StringBuffer.class, "append", new Object[]{null}); assertNotNull(appendObject); }
public static Method getMatchingMethod(final Class<?> type, final String methodName, final Object[] args) throws NoSuchMethodException { final Object[] newArgs = args == null ? new Object[0] : args; final Method[] methods = type.getMethods(); final Set<Method> possibleMethods = new HashSet<Method>(); Method method = nu...
ReflectionUtils { public static Method getMatchingMethod(final Class<?> type, final String methodName, final Object[] args) throws NoSuchMethodException { final Object[] newArgs = args == null ? new Object[0] : args; final Method[] methods = type.getMethods(); final Set<Method> possibleMethods = new HashSet<Method>(); ...
ReflectionUtils { public static Method getMatchingMethod(final Class<?> type, final String methodName, final Object[] args) throws NoSuchMethodException { final Object[] newArgs = args == null ? new Object[0] : args; final Method[] methods = type.getMethods(); final Set<Method> possibleMethods = new HashSet<Method>(); ...
ReflectionUtils { public static Method getMatchingMethod(final Class<?> type, final String methodName, final Object[] args) throws NoSuchMethodException { final Object[] newArgs = args == null ? new Object[0] : args; final Method[] methods = type.getMethods(); final Set<Method> possibleMethods = new HashSet<Method>(); ...
ReflectionUtils { public static Method getMatchingMethod(final Class<?> type, final String methodName, final Object[] args) throws NoSuchMethodException { final Object[] newArgs = args == null ? new Object[0] : args; final Method[] methods = type.getMethods(); final Set<Method> possibleMethods = new HashSet<Method>(); ...
@Test public void matchingMethodArgumentsCanBeNull() throws Exception { Method method = ReflectionUtils.getMatchingMethod(StringBuffer.class, "toString", null); assertNotNull(method); }
public static Method getMatchingMethod(final Class<?> type, final String methodName, final Object[] args) throws NoSuchMethodException { final Object[] newArgs = args == null ? new Object[0] : args; final Method[] methods = type.getMethods(); final Set<Method> possibleMethods = new HashSet<Method>(); Method method = nu...
ReflectionUtils { public static Method getMatchingMethod(final Class<?> type, final String methodName, final Object[] args) throws NoSuchMethodException { final Object[] newArgs = args == null ? new Object[0] : args; final Method[] methods = type.getMethods(); final Set<Method> possibleMethods = new HashSet<Method>(); ...
ReflectionUtils { public static Method getMatchingMethod(final Class<?> type, final String methodName, final Object[] args) throws NoSuchMethodException { final Object[] newArgs = args == null ? new Object[0] : args; final Method[] methods = type.getMethods(); final Set<Method> possibleMethods = new HashSet<Method>(); ...
ReflectionUtils { public static Method getMatchingMethod(final Class<?> type, final String methodName, final Object[] args) throws NoSuchMethodException { final Object[] newArgs = args == null ? new Object[0] : args; final Method[] methods = type.getMethods(); final Set<Method> possibleMethods = new HashSet<Method>(); ...
ReflectionUtils { public static Method getMatchingMethod(final Class<?> type, final String methodName, final Object[] args) throws NoSuchMethodException { final Object[] newArgs = args == null ? new Object[0] : args; final Method[] methods = type.getMethods(); final Set<Method> possibleMethods = new HashSet<Method>(); ...
@Test public void noSuchMethodExceptionIsThrownIfNoMatchingMethodCouldBeFound() throws Exception { try { ReflectionUtils.getMatchingMethod(StringBuffer.class, "append", new Object[]{this, StringBuffer.class}); fail("Thrown " + NoSuchMethodException.class.getName() + " expected"); } catch (final NoSuchMethodException e)...
public static Method getMatchingMethod(final Class<?> type, final String methodName, final Object[] args) throws NoSuchMethodException { final Object[] newArgs = args == null ? new Object[0] : args; final Method[] methods = type.getMethods(); final Set<Method> possibleMethods = new HashSet<Method>(); Method method = nu...
ReflectionUtils { public static Method getMatchingMethod(final Class<?> type, final String methodName, final Object[] args) throws NoSuchMethodException { final Object[] newArgs = args == null ? new Object[0] : args; final Method[] methods = type.getMethods(); final Set<Method> possibleMethods = new HashSet<Method>(); ...
ReflectionUtils { public static Method getMatchingMethod(final Class<?> type, final String methodName, final Object[] args) throws NoSuchMethodException { final Object[] newArgs = args == null ? new Object[0] : args; final Method[] methods = type.getMethods(); final Set<Method> possibleMethods = new HashSet<Method>(); ...
ReflectionUtils { public static Method getMatchingMethod(final Class<?> type, final String methodName, final Object[] args) throws NoSuchMethodException { final Object[] newArgs = args == null ? new Object[0] : args; final Method[] methods = type.getMethods(); final Set<Method> possibleMethods = new HashSet<Method>(); ...
ReflectionUtils { public static Method getMatchingMethod(final Class<?> type, final String methodName, final Object[] args) throws NoSuchMethodException { final Object[] newArgs = args == null ? new Object[0] : args; final Method[] methods = type.getMethods(); final Set<Method> possibleMethods = new HashSet<Method>(); ...
@Test public void methodCanBeSerialized() throws IOException, ClassNotFoundException { ByteArrayOutputStream outBuffer = new ByteArrayOutputStream(); ObjectOutputStream outStream = new ObjectOutputStream(outBuffer); ReflectionUtils.writeMethod(outStream, ReflectionUtils.equals); outStream.close(); ByteArrayInputStream ...
public static void writeMethod(final ObjectOutputStream out, final Method method) throws IOException { out.writeObject(method.getDeclaringClass()); out.writeObject(method.getName()); out.writeObject(method.getParameterTypes()); }
ReflectionUtils { public static void writeMethod(final ObjectOutputStream out, final Method method) throws IOException { out.writeObject(method.getDeclaringClass()); out.writeObject(method.getName()); out.writeObject(method.getParameterTypes()); } }
ReflectionUtils { public static void writeMethod(final ObjectOutputStream out, final Method method) throws IOException { out.writeObject(method.getDeclaringClass()); out.writeObject(method.getName()); out.writeObject(method.getParameterTypes()); } private ReflectionUtils(); }
ReflectionUtils { public static void writeMethod(final ObjectOutputStream out, final Method method) throws IOException { out.writeObject(method.getDeclaringClass()); out.writeObject(method.getName()); out.writeObject(method.getParameterTypes()); } private ReflectionUtils(); static Set<Class<?>> getAllInterfaces(Object...
ReflectionUtils { public static void writeMethod(final ObjectOutputStream out, final Method method) throws IOException { out.writeObject(method.getDeclaringClass()); out.writeObject(method.getName()); out.writeObject(method.getParameterTypes()); } private ReflectionUtils(); static Set<Class<?>> getAllInterfaces(Object...
@Test public void methodCanBeDeserialized() throws IOException, ClassNotFoundException { ByteArrayOutputStream outBuffer = new ByteArrayOutputStream(); ObjectOutputStream outStream = new ObjectOutputStream(outBuffer); outStream.writeObject(Object.class); outStream.writeObject("equals"); outStream.writeObject(new Class[...
public static Method readMethod(final ObjectInputStream in) throws IOException, ClassNotFoundException { final Class<?> type = Class.class.cast(in.readObject()); final String name = String.class.cast(in.readObject()); final Class<?>[] parameters = Class[].class.cast(in.readObject()); try { return type.getMethod(name, p...
ReflectionUtils { public static Method readMethod(final ObjectInputStream in) throws IOException, ClassNotFoundException { final Class<?> type = Class.class.cast(in.readObject()); final String name = String.class.cast(in.readObject()); final Class<?>[] parameters = Class[].class.cast(in.readObject()); try { return type...
ReflectionUtils { public static Method readMethod(final ObjectInputStream in) throws IOException, ClassNotFoundException { final Class<?> type = Class.class.cast(in.readObject()); final String name = String.class.cast(in.readObject()); final Class<?>[] parameters = Class[].class.cast(in.readObject()); try { return type...
ReflectionUtils { public static Method readMethod(final ObjectInputStream in) throws IOException, ClassNotFoundException { final Class<?> type = Class.class.cast(in.readObject()); final String name = String.class.cast(in.readObject()); final Class<?>[] parameters = Class[].class.cast(in.readObject()); try { return type...
ReflectionUtils { public static Method readMethod(final ObjectInputStream in) throws IOException, ClassNotFoundException { final Class<?> type = Class.class.cast(in.readObject()); final String name = String.class.cast(in.readObject()); final Class<?>[] parameters = Class[].class.cast(in.readObject()); try { return type...
@Test public void unknownDeserializedMethodThrowsInvalidObjectException() throws IOException, ClassNotFoundException { ByteArrayOutputStream outBuffer = new ByteArrayOutputStream(); ObjectOutputStream outStream = new ObjectOutputStream(outBuffer); outStream.writeObject(Object.class); outStream.writeObject("equals"); ou...
public static Method readMethod(final ObjectInputStream in) throws IOException, ClassNotFoundException { final Class<?> type = Class.class.cast(in.readObject()); final String name = String.class.cast(in.readObject()); final Class<?>[] parameters = Class[].class.cast(in.readObject()); try { return type.getMethod(name, p...
ReflectionUtils { public static Method readMethod(final ObjectInputStream in) throws IOException, ClassNotFoundException { final Class<?> type = Class.class.cast(in.readObject()); final String name = String.class.cast(in.readObject()); final Class<?>[] parameters = Class[].class.cast(in.readObject()); try { return type...
ReflectionUtils { public static Method readMethod(final ObjectInputStream in) throws IOException, ClassNotFoundException { final Class<?> type = Class.class.cast(in.readObject()); final String name = String.class.cast(in.readObject()); final Class<?>[] parameters = Class[].class.cast(in.readObject()); try { return type...
ReflectionUtils { public static Method readMethod(final ObjectInputStream in) throws IOException, ClassNotFoundException { final Class<?> type = Class.class.cast(in.readObject()); final String name = String.class.cast(in.readObject()); final Class<?>[] parameters = Class[].class.cast(in.readObject()); try { return type...
ReflectionUtils { public static Method readMethod(final ObjectInputStream in) throws IOException, ClassNotFoundException { final Class<?> type = Class.class.cast(in.readObject()); final String name = String.class.cast(in.readObject()); final Class<?>[] parameters = Class[].class.cast(in.readObject()); try { return type...
@Test public void serializeWithXStreamInPureReflectionMode() { useSerializedProxy(serializeWithXStreamAndPureReflection( Decorating.proxy(CharSequence.class).with("Test").visiting(new AssertingDecorator()).build(getFactory()))); }
public static <T> DecoratingWith<T> proxy(final Class<T> type) { return new DecoratingWith<T>(new Decorating<T, T>((T)null, type)); }
Decorating { public static <T> DecoratingWith<T> proxy(final Class<T> type) { return new DecoratingWith<T>(new Decorating<T, T>((T)null, type)); } }
Decorating { public static <T> DecoratingWith<T> proxy(final Class<T> type) { return new DecoratingWith<T>(new Decorating<T, T>((T)null, type)); } private Decorating(final U delegate, final Class<T>primaryType, final Class<?>... types); }
Decorating { public static <T> DecoratingWith<T> proxy(final Class<T> type) { return new DecoratingWith<T>(new Decorating<T, T>((T)null, type)); } private Decorating(final U delegate, final Class<T>primaryType, final Class<?>... types); static DecoratingWith<T> proxy(final Class<T> type); static DecoratingWith<T> prox...
Decorating { public static <T> DecoratingWith<T> proxy(final Class<T> type) { return new DecoratingWith<T>(new Decorating<T, T>((T)null, type)); } private Decorating(final U delegate, final Class<T>primaryType, final Class<?>... types); static DecoratingWith<T> proxy(final Class<T> type); static DecoratingWith<T> prox...
@Test public void canDeferDecorationUntilAfterProxyInstantiation() throws Exception { final Decorator<WithCallsInConstructor> nullDecorator = new Decorator<WithCallsInConstructor>() {}; final WithCallsInConstructor obj = new WithCallsInConstructor(); obj.setS("custom"); assertEquals("sanity check", "custom", obj.getS()...
public static <T> DecoratingWith<T> proxy(final Class<T> type) { return new DecoratingWith<T>(new Decorating<T, T>((T)null, type)); }
Decorating { public static <T> DecoratingWith<T> proxy(final Class<T> type) { return new DecoratingWith<T>(new Decorating<T, T>((T)null, type)); } }
Decorating { public static <T> DecoratingWith<T> proxy(final Class<T> type) { return new DecoratingWith<T>(new Decorating<T, T>((T)null, type)); } private Decorating(final U delegate, final Class<T>primaryType, final Class<?>... types); }
Decorating { public static <T> DecoratingWith<T> proxy(final Class<T> type) { return new DecoratingWith<T>(new Decorating<T, T>((T)null, type)); } private Decorating(final U delegate, final Class<T>primaryType, final Class<?>... types); static DecoratingWith<T> proxy(final Class<T> type); static DecoratingWith<T> prox...
Decorating { public static <T> DecoratingWith<T> proxy(final Class<T> type) { return new DecoratingWith<T>(new Decorating<T, T>((T)null, type)); } private Decorating(final U delegate, final Class<T>primaryType, final Class<?>... types); static DecoratingWith<T> proxy(final Class<T> type); static DecoratingWith<T> prox...
@Test public void shouldReturnNullObjectAsIntermediateResultAndSwapWhenMethodCompletesWithCast() throws InterruptedException { CountDownLatch latch = new CountDownLatch(1); Service slowService = new SlowService(latch); Service fastService = Future.proxy(slowService).build(getFactory()); List<String> stuff = fastService...
public static <T> FutureWith<T> proxy(Class<T> primaryType) { Future<T> future = new Future<T>(new Class<?>[]{primaryType}); return new FutureWith<T>(future); }
Future { public static <T> FutureWith<T> proxy(Class<T> primaryType) { Future<T> future = new Future<T>(new Class<?>[]{primaryType}); return new FutureWith<T>(future); } }
Future { public static <T> FutureWith<T> proxy(Class<T> primaryType) { Future<T> future = new Future<T>(new Class<?>[]{primaryType}); return new FutureWith<T>(future); } private Future(Class<?>[] types); }
Future { public static <T> FutureWith<T> proxy(Class<T> primaryType) { Future<T> future = new Future<T>(new Class<?>[]{primaryType}); return new FutureWith<T>(future); } private Future(Class<?>[] types); static FutureWith<T> proxy(Class<T> primaryType); static FutureWith<T> proxy(Class<T> primaryType, Class<?>... type...
Future { public static <T> FutureWith<T> proxy(Class<T> primaryType) { Future<T> future = new Future<T>(new Class<?>[]{primaryType}); return new FutureWith<T>(future); } private Future(Class<?>[] types); static FutureWith<T> proxy(Class<T> primaryType); static FutureWith<T> proxy(Class<T> primaryType, Class<?>... type...
@Test public void shouldReturnNullObjectAsIntermediateResultAndSwapWhenMethodCompletesWithGenerics() throws InterruptedException { CountDownLatch latch = new CountDownLatch(1); Service slowService = new SlowService(latch); Service fastService = Future.proxy(Service.class).with(slowService).build(getFactory()); List<Str...
public static <T> FutureWith<T> proxy(Class<T> primaryType) { Future<T> future = new Future<T>(new Class<?>[]{primaryType}); return new FutureWith<T>(future); }
Future { public static <T> FutureWith<T> proxy(Class<T> primaryType) { Future<T> future = new Future<T>(new Class<?>[]{primaryType}); return new FutureWith<T>(future); } }
Future { public static <T> FutureWith<T> proxy(Class<T> primaryType) { Future<T> future = new Future<T>(new Class<?>[]{primaryType}); return new FutureWith<T>(future); } private Future(Class<?>[] types); }
Future { public static <T> FutureWith<T> proxy(Class<T> primaryType) { Future<T> future = new Future<T>(new Class<?>[]{primaryType}); return new FutureWith<T>(future); } private Future(Class<?>[] types); static FutureWith<T> proxy(Class<T> primaryType); static FutureWith<T> proxy(Class<T> primaryType, Class<?>... type...
Future { public static <T> FutureWith<T> proxy(Class<T> primaryType) { Future<T> future = new Future<T>(new Class<?>[]{primaryType}); return new FutureWith<T>(future); } private Future(Class<?>[] types); static FutureWith<T> proxy(Class<T> primaryType); static FutureWith<T> proxy(Class<T> primaryType, Class<?>... type...
@Test public void shouldHandleVoidMethodsWithCast() { CountDownLatch latch = new CountDownLatch(1); Service slowService = new SlowService(latch); Service fastService = Future.proxy(slowService).build(getFactory()); fastService.methodReturnsVoid(); }
public static <T> FutureWith<T> proxy(Class<T> primaryType) { Future<T> future = new Future<T>(new Class<?>[]{primaryType}); return new FutureWith<T>(future); }
Future { public static <T> FutureWith<T> proxy(Class<T> primaryType) { Future<T> future = new Future<T>(new Class<?>[]{primaryType}); return new FutureWith<T>(future); } }
Future { public static <T> FutureWith<T> proxy(Class<T> primaryType) { Future<T> future = new Future<T>(new Class<?>[]{primaryType}); return new FutureWith<T>(future); } private Future(Class<?>[] types); }
Future { public static <T> FutureWith<T> proxy(Class<T> primaryType) { Future<T> future = new Future<T>(new Class<?>[]{primaryType}); return new FutureWith<T>(future); } private Future(Class<?>[] types); static FutureWith<T> proxy(Class<T> primaryType); static FutureWith<T> proxy(Class<T> primaryType, Class<?>... type...
Future { public static <T> FutureWith<T> proxy(Class<T> primaryType) { Future<T> future = new Future<T>(new Class<?>[]{primaryType}); return new FutureWith<T>(future); } private Future(Class<?>[] types); static FutureWith<T> proxy(Class<T> primaryType); static FutureWith<T> proxy(Class<T> primaryType, Class<?>... type...
@Test public void shouldHandleVoidMethodsWithGenerics() { CountDownLatch latch = new CountDownLatch(1); Service slowService = new SlowService(latch); Service fastService = Future.proxy(Service.class).with(slowService).build(getFactory()); fastService.methodReturnsVoid(); }
public static <T> FutureWith<T> proxy(Class<T> primaryType) { Future<T> future = new Future<T>(new Class<?>[]{primaryType}); return new FutureWith<T>(future); }
Future { public static <T> FutureWith<T> proxy(Class<T> primaryType) { Future<T> future = new Future<T>(new Class<?>[]{primaryType}); return new FutureWith<T>(future); } }
Future { public static <T> FutureWith<T> proxy(Class<T> primaryType) { Future<T> future = new Future<T>(new Class<?>[]{primaryType}); return new FutureWith<T>(future); } private Future(Class<?>[] types); }
Future { public static <T> FutureWith<T> proxy(Class<T> primaryType) { Future<T> future = new Future<T>(new Class<?>[]{primaryType}); return new FutureWith<T>(future); } private Future(Class<?>[] types); static FutureWith<T> proxy(Class<T> primaryType); static FutureWith<T> proxy(Class<T> primaryType, Class<?>... type...
Future { public static <T> FutureWith<T> proxy(Class<T> primaryType) { Future<T> future = new Future<T>(new Class<?>[]{primaryType}); return new FutureWith<T>(future); } private Future(Class<?>[] types); static FutureWith<T> proxy(Class<T> primaryType); static FutureWith<T> proxy(Class<T> primaryType, Class<?>... type...
@Test public void callIsDelegated() throws Exception { Foo fooMock = mock(Foo.class); Foo foo = Privileging.proxy(Foo.class).with(fooMock).executedBy(new DirectExecutor()).build(getFactory()); foo.call(); verify(fooMock).call(); }
public static <T> PrivilegingWith<T> proxy(Class<T> type) { return new PrivilegingWith<T>(new Privileging<T>(type)); }
Privileging { public static <T> PrivilegingWith<T> proxy(Class<T> type) { return new PrivilegingWith<T>(new Privileging<T>(type)); } }
Privileging { public static <T> PrivilegingWith<T> proxy(Class<T> type) { return new PrivilegingWith<T>(new Privileging<T>(type)); } private Privileging(Class<T> type); }
Privileging { public static <T> PrivilegingWith<T> proxy(Class<T> type) { return new PrivilegingWith<T>(new Privileging<T>(type)); } private Privileging(Class<T> type); static PrivilegingWith<T> proxy(Class<T> type); static PrivilegingExecutedByOrBuild<T> proxy(T target); }
Privileging { public static <T> PrivilegingWith<T> proxy(Class<T> type) { return new PrivilegingWith<T>(new Privileging<T>(type)); } private Privileging(Class<T> type); static PrivilegingWith<T> proxy(Class<T> type); static PrivilegingExecutedByOrBuild<T> proxy(T target); }
@Test public void testBlobDataIsCreated() { assertThat(restoreBlobStrategy.createRestoreData(restoreBlobData).getBlobData(), is(restoreBlobData)); }
@Override protected RRestoreBlobData createRestoreData(final RestoreBlobData restoreBlobData) { checkState(!isEmpty(restoreBlobData.getBlobName()), "Blob name cannot be empty"); return new RRestoreBlobData(restoreBlobData); }
RRestoreBlobStrategy extends BaseRestoreBlobStrategy<RRestoreBlobData> { @Override protected RRestoreBlobData createRestoreData(final RestoreBlobData restoreBlobData) { checkState(!isEmpty(restoreBlobData.getBlobName()), "Blob name cannot be empty"); return new RRestoreBlobData(restoreBlobData); } }
RRestoreBlobStrategy extends BaseRestoreBlobStrategy<RRestoreBlobData> { @Override protected RRestoreBlobData createRestoreData(final RestoreBlobData restoreBlobData) { checkState(!isEmpty(restoreBlobData.getBlobName()), "Blob name cannot be empty"); return new RRestoreBlobData(restoreBlobData); } @Inject RRestoreBlob...
RRestoreBlobStrategy extends BaseRestoreBlobStrategy<RRestoreBlobData> { @Override protected RRestoreBlobData createRestoreData(final RestoreBlobData restoreBlobData) { checkState(!isEmpty(restoreBlobData.getBlobName()), "Blob name cannot be empty"); return new RRestoreBlobData(restoreBlobData); } @Inject RRestoreBlob...
RRestoreBlobStrategy extends BaseRestoreBlobStrategy<RRestoreBlobData> { @Override protected RRestoreBlobData createRestoreData(final RestoreBlobData restoreBlobData) { checkState(!isEmpty(restoreBlobData.getBlobName()), "Blob name cannot be empty"); return new RRestoreBlobData(restoreBlobData); } @Inject RRestoreBlob...
@Test(expected = IllegalStateException.class) public void testIfBlobDataNameIsEmptyExceptionIsThrown() { when(rRestoreBlobData.getBlobData().getBlobName()).thenReturn(""); restoreBlobStrategy.createRestoreData(restoreBlobData); }
@Override protected RRestoreBlobData createRestoreData(final RestoreBlobData restoreBlobData) { checkState(!isEmpty(restoreBlobData.getBlobName()), "Blob name cannot be empty"); return new RRestoreBlobData(restoreBlobData); }
RRestoreBlobStrategy extends BaseRestoreBlobStrategy<RRestoreBlobData> { @Override protected RRestoreBlobData createRestoreData(final RestoreBlobData restoreBlobData) { checkState(!isEmpty(restoreBlobData.getBlobName()), "Blob name cannot be empty"); return new RRestoreBlobData(restoreBlobData); } }
RRestoreBlobStrategy extends BaseRestoreBlobStrategy<RRestoreBlobData> { @Override protected RRestoreBlobData createRestoreData(final RestoreBlobData restoreBlobData) { checkState(!isEmpty(restoreBlobData.getBlobName()), "Blob name cannot be empty"); return new RRestoreBlobData(restoreBlobData); } @Inject RRestoreBlob...
RRestoreBlobStrategy extends BaseRestoreBlobStrategy<RRestoreBlobData> { @Override protected RRestoreBlobData createRestoreData(final RestoreBlobData restoreBlobData) { checkState(!isEmpty(restoreBlobData.getBlobName()), "Blob name cannot be empty"); return new RRestoreBlobData(restoreBlobData); } @Inject RRestoreBlob...
RRestoreBlobStrategy extends BaseRestoreBlobStrategy<RRestoreBlobData> { @Override protected RRestoreBlobData createRestoreData(final RestoreBlobData restoreBlobData) { checkState(!isEmpty(restoreBlobData.getBlobName()), "Blob name cannot be empty"); return new RRestoreBlobData(restoreBlobData); } @Inject RRestoreBlob...
@Test public void testCorrectHashAlgorithmsAreSupported() { assertThat(restoreBlobStrategy.getHashAlgorithms(), containsInAnyOrder(SHA1)); }
@Nonnull @Override protected List<HashAlgorithm> getHashAlgorithms() { return ImmutableList.of(SHA1); }
RRestoreBlobStrategy extends BaseRestoreBlobStrategy<RRestoreBlobData> { @Nonnull @Override protected List<HashAlgorithm> getHashAlgorithms() { return ImmutableList.of(SHA1); } }
RRestoreBlobStrategy extends BaseRestoreBlobStrategy<RRestoreBlobData> { @Nonnull @Override protected List<HashAlgorithm> getHashAlgorithms() { return ImmutableList.of(SHA1); } @Inject RRestoreBlobStrategy(final NodeAccess nodeAccess, final RepositoryManager repositoryManager, ...
RRestoreBlobStrategy extends BaseRestoreBlobStrategy<RRestoreBlobData> { @Nonnull @Override protected List<HashAlgorithm> getHashAlgorithms() { return ImmutableList.of(SHA1); } @Inject RRestoreBlobStrategy(final NodeAccess nodeAccess, final RepositoryManager repositoryManager, ...
RRestoreBlobStrategy extends BaseRestoreBlobStrategy<RRestoreBlobData> { @Nonnull @Override protected List<HashAlgorithm> getHashAlgorithms() { return ImmutableList.of(SHA1); } @Inject RRestoreBlobStrategy(final NodeAccess nodeAccess, final RepositoryManager repositoryManager, ...
@Test public void testAppropriatePathIsReturned() { assertThat(restoreBlobStrategy.getAssetPath(rRestoreBlobData), is(ARCHIVE_PATH)); }
@Override protected String getAssetPath(@Nonnull final RRestoreBlobData rRestoreBlobData) { return rRestoreBlobData.getBlobData().getBlobName(); }
RRestoreBlobStrategy extends BaseRestoreBlobStrategy<RRestoreBlobData> { @Override protected String getAssetPath(@Nonnull final RRestoreBlobData rRestoreBlobData) { return rRestoreBlobData.getBlobData().getBlobName(); } }
RRestoreBlobStrategy extends BaseRestoreBlobStrategy<RRestoreBlobData> { @Override protected String getAssetPath(@Nonnull final RRestoreBlobData rRestoreBlobData) { return rRestoreBlobData.getBlobData().getBlobName(); } @Inject RRestoreBlobStrategy(final NodeAccess nodeAccess, final Repos...
RRestoreBlobStrategy extends BaseRestoreBlobStrategy<RRestoreBlobData> { @Override protected String getAssetPath(@Nonnull final RRestoreBlobData rRestoreBlobData) { return rRestoreBlobData.getBlobData().getBlobName(); } @Inject RRestoreBlobStrategy(final NodeAccess nodeAccess, final Repos...
RRestoreBlobStrategy extends BaseRestoreBlobStrategy<RRestoreBlobData> { @Override protected String getAssetPath(@Nonnull final RRestoreBlobData rRestoreBlobData) { return rRestoreBlobData.getBlobData().getBlobName(); } @Inject RRestoreBlobStrategy(final NodeAccess nodeAccess, final Repos...
@Test public void testPackageIsRestored() throws Exception { restoreBlobStrategy.restore(properties, blob, TEST_BLOB_STORE_NAME, false); verify(rRestoreFacet).assetExists(ARCHIVE_PATH); verify(rRestoreFacet).restore(any(AssetBlob.class), eq(ARCHIVE_PATH)); verifyNoMoreInteractions(rRestoreFacet); }
@Override protected boolean assetExists(@Nonnull final RRestoreBlobData rRestoreBlobData) { RRestoreFacet facet = getRestoreFacet(rRestoreBlobData); return facet.assetExists(getAssetPath(rRestoreBlobData)); }
RRestoreBlobStrategy extends BaseRestoreBlobStrategy<RRestoreBlobData> { @Override protected boolean assetExists(@Nonnull final RRestoreBlobData rRestoreBlobData) { RRestoreFacet facet = getRestoreFacet(rRestoreBlobData); return facet.assetExists(getAssetPath(rRestoreBlobData)); } }
RRestoreBlobStrategy extends BaseRestoreBlobStrategy<RRestoreBlobData> { @Override protected boolean assetExists(@Nonnull final RRestoreBlobData rRestoreBlobData) { RRestoreFacet facet = getRestoreFacet(rRestoreBlobData); return facet.assetExists(getAssetPath(rRestoreBlobData)); } @Inject RRestoreBlobStrategy(final No...
RRestoreBlobStrategy extends BaseRestoreBlobStrategy<RRestoreBlobData> { @Override protected boolean assetExists(@Nonnull final RRestoreBlobData rRestoreBlobData) { RRestoreFacet facet = getRestoreFacet(rRestoreBlobData); return facet.assetExists(getAssetPath(rRestoreBlobData)); } @Inject RRestoreBlobStrategy(final No...
RRestoreBlobStrategy extends BaseRestoreBlobStrategy<RRestoreBlobData> { @Override protected boolean assetExists(@Nonnull final RRestoreBlobData rRestoreBlobData) { RRestoreFacet facet = getRestoreFacet(rRestoreBlobData); return facet.assetExists(getAssetPath(rRestoreBlobData)); } @Inject RRestoreBlobStrategy(final No...
@Test public void testComponentIsRequiredForGz() { boolean expected = true; when(rRestoreFacet.componentRequired(ARCHIVE_PATH)).thenReturn(expected); assertThat(restoreBlobStrategy.componentRequired(rRestoreBlobData), is(expected)); verify(rRestoreFacet).componentRequired(ARCHIVE_PATH); verifyNoMoreInteractions(rRestor...
@Override protected boolean componentRequired(final RRestoreBlobData data) { RRestoreFacet facet = getRestoreFacet(data); final String path = data.getBlobData().getBlobName(); return facet.componentRequired(path); }
RRestoreBlobStrategy extends BaseRestoreBlobStrategy<RRestoreBlobData> { @Override protected boolean componentRequired(final RRestoreBlobData data) { RRestoreFacet facet = getRestoreFacet(data); final String path = data.getBlobData().getBlobName(); return facet.componentRequired(path); } }
RRestoreBlobStrategy extends BaseRestoreBlobStrategy<RRestoreBlobData> { @Override protected boolean componentRequired(final RRestoreBlobData data) { RRestoreFacet facet = getRestoreFacet(data); final String path = data.getBlobData().getBlobName(); return facet.componentRequired(path); } @Inject RRestoreBlobStrategy(f...
RRestoreBlobStrategy extends BaseRestoreBlobStrategy<RRestoreBlobData> { @Override protected boolean componentRequired(final RRestoreBlobData data) { RRestoreFacet facet = getRestoreFacet(data); final String path = data.getBlobData().getBlobName(); return facet.componentRequired(path); } @Inject RRestoreBlobStrategy(f...
RRestoreBlobStrategy extends BaseRestoreBlobStrategy<RRestoreBlobData> { @Override protected boolean componentRequired(final RRestoreBlobData data) { RRestoreFacet facet = getRestoreFacet(data); final String path = data.getBlobData().getBlobName(); return facet.componentRequired(path); } @Inject RRestoreBlobStrategy(f...
@Test public void testComponentQuery() throws IOException { restoreBlobStrategy.getComponentQuery(rRestoreBlobData); verify(rRestoreFacet, times(1)).getComponentQuery(anyMapOf(String.class, String.class)); }
@Override protected Query getComponentQuery(final RRestoreBlobData data) throws IOException { RRestoreFacet facet = getRestoreFacet(data); RestoreBlobData blobData = data.getBlobData(); Map<String, String> attributes; try (InputStream inputStream = blobData.getBlob().getInputStream()) { attributes = facet.extractCompon...
RRestoreBlobStrategy extends BaseRestoreBlobStrategy<RRestoreBlobData> { @Override protected Query getComponentQuery(final RRestoreBlobData data) throws IOException { RRestoreFacet facet = getRestoreFacet(data); RestoreBlobData blobData = data.getBlobData(); Map<String, String> attributes; try (InputStream inputStream ...
RRestoreBlobStrategy extends BaseRestoreBlobStrategy<RRestoreBlobData> { @Override protected Query getComponentQuery(final RRestoreBlobData data) throws IOException { RRestoreFacet facet = getRestoreFacet(data); RestoreBlobData blobData = data.getBlobData(); Map<String, String> attributes; try (InputStream inputStream ...
RRestoreBlobStrategy extends BaseRestoreBlobStrategy<RRestoreBlobData> { @Override protected Query getComponentQuery(final RRestoreBlobData data) throws IOException { RRestoreFacet facet = getRestoreFacet(data); RestoreBlobData blobData = data.getBlobData(); Map<String, String> attributes; try (InputStream inputStream ...
RRestoreBlobStrategy extends BaseRestoreBlobStrategy<RRestoreBlobData> { @Override protected Query getComponentQuery(final RRestoreBlobData data) throws IOException { RRestoreFacet facet = getRestoreFacet(data); RestoreBlobData blobData = data.getBlobData(); Map<String, String> attributes; try (InputStream inputStream ...
@Test public void test() throws Exception { String unsafe = "<a href='javascript:alert('XSS')'>часто</a> используемый в печати и вэб-дизайне"; String safe = xssSanitizerService.sanitize(unsafe); Assertions.assertEquals("часто используемый в печати и вэб-дизайне", safe); }
public String sanitize(String html) { return policyFactory.sanitize( html, xssHtmlChangeListener, "ip='"+ getIpAddressFromRequestContext()+"'" ); }
XssSanitizerService { public String sanitize(String html) { return policyFactory.sanitize( html, xssHtmlChangeListener, "ip='"+ getIpAddressFromRequestContext()+"'" ); } }
XssSanitizerService { public String sanitize(String html) { return policyFactory.sanitize( html, xssHtmlChangeListener, "ip='"+ getIpAddressFromRequestContext()+"'" ); } }
XssSanitizerService { public String sanitize(String html) { return policyFactory.sanitize( html, xssHtmlChangeListener, "ip='"+ getIpAddressFromRequestContext()+"'" ); } String sanitize(String html); }
XssSanitizerService { public String sanitize(String html) { return policyFactory.sanitize( html, xssHtmlChangeListener, "ip='"+ getIpAddressFromRequestContext()+"'" ); } String sanitize(String html); }
@Test public void testNoClosed() throws Exception { String unsafe = "<a href='javascript:alert('XSS')'>часто используемый в печати и вэб-дизайне"; String safe = xssSanitizerService.sanitize(unsafe); Assertions.assertEquals("часто используемый в печати и вэб-дизайне", safe); }
public String sanitize(String html) { return policyFactory.sanitize( html, xssHtmlChangeListener, "ip='"+ getIpAddressFromRequestContext()+"'" ); }
XssSanitizerService { public String sanitize(String html) { return policyFactory.sanitize( html, xssHtmlChangeListener, "ip='"+ getIpAddressFromRequestContext()+"'" ); } }
XssSanitizerService { public String sanitize(String html) { return policyFactory.sanitize( html, xssHtmlChangeListener, "ip='"+ getIpAddressFromRequestContext()+"'" ); } }
XssSanitizerService { public String sanitize(String html) { return policyFactory.sanitize( html, xssHtmlChangeListener, "ip='"+ getIpAddressFromRequestContext()+"'" ); } String sanitize(String html); }
XssSanitizerService { public String sanitize(String html) { return policyFactory.sanitize( html, xssHtmlChangeListener, "ip='"+ getIpAddressFromRequestContext()+"'" ); } String sanitize(String html); }
@Test public void getConfig() throws Exception { mockMvc.perform( get(Constants.Urls.API+ Constants.Urls.CONFIG) .contentType(MediaType.APPLICATION_JSON_UTF8_VALUE) ) .andExpect(status().isOk()) .andExpect(jsonPath("$.titleTemplate").value("%s | nkonev's blog")) .andExpect(jsonPath("$.header").value("Блог Конева Никиты...
@GetMapping(API+CONFIG) public SettingsDTO getConfig(@AuthenticationPrincipal UserAccountDetailsDTO userAccount){ Iterable<RuntimeSettings> runtimeSettings = runtimeSettingsRepository.findAll(); SettingsDTO settingsDTOPartial = StreamSupport.stream(runtimeSettings.spliterator(), false) .reduce( new SettingsDTO(), (sett...
SettingsController { @GetMapping(API+CONFIG) public SettingsDTO getConfig(@AuthenticationPrincipal UserAccountDetailsDTO userAccount){ Iterable<RuntimeSettings> runtimeSettings = runtimeSettingsRepository.findAll(); SettingsDTO settingsDTOPartial = StreamSupport.stream(runtimeSettings.spliterator(), false) .reduce( new...
SettingsController { @GetMapping(API+CONFIG) public SettingsDTO getConfig(@AuthenticationPrincipal UserAccountDetailsDTO userAccount){ Iterable<RuntimeSettings> runtimeSettings = runtimeSettingsRepository.findAll(); SettingsDTO settingsDTOPartial = StreamSupport.stream(runtimeSettings.spliterator(), false) .reduce( new...
SettingsController { @GetMapping(API+CONFIG) public SettingsDTO getConfig(@AuthenticationPrincipal UserAccountDetailsDTO userAccount){ Iterable<RuntimeSettings> runtimeSettings = runtimeSettingsRepository.findAll(); SettingsDTO settingsDTOPartial = StreamSupport.stream(runtimeSettings.spliterator(), false) .reduce( new...
SettingsController { @GetMapping(API+CONFIG) public SettingsDTO getConfig(@AuthenticationPrincipal UserAccountDetailsDTO userAccount){ Iterable<RuntimeSettings> runtimeSettings = runtimeSettingsRepository.findAll(); SettingsDTO settingsDTOPartial = StreamSupport.stream(runtimeSettings.spliterator(), false) .reduce( new...
@WithUserDetails(TestConstants.USER_ADMIN) @Test public void testFulltextSearchHostPort() throws Exception { final String newPostRendered = "<body>Post Rendered</body>"; mockServer.expect(requestTo(new StringStartsWith(true, "http: .andExpect(method(HttpMethod.GET)) .andRespond(withSuccess(newPostRendered, MediaType.TE...
@PreAuthorize("@blogSecurityService.hasPostPermission(#postDTO, #userAccount, T(com.github.nkonev.blog.security.permissions.PostPermissions).EDIT)") @PutMapping(Constants.Urls.API + Constants.Urls.POST) public PostDTOWithAuthorization updatePost( @AuthenticationPrincipal UserAccountDetailsDTO userAccount, @RequestBody ...
PostController { @PreAuthorize("@blogSecurityService.hasPostPermission(#postDTO, #userAccount, T(com.github.nkonev.blog.security.permissions.PostPermissions).EDIT)") @PutMapping(Constants.Urls.API + Constants.Urls.POST) public PostDTOWithAuthorization updatePost( @AuthenticationPrincipal UserAccountDetailsDTO userAccou...
PostController { @PreAuthorize("@blogSecurityService.hasPostPermission(#postDTO, #userAccount, T(com.github.nkonev.blog.security.permissions.PostPermissions).EDIT)") @PutMapping(Constants.Urls.API + Constants.Urls.POST) public PostDTOWithAuthorization updatePost( @AuthenticationPrincipal UserAccountDetailsDTO userAccou...
PostController { @PreAuthorize("@blogSecurityService.hasPostPermission(#postDTO, #userAccount, T(com.github.nkonev.blog.security.permissions.PostPermissions).EDIT)") @PutMapping(Constants.Urls.API + Constants.Urls.POST) public PostDTOWithAuthorization updatePost( @AuthenticationPrincipal UserAccountDetailsDTO userAccou...
PostController { @PreAuthorize("@blogSecurityService.hasPostPermission(#postDTO, #userAccount, T(com.github.nkonev.blog.security.permissions.PostPermissions).EDIT)") @PutMapping(Constants.Urls.API + Constants.Urls.POST) public PostDTOWithAuthorization updatePost( @AuthenticationPrincipal UserAccountDetailsDTO userAccou...
@Test public void testAnonymousCannotAddPostUnit() throws Exception { Assertions.assertThrows(AuthenticationCredentialsNotFoundException.class, () -> { postController.addPost(null, PostDtoBuilder.startBuilding().build()); }); }
@PreAuthorize("@blogSecurityService.hasPostPermission(#userAccount, T(com.github.nkonev.blog.security.permissions.PostPermissions).CREATE)") @PostMapping(Constants.Urls.API + Constants.Urls.POST) public PostDTOWithAuthorization addPost( @AuthenticationPrincipal UserAccountDetailsDTO userAccount, @RequestBody @NotNull P...
PostController { @PreAuthorize("@blogSecurityService.hasPostPermission(#userAccount, T(com.github.nkonev.blog.security.permissions.PostPermissions).CREATE)") @PostMapping(Constants.Urls.API + Constants.Urls.POST) public PostDTOWithAuthorization addPost( @AuthenticationPrincipal UserAccountDetailsDTO userAccount, @Reque...
PostController { @PreAuthorize("@blogSecurityService.hasPostPermission(#userAccount, T(com.github.nkonev.blog.security.permissions.PostPermissions).CREATE)") @PostMapping(Constants.Urls.API + Constants.Urls.POST) public PostDTOWithAuthorization addPost( @AuthenticationPrincipal UserAccountDetailsDTO userAccount, @Reque...
PostController { @PreAuthorize("@blogSecurityService.hasPostPermission(#userAccount, T(com.github.nkonev.blog.security.permissions.PostPermissions).CREATE)") @PostMapping(Constants.Urls.API + Constants.Urls.POST) public PostDTOWithAuthorization addPost( @AuthenticationPrincipal UserAccountDetailsDTO userAccount, @Reque...
PostController { @PreAuthorize("@blogSecurityService.hasPostPermission(#userAccount, T(com.github.nkonev.blog.security.permissions.PostPermissions).CREATE)") @PostMapping(Constants.Urls.API + Constants.Urls.POST) public PostDTOWithAuthorization addPost( @AuthenticationPrincipal UserAccountDetailsDTO userAccount, @Reque...
@Test public void testGetYouTubeId() { String youtubeVideoId = PostConverter.getYouTubeVideoId("https: Assertions.assertEquals("eoDsxos6xhM", youtubeVideoId); }
public static String getYouTubeVideoId(String iframeSrcUrl) { UriComponents build = UriComponentsBuilder.fromHttpUrl(iframeSrcUrl).build(); List<String> pathSegments = build.getPathSegments(); return pathSegments.get(pathSegments.size() - 1); }
PostConverter { public static String getYouTubeVideoId(String iframeSrcUrl) { UriComponents build = UriComponentsBuilder.fromHttpUrl(iframeSrcUrl).build(); List<String> pathSegments = build.getPathSegments(); return pathSegments.get(pathSegments.size() - 1); } }
PostConverter { public static String getYouTubeVideoId(String iframeSrcUrl) { UriComponents build = UriComponentsBuilder.fromHttpUrl(iframeSrcUrl).build(); List<String> pathSegments = build.getPathSegments(); return pathSegments.get(pathSegments.size() - 1); } }
PostConverter { public static String getYouTubeVideoId(String iframeSrcUrl) { UriComponents build = UriComponentsBuilder.fromHttpUrl(iframeSrcUrl).build(); List<String> pathSegments = build.getPathSegments(); return pathSegments.get(pathSegments.size() - 1); } PostDTOWithAuthorization convertToDto(Post saved, UserAcco...
PostConverter { public static String getYouTubeVideoId(String iframeSrcUrl) { UriComponents build = UriComponentsBuilder.fromHttpUrl(iframeSrcUrl).build(); List<String> pathSegments = build.getPathSegments(); return pathSegments.get(pathSegments.size() - 1); } PostDTOWithAuthorization convertToDto(Post saved, UserAcco...
@Test public void shouldSetFirstImgWhenTitleImgEmpty() { PostDTO postDTO = new PostDTO(); postDTO.setText("Hello, I contains images. This is first. <img src=\"http: postDTO.setTitle("Title"); String titleImg = postConverter.getTitleImg(postDTO); Assertions.assertEquals("http: }
String getTitleImg(PostDTO postDTO) { String titleImg = postDTO.getTitleImg(); if (setFirstImageAsTitle && StringUtils.isEmpty(titleImg)) { try { Document document = Jsoup.parse(postDTO.getText()); Elements images = document.getElementsByTag("img"); if (!images.isEmpty()) { Element element = images.get(0); return eleme...
PostConverter { String getTitleImg(PostDTO postDTO) { String titleImg = postDTO.getTitleImg(); if (setFirstImageAsTitle && StringUtils.isEmpty(titleImg)) { try { Document document = Jsoup.parse(postDTO.getText()); Elements images = document.getElementsByTag("img"); if (!images.isEmpty()) { Element element = images.get(...
PostConverter { String getTitleImg(PostDTO postDTO) { String titleImg = postDTO.getTitleImg(); if (setFirstImageAsTitle && StringUtils.isEmpty(titleImg)) { try { Document document = Jsoup.parse(postDTO.getText()); Elements images = document.getElementsByTag("img"); if (!images.isEmpty()) { Element element = images.get(...
PostConverter { String getTitleImg(PostDTO postDTO) { String titleImg = postDTO.getTitleImg(); if (setFirstImageAsTitle && StringUtils.isEmpty(titleImg)) { try { Document document = Jsoup.parse(postDTO.getText()); Elements images = document.getElementsByTag("img"); if (!images.isEmpty()) { Element element = images.get(...
PostConverter { String getTitleImg(PostDTO postDTO) { String titleImg = postDTO.getTitleImg(); if (setFirstImageAsTitle && StringUtils.isEmpty(titleImg)) { try { Document document = Jsoup.parse(postDTO.getText()); Elements images = document.getElementsByTag("img"); if (!images.isEmpty()) { Element element = images.get(...
@Test public void shouldDownloadYoutubePreviewWhenTitleImgEmptyAndContentHasNotImages() { PostDTO postDTO = new PostDTO(); postDTO.setText("Hello, I contains youtube videos. " + " This is first. <iframe allowfullscreen=\"true\" src=\"https: " This is second. <iframe allowfullscreen=\"true\" src=\"https: postDTO.setTitl...
String getTitleImg(PostDTO postDTO) { String titleImg = postDTO.getTitleImg(); if (setFirstImageAsTitle && StringUtils.isEmpty(titleImg)) { try { Document document = Jsoup.parse(postDTO.getText()); Elements images = document.getElementsByTag("img"); if (!images.isEmpty()) { Element element = images.get(0); return eleme...
PostConverter { String getTitleImg(PostDTO postDTO) { String titleImg = postDTO.getTitleImg(); if (setFirstImageAsTitle && StringUtils.isEmpty(titleImg)) { try { Document document = Jsoup.parse(postDTO.getText()); Elements images = document.getElementsByTag("img"); if (!images.isEmpty()) { Element element = images.get(...
PostConverter { String getTitleImg(PostDTO postDTO) { String titleImg = postDTO.getTitleImg(); if (setFirstImageAsTitle && StringUtils.isEmpty(titleImg)) { try { Document document = Jsoup.parse(postDTO.getText()); Elements images = document.getElementsByTag("img"); if (!images.isEmpty()) { Element element = images.get(...
PostConverter { String getTitleImg(PostDTO postDTO) { String titleImg = postDTO.getTitleImg(); if (setFirstImageAsTitle && StringUtils.isEmpty(titleImg)) { try { Document document = Jsoup.parse(postDTO.getText()); Elements images = document.getElementsByTag("img"); if (!images.isEmpty()) { Element element = images.get(...
PostConverter { String getTitleImg(PostDTO postDTO) { String titleImg = postDTO.getTitleImg(); if (setFirstImageAsTitle && StringUtils.isEmpty(titleImg)) { try { Document document = Jsoup.parse(postDTO.getText()); Elements images = document.getElementsByTag("img"); if (!images.isEmpty()) { Element element = images.get(...
@SuppressWarnings("unchecked") @Test public void getOrCreateContextDoesNotRegisterMultipleServletContextsForSameContextModelSingleThreaded() throws Exception { final JettyServerWrapper jettyServerWrapperUnderTest = new JettyServerWrapper( serverModelMock, new QueuedThreadPool()); try { jettyServerWrapperUnderTest.start...
HttpServiceContext getOrCreateContext(final Model model) { return getOrCreateContext(model.getContextModel()); }
JettyServerWrapper extends Server { HttpServiceContext getOrCreateContext(final Model model) { return getOrCreateContext(model.getContextModel()); } }
JettyServerWrapper extends Server { HttpServiceContext getOrCreateContext(final Model model) { return getOrCreateContext(model.getContextModel()); } JettyServerWrapper(ServerModel serverModel, ThreadPool threadPool); }
JettyServerWrapper extends Server { HttpServiceContext getOrCreateContext(final Model model) { return getOrCreateContext(model.getContextModel()); } JettyServerWrapper(ServerModel serverModel, ThreadPool threadPool); HandlerCollection getRootHandlerCollection(); void configureContext(final Map<String, Object> attribute...
JettyServerWrapper extends Server { HttpServiceContext getOrCreateContext(final Model model) { return getOrCreateContext(model.getContextModel()); } JettyServerWrapper(ServerModel serverModel, ThreadPool threadPool); HandlerCollection getRootHandlerCollection(); void configureContext(final Map<String, Object> attribute...
@Test public void replaceSlashes07() { assertEquals("Replaced", "/foo/bar/car/", Path.replaceSlashes("/foo }
static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } private Path(); }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } private Path(); static String normalizeResourcePath(final String path); static String getDirectParent(URL entry); }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } private Path(); static String normalizeResourcePath(final String path); static String getDirectParent(URL entry); }
@Test public void normalizeResourcePathSlash01() { assertEquals("Normalized", "/", Path.normalizeResourcePath("/")); }
public static String normalizeResourcePath(final String path) { if (path == null) { return null; } String normalizedPath = replaceSlashes(path.trim()); if (normalizedPath.startsWith("/") && normalizedPath.length() > 1) { normalizedPath = normalizedPath.substring(1); } return normalizedPath; }
Path { public static String normalizeResourcePath(final String path) { if (path == null) { return null; } String normalizedPath = replaceSlashes(path.trim()); if (normalizedPath.startsWith("/") && normalizedPath.length() > 1) { normalizedPath = normalizedPath.substring(1); } return normalizedPath; } }
Path { public static String normalizeResourcePath(final String path) { if (path == null) { return null; } String normalizedPath = replaceSlashes(path.trim()); if (normalizedPath.startsWith("/") && normalizedPath.length() > 1) { normalizedPath = normalizedPath.substring(1); } return normalizedPath; } private Path(); }
Path { public static String normalizeResourcePath(final String path) { if (path == null) { return null; } String normalizedPath = replaceSlashes(path.trim()); if (normalizedPath.startsWith("/") && normalizedPath.length() > 1) { normalizedPath = normalizedPath.substring(1); } return normalizedPath; } private Path(); st...
Path { public static String normalizeResourcePath(final String path) { if (path == null) { return null; } String normalizedPath = replaceSlashes(path.trim()); if (normalizedPath.startsWith("/") && normalizedPath.length() > 1) { normalizedPath = normalizedPath.substring(1); } return normalizedPath; } private Path(); st...