Package org.apache.ws.resource.properties

Examples of org.apache.ws.resource.properties.ResourceProperty


    * Test for XmlBeansResourceProperty#get.
    */
   public void testGet()
         throws Exception
   {
      ResourceProperty manufacturerProp = m_resourcePropSet.get( SushiPropertyQNames.AKAGI );
      Object propObj = manufacturerProp.get( 0 );
      assertTrue( propObj instanceof XmlInt );
      XmlInt xInt = (XmlInt) propObj;
      assertEquals( "24",
            xInt.getStringValue() );
   }
View Full Code Here


    * Test for XmlBeansResourceProperty#getMetaData.
    */
   public void testGetMetaData()
         throws Exception
   {
      ResourceProperty blockSize = m_resourcePropSet.get( SushiPropertyQNames.EBI );
      ResourcePropertyMetaData metaData = blockSize.getMetaData();
      assertNotNull( metaData );
      assertEquals( SushiPropertyQNames.EBI,
            metaData.getName() );
      assertEquals( 1,
            metaData.getMinOccurs() );
View Full Code Here

    * Test for XmlBeansResourceProperty#isEmpty.
    */
   public void testIsEmpty()
         throws Exception
   {
      ResourceProperty prop = m_resourcePropSet.get( SushiPropertyQNames.IKA );
      assertFalse( prop.isEmpty() );
      prop.clear();
      assertTrue( prop.isEmpty() );
      assertEquals( 0,
            prop.size() );
   }
View Full Code Here

    * Test for XmlBeansResourceProperty#remove.
    */
   public void testRemoveExistingElement()
         throws Exception
   {
      ResourceProperty prop = m_resourcePropSet.get( SushiPropertyQNames.HAMACHI );
      prop.remove( prop.get( 0 ) );
      assertTrue( prop.isEmpty() );
      assertEquals( 0, XmlBeanUtils.getChildElements( m_resourcePropSet.toXmlObject(), SushiPropertyQNames.HAMACHI ).length );
   }
View Full Code Here

     * Another test for XmlBeansResourceProperty#remove.
     */
    public void testRemoveAddedElement()
          throws Exception
    {
        ResourceProperty prop = m_resourcePropSet.get( SushiPropertyQNames.HAMACHI );
        prop.clear();
        XmlObject hamachiDoc = XmlObject.Factory.parse( "<Hamachi xmlns=\"http://ws.apache.org/resource/properties/test/sushi\">\n" +
                                         "  <Flavor>disgusting</Flavor>\n" +
                                         "</Hamachi>" );
        prop.add( hamachiDoc );
        assertEquals( 1, prop.size() );
        assertEquals( 1, XmlBeanUtils.getChildElements( m_resourcePropSet.toXmlObject(), SushiPropertyQNames.HAMACHI ).length );
        prop.remove( prop.get( 0 ) );
        assertTrue( prop.isEmpty() );
        assertEquals( 0, XmlBeanUtils.getChildElements( m_resourcePropSet.toXmlObject(), SushiPropertyQNames.HAMACHI ).length );
    }
View Full Code Here

    * Test for XmlBeansResourceProperty#set.
    */
   public void testSet()
         throws Exception
   {
      ResourceProperty prop = m_resourcePropSet.get( SushiPropertyQNames.IKA );
      final String stringValue = "somethang";
      prop.set( 0,
            XmlObject.Factory.parse( "<" + SushiPropertyQNames.IKA.getLocalPart() + " xmlns=\"" + SushiPropertyQNames.IKA.getNamespaceURI() + "\">" + stringValue + "</" + SushiPropertyQNames.IKA.getLocalPart() + ">" ) );
      XmlString xString = (XmlString) prop.get( 0 );
      assertEquals( stringValue,
            xString.getStringValue() );
   }
View Full Code Here

    * Test for XmlBeansResourceProperty#size.
    */
   public void testSize()
         throws Exception
   {
      ResourceProperty prop = m_resourcePropSet.get( SushiPropertyQNames.IKA );
      assertEquals( 1,
            prop.size() );
      final String stringValue = "somethang";
      prop.add( XmlObject.Factory.parse( "<" + SushiPropertyQNames.IKA.getLocalPart() + " xmlns=\"" + SushiPropertyQNames.IKA.getNamespaceURI() + "\">" + stringValue + "</" + SushiPropertyQNames.IKA.getLocalPart() + ">" ) );
      prop.add( XmlObject.Factory.parse( "<" + SushiPropertyQNames.IKA.getLocalPart() + " xmlns=\"" + SushiPropertyQNames.IKA.getNamespaceURI() + "\">" + stringValue + "</" + SushiPropertyQNames.IKA.getLocalPart() + ">" ) );
      assertEquals( 3,
            prop.size() );
      prop.remove( prop.get( 0 ) );
      prop.remove( prop.get( 0 ) );
      assertEquals( 1,
            prop.size() );
   }
View Full Code Here

    */
   public void init(  )
   {
      super.init(  );

      ResourceProperty resourceProperty = m_propSet.get( JobPortPropertyQNames.JOB_NAME );
      JobNameDocument  jobNameDocument = JobNameDocument.Factory.newInstance(  );
      jobNameDocument.setJobName( m_jobName );
      resourceProperty.add( jobNameDocument );

      resourceProperty = m_propSet.get( JobPortPropertyQNames.JOB_ID );
      JobIdDocument jobIdDocument = JobIdDocument.Factory.newInstance(  );
      jobIdDocument.setJobId( BigInteger.valueOf( m_jobId ) );
      resourceProperty.add( jobIdDocument );

      resourceProperty = m_propSet.get( JobPortPropertyQNames.JOB_ORIGINATING_USER_NAME );
      JobOriginatingUserNameDocument jobOriginatingUserNameDocument =
         JobOriginatingUserNameDocument.Factory.newInstance(  );
      jobOriginatingUserNameDocument.setJobOriginatingUserName( m_origUserName );
      resourceProperty.add( jobOriginatingUserNameDocument );

      resourceProperty = m_propSet.get( JobPortPropertyQNames.JOB_PRINTER_REFERENCE );
      JobPrinterReferenceDocument jobPrinterReferenceDocument =
         JobPrinterReferenceDocument.Factory.newInstance(  );
      jobPrinterReferenceDocument.setJobPrinterReference( m_printerRef );
      resourceProperty.add( jobPrinterReferenceDocument );

      resourceProperty = m_propSet.get( JobPortPropertyQNames.JOB_REFERENCE );
      JobReferenceDocument jobReferenceDocument = JobReferenceDocument.Factory.newInstance(  );
      jobReferenceDocument.setJobReference( getEpr(  ) );
      resourceProperty.add( jobReferenceDocument );

      resourceProperty = m_propSet.get( JobPortPropertyQNames.JOB_STATE );
      JobStateDocument jobStateDocument = JobStateDocument.Factory.newInstance(  );
      jobStateDocument.setJobState( JobStateType.PENDING );
      resourceProperty.add( jobStateDocument );

      Calendar currentTime = getCurrentTime();
      Calendar termTime = Calendar.getInstance(  );
      termTime.set( currentTime.get( Calendar.YEAR ),
                    currentTime.get( Calendar.MONTH ),
View Full Code Here

     * Initializes this resource's state (properties, etc.).
     */
    public void init()
    {
        super.init();
        ResourceProperty resourceProperty = m_propSet.get(PrinterPortPropertyQNames.PRINTER_REFERENCE);
        PrinterReferenceDocument printerRefDoc = PrinterReferenceDocument.Factory.newInstance();
        printerRefDoc.setPrinterReference(getEpr());
        resourceProperty.add(printerRefDoc);

        resourceProperty = m_propSet.get(PrinterPortPropertyQNames.PRINTER_STATE);
        PrinterStateDocument printerState = PrinterStateDocument.Factory.newInstance();
        printerState.setPrinterState(PrinterStateType.IDLE);
        resourceProperty.add(printerState);

        resourceProperty = m_propSet.get(PrinterPortPropertyQNames.PRINTER_NAME);
        PrinterNameDocument printName = PrinterNameDocument.Factory.newInstance();
        printName.setPrinterName(m_name);
        resourceProperty.add(printName);

        resourceProperty = m_propSet.get(PrinterPortPropertyQNames.PRINTER_IS_ACCEPTING_JOBS);
        PrinterIsAcceptingJobsDocument isAccepting = PrinterIsAcceptingJobsDocument.Factory.newInstance();
        isAccepting.setPrinterIsAcceptingJobs(false);
        resourceProperty.add(isAccepting);

        resourceProperty = m_propSet.get(PrinterPortPropertyQNames.QUEUED_JOB_COUNT);
        QueuedJobCountDocument queuedJobCountDocument = QueuedJobCountDocument.Factory.newInstance();
        queuedJobCountDocument.setQueuedJobCount(BigInteger.valueOf(0));
        resourceProperty.add(queuedJobCountDocument);

        resourceProperty = m_propSet.get(PrinterPortPropertyQNames.OPERATIONS_SUPPORTED);
        OperationsSupportedDocument operationsSupportedDocument =
                OperationsSupportedDocument.Factory.newInstance();
        List operationsSupported = new ArrayList();
        operationsSupported.add(Operations.PRINT_JOB); //refer to doc...
        operationsSupported.add(Operations.CREATE_JOB); //refer to doc...
        operationsSupported.add(Operations.SEND_DOCUMENT); //refer to doc...
        operationsSupportedDocument.setOperationsSupported(operationsSupported);
        resourceProperty.add(operationsSupportedDocument);

        resourceProperty = m_propSet.get(PrinterPortPropertyQNames.DOCUMENT_FORMAT_SUPPORTED);
        DocumentFormatSupportedDocument documentFormatSupportedDocument =
                DocumentFormatSupportedDocument.Factory.newInstance();
        MimeMediaTypes mimeMediaTypes =
                documentFormatSupportedDocument.addNewDocumentFormatSupported();
        mimeMediaTypes.addMimeMediaType(MimeMediaTypeType.TEXT_PLAIN);
        resourceProperty.add(documentFormatSupportedDocument);
    }
View Full Code Here

                    setJobState(job, JobStateType.PROCESSING);
                    //set termination time to now to make it be removed.
                    job.setTerminationTime(Calendar.getInstance());

                    XmlBeansResourcePropertySet jobPropSet = (XmlBeansResourcePropertySet) job.getResourcePropertySet();
                    ResourceProperty resourceProperty = jobPropSet.get(JobPortPropertyQNames.JOB_ID);
                    XmlInteger jobint = (XmlInteger) resourceProperty.get(0);
                    BigInteger bigIntegerValue = jobint.getBigIntegerValue();                   

                    decrementQueueCount();
                    setJobState(job, JobStateType.COMPLETED);
                }
View Full Code Here

TOP

Related Classes of org.apache.ws.resource.properties.ResourceProperty

Copyright © 2018 www.massapicom. 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.