Examples of ElementDescriptor


Examples of com.foreach.cuke.sahi.element.ElementDescriptor

                                                        Integer position,
                                                        String parentType,
                                                        String parentLocator,
                                                        Integer parentPosition,
                                                        String value ) throws Throwable {
    verify( Arrays.asList( new ElementDescriptor( locator, position, type, value ) ),
            find( parentType, parentLocator, parentPosition ), VerifyOperation.CONTAINS, false );
  }
View Full Code Here

Examples of javax.validation.metadata.ElementDescriptor

        TestUtils.failOnModifiable(bc.getConstraintDescriptors(), "beanDescriptor constraintDescriptors");
    }

    public void testMetadataAPI_Engine() {
        Validator validator = getValidator();
        ElementDescriptor desc = validator.getConstraintsForClass(Engine.class)
              .getConstraintsForProperty("serialNumber");
        assertNotNull(desc);
//        assertEquals(ElementType.FIELD, desc.getElementType());
        Assert.assertEquals(String.class, desc.getElementClass());
    }
View Full Code Here

Examples of javax.validation.metadata.ElementDescriptor

        Assert.assertTrue(propNames.contains("zipCode"));
        Assert.assertTrue(propNames.contains("country"));
        Assert.assertTrue(propNames.contains("city"));       // annotated at method level
        Assert.assertEquals(5, props.size());

        ElementDescriptor desc = validator.getConstraintsForClass(Address.class)
              .getConstraintsForProperty("addressline1");
        Assert.assertNotNull(desc);
        boolean found = false;
        for (ConstraintDescriptor each : desc.getConstraintDescriptors()) {
            if (each.getConstraintValidatorClasses().get(0)
                  .equals(SizeValidatorForString.class)) {
                Assert.assertTrue(each.getAttributes().containsKey("max"));
                assertEquals(30, each.getAttributes().get("max"));
                found = true;
View Full Code Here

Examples of javax.validation.metadata.ElementDescriptor

        factory = Validation.buildDefaultValidatorFactory();
    }

    public void testMetaDataAPI_ComposedConstraints() {
        Validator addressValidator = factory.getValidator();
        ElementDescriptor ed =
              addressValidator.getConstraintsForClass(FrenchAddress.class)
                    .getConstraintsForProperty("zipCode");
        Assert.assertEquals(1, ed.getConstraintDescriptors().size());
        for (ConstraintDescriptor cd : ed.getConstraintDescriptors()) {
            Assert.assertTrue(cd.isReportAsSingleViolation());
            Assert.assertEquals(3, cd.getComposingConstraints().size());
            Assert.assertTrue("no composing constraints found!!",
                  !cd.getComposingConstraints().isEmpty());
            processConstraintDescriptor(cd); //check all constraints on zip code
View Full Code Here

Examples of javax.validation.metadata.ElementDescriptor

        if(constraintSourcePropertyDetails == null)
        {
            return;
        }

        ElementDescriptor elementDescriptor =
                BeanValidationUtils.getElementDescriptor((Class) constraintSourcePropertyDetails.getBaseObject(),
                        constraintSourcePropertyDetails.getProperty());

        if (elementDescriptor == null)
        {
View Full Code Here

Examples of javax.validation.metadata.ElementDescriptor

        Class targetClass = propertyDetails.getBaseObject().getClass();

        targetClass = ProxyUtils.getUnproxiedClass(targetClass);

        ElementDescriptor elementDescriptor = BeanValidationUtils.getElementDescriptor(
                targetClass, propertyDetails.getProperty());

        if (elementDescriptor == null)
        {
            return;
View Full Code Here

Examples of javax.validation.metadata.ElementDescriptor

                                                                              Class baseBeanClass,
                                                                              String propertyName,
                                                                              Object objectToValidate,
                                                                              Class[] groups)
    {
        ElementDescriptor elementDescriptor = getElementDescriptor(baseBeanClass, propertyName);

        if(elementDescriptor instanceof PropertyDescriptor && ((PropertyDescriptor)elementDescriptor).isCascaded())
        {
            return validatorFactory.usingContext()
                .messageInterpolator(ExtValBeanValidationContext.getCurrentInstance().getMessageInterpolator())
View Full Code Here

Examples of org.apache.commons.betwixt.ElementDescriptor

           
            XMLBeanInfo beanInfo = (XMLBeanInfo) top;
            // if there is already a root element descriptor then use it
            // otherwise use this descriptor
            if ( nodeDescriptor instanceof ElementDescriptor ) {
                ElementDescriptor elementDescriptor = (ElementDescriptor) nodeDescriptor;
                ElementDescriptor root = beanInfo.getElementDescriptor() ;
                if ( root == null ) {
                    beanInfo.setElementDescriptor( elementDescriptor );
                } else {
                    root.addElementDescriptor( elementDescriptor );
                }
            } else {
                throw new SAXException(
                    "the <addDefaults> element should be within an <element> tag" );
            }
        } else if ( top instanceof ElementDescriptor ) {
            ElementDescriptor parent = (ElementDescriptor) top;
            if ( nodeDescriptor instanceof ElementDescriptor ) {
                parent.addElementDescriptor( (ElementDescriptor) nodeDescriptor );
            } else {
                parent.addAttributeDescriptor( (AttributeDescriptor) nodeDescriptor );
            }
        } else {
            throw new SAXException(
                "Invalid use of <addDefaults>. It should be nested inside <element> element" );
        }           
View Full Code Here

Examples of org.apache.commons.betwixt.ElementDescriptor

        if ( top instanceof XMLBeanInfo ) {
            XMLBeanInfo beanInfo = (XMLBeanInfo) top;
            return beanInfo.getElementDescriptor();
           
        } else if ( top instanceof ElementDescriptor ) {
            ElementDescriptor parent = (ElementDescriptor) top;
            // XXX: could maybe walk up the parent hierarchy?
            return parent;
        }
        return null;
    }
View Full Code Here

Examples of org.apache.pig.backend.datastorage.ElementDescriptor

        throws IOException {
        DataStorage storage = new HDataStorage(ConfigurationUtil.toProperties(conf));
        String fullPath = FileLocalizer.fullPath(path, storage);
        Set<ElementDescriptor> metaFileSet = new HashSet<ElementDescriptor>();
        if(storage.isContainer(fullPath)) {
            ElementDescriptor metaFilePath = storage.asElement(fullPath, prefix);
            if (metaFilePath.exists()) {
                metaFileSet.add(metaFilePath);
            }
        } else {
            ElementDescriptor[] descriptors = storage.asCollection(path);
            for(ElementDescriptor descriptor : descriptors) {
                String fileName = null, parentName = null;
                ContainerDescriptor parentContainer = null;
                if (descriptor instanceof HFile) {
                    Path descriptorPath = ((HFile) descriptor).getPath();
                    fileName = descriptorPath.getName();
                    Path parent = descriptorPath.getParent();
                    parentName = parent.toString();
                    parentContainer = new HDirectory((HDataStorage)storage,parent);
                }
                ElementDescriptor metaFilePath = storage.asElement(parentName, prefix+"."+fileName);

                // if the file has a custom schema, use it
                if (metaFilePath.exists()) {
                    metaFileSet.add(metaFilePath);
                    continue;
                }

                // if no custom schema, try the parent directory
                metaFilePath = storage.asElement(parentContainer, prefix);
                if (metaFilePath.exists()) {
                    metaFileSet.add(metaFilePath);
                }
            }
        }
        return metaFileSet;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.