Examples of Greeting


Examples of com.linkedin.restli.examples.greetings.api.Greeting

        new Object[]
          {
            new GreetingsBuilders().options(),
            new NamedDataSchema[]
              {
                new Greeting().schema(),
                new TransferOwnershipRequest().schema(),
                new SearchMetadata().schema(),
                new Empty().schema(),
                (NamedDataSchema)DataTemplateUtil.getSchema(Tone.class)
              }
          },
        new Object[]
          {
            new GreetingsRequestBuilders().options(),
            new NamedDataSchema[]
              {
                new Greeting().schema(),
                new TransferOwnershipRequest().schema(),
                new SearchMetadata().schema(),
                new Empty().schema(),
                (NamedDataSchema)DataTemplateUtil.getSchema(Tone.class)
              }
View Full Code Here

Examples of com.linkedin.restli.examples.greetings.api.Greeting

  }

  private Greeting applyMetadataProjection(final MaskTree metadataProjection) throws CloneNotSupportedException
  {
    //We then inspect the mask tree and apply an arbitrary projection
    final Greeting clonedGreeting = CUSTOM_METADATA_GREETING.clone();
    if (metadataProjection != null && metadataProjection.getOperations().size() == 1
        && metadataProjection.getOperations().get(Greeting.fields().message()) == MaskOperation.POSITIVE_MASK_OP)
    {
      clonedGreeting.removeTone();
      //Note that technically the correct behavior here would be to remove not only the tone, but also the ID.
      //However since we are testing to make sure that manual custom metadata projection works as intended, we will
      //intentionally apply an incorrect projection by hand to verify restli doesn't interfere with it.
    }
    return clonedGreeting;
View Full Code Here

Examples of gfriends.server.model.Greeting

      UserService userService = UserServiceFactory.getUserService();
      User user = userService.getCurrentUser();

      Date date = new Date();
      Greeting greeting = new Greeting(user, content, date, true);

      try {
        pm = PMF.get().getPersistenceManager();
        pm.makePersistent(greeting);
      } finally {
View Full Code Here

Examples of guestbook.Greeting

        UserService userService = UserServiceFactory.getUserService();
        User user = userService.getCurrentUser();

        String content = req.getParameter("content");
        Date date = new Date();
        Greeting greeting = new Greeting(user, content, date);

        PersistenceManager pm = PMF.get().getPersistenceManager();
        try {
            pm.makePersistent(greeting);
        } finally {
View Full Code Here

Examples of org.any_openeai_enterprise.moa.jmsobjects.coreapplication.v1_0.Greeting

      logger.debug("[ProcessInputLine] Processing line " + m_lineNumber + ": " +
        m_line);
     
      // Get a greeting and a greetee object from AppConfig to use in
      // processing this line.
      Greeting greeting = null;
      Greetee greetee = null;
      try {
        greeting = (Greeting)getAppConfig().getObject("Greeting");
        greetee = (Greetee)getAppConfig().getObject("Greetee");
      }
      catch (EnterpriseConfigurationObjectException ecoe) {
        // An error occurred retrieving an object from AppConfig. Log it,
        // increment the error count, and return.
        String errMsg = "An error occurred retrieving an object from " +
          "AppConfig. The exception is: " + ecoe.getMessage();
        logger.fatal("[ProcessInputLine.run] An error occurred processing " +
          "line number " + m_lineNumber + ": " + errMsg);
        incrementErrorCount();
        return;
      }

      // Set the full name of the greetee.
      try { greetee.setFullName(m_line.trim()); }
      catch (EnterpriseFieldException efe) {
        // An error occurred setting the value of the full name for the
        // greetee. Log it, increment the error count, and return.
        String errMsg = "An error occurred setting the value of the full name "
          + "of the greetee. The exception is: " + efe.getMessage();
        logger.fatal("[ProcessInputLine.run] An error occurred processing " +
          "line number " + m_lineNumber + ": " + errMsg);
        incrementErrorCount();
        return
      }

      // Generate the greeting.
      List results = null;
      try {
        logger.info("[ProcessInputLine.run] Sending a Greeting.Generate-" +
          "Request for: " + greetee.getFullName());
        results = greeting.generate(greetee, m_p2p);
      }    
      catch (EnterpriseObjectGenerateException eoge) {
        if (eoge.getMessage().toLowerCase().indexOf("time") != -1) {
          // The error was a timeout error. Log it.
          String errMsg = "Timed out waiting for reply.";
          logger.fatal("[ProcessInputLine.run] " + errMsg);
        }
        else {
          // An error occurred generating the greeting. Log it.
          String errMsg = "An error occurred generating the greeting. The " +
            "exception is: " + eoge.getMessage();
          logger.fatal("[ProcessInputLine.run] " + errMsg);
          eoge.printStackTrace();
        }
        // Increment the error count and return.
        incrementErrorCount();
        return;
      }

      // Display the greeting that was generated by EGS.
      for (int i=0; i < results.size(); i++) {
        greeting = (Greeting)results.get(i);
        logger.info("[ProcessInputLine.run] Greeting returned for '" +
          greetee.getFullName() + "' is: " + greeting.getText());
      }
     
      logger.debug("[ProcessInputLine.run] Completed processing line " +
        m_lineNumber + ": " + m_line);
View Full Code Here

Examples of org.any_openeai_enterprise.moa.jmsobjects.coreapplication.v1_0.Greeting

        buildReplyDocumentWithErrors(eControlArea, localResponseDoc, errors);
      return getMessage(msg, replyContents);
    }

    // Get a configured Greeting and Greetee from AppConfig.
    Greeting greeting = new Greeting();
    try {
    greeting = (Greeting)getAppConfig().getObjectByType(greeting.getClass()
      .getName());
    }
    catch (EnterpriseConfigurationObjectException eoce) {
      logger.fatal("[GreetingRequestCommand] Error retrieving a Greeting " +
        "object from AppConfig: The exception is: " + eoce.getMessage());
   
    Greetee greetee = new Greetee();
    try {
      greetee = (Greetee)getAppConfig().getObjectByType(greetee.getClass()
        .getName());
    }
    catch (EnterpriseConfigurationObjectException eoce) {
      logger.fatal("[GreetingRequestCommand] Error retrieving a Greeting " +
        "object from AppConfig: The exception is: " + eoce.getMessage());
    }

    // Handle a Generate-Request.
    if (msgAction.equalsIgnoreCase("Generate")) {
      logger.info("[GreetingRequestCommand] Handling an " +
        "org.any-openeai-enterprise.CoreApplication.Greeting.Generate-Request" +
        " message.");
      Element eGreetee = inDoc.getRootElement().getChild("DataArea")
        .getChild("Greetee");

      // Verify that Greetee element is not null; if it is, reply with an error.
      if (eGreetee == null) {     
        String errType = "application";
        String errCode = "OpenEAI-1015";
        String errDesc = "Invalid generate element found in the Generate-" +
          "Request message. This command expects a Greetee.";
        logger.fatal("[GreetingRequestCommand] " + errDesc);
        logger.fatal("Message sent in is: \n" + getMessageBody(inDoc));
        ArrayList errors = new ArrayList();
        errors.add(buildError(errType, errCode, errDesc));
        String replyContents =
          buildReplyDocumentWithErrors(eControlArea, localResponseDoc, errors);
        return getMessage(msg, replyContents);
      }
     
      // Now build a Greetee object from the Greetee element in the message.
      try {
        greetee.buildObjectFromInput(eGreetee);
      }
      catch (EnterpriseLayoutException ele) {
        // There was an error building the Greetee object from a Greetee
        // element.
        String errType = "application";
        String errCode = "EnterpriseGreetingService-1001";
        String errDesc = "An error occurred building Greetee object from the " +
          "Greetee element in the Generate-Request message. The exception " +
          "is: " + ele.getMessage();
        logger.fatal("[GreeteeRequestCommand] " + errDesc);
        logger.fatal("Message sent in is: \n" + getMessageBody(inDoc));
        ArrayList errors = new ArrayList();
        errors.add(buildError(errType, errCode, errDesc));
        String replyContents =
        buildReplyDocumentWithErrors(eControlArea, localResponseDoc, errors);
        return getMessage(msg, replyContents);
      }

      // Generate the greeting.
      try {
        if (greetee.getFullName() != null && greetee.getFullName() != "") {
          // There is a greetee with a name to greet. Prepare the greeting text.
          greeting.setText("Hello, " + greetee.getFullName() + "!");
        }
        else {
          // There is no greetee with a name to greet. Use the default greeting
          // text.
          greeting.setText(getDefaultGreetingText());
        }
      }
      catch (EnterpriseFieldException efe) {
        // An error occurred setting the value of the greeting text. Log it and
        // reply with an error.
        String errType = "application";
        String errCode = "EnterpriseGreetingService-1002";
        String errDesc = "An error occurred setting the value of the " +
          "greeting text. The exception is: " + efe.getMessage();
        logger.fatal("[GreetingRequestCommand " + errDesc);
        ArrayList errors = new ArrayList();
        errors.add(buildError(errType, errCode, errDesc));
        String replyContents =
        buildReplyDocumentWithErrors(eControlArea, localResponseDoc, errors);
        return getMessage(msg, replyContents);
      }

      // Set the TestId.
      greeting.setTestId(greetee.getTestId());

      // Get pub/sub producer to use in this transaction.
      PubSubProducer pub = null;
      try {
        pub = (PubSubProducer)m_pubSubProducerPool.getProducer();
      }
      catch (JMSException jmse) {
        // An error occurred retrieving a pub/sub producer to use to publish
        // the Greeting.Create-Sync. Log it and reply with an error.
        String errType = "application";
        String errCode = "EnterpriseGreetingService-1003";
        String errDesc = "An error occurred retrieving a pub/sub producer to " +
          "use to publish the Greeting.Create-Sync. The exception is: " +
          jmse.getMessage();
        logger.fatal("[GreetingRequestCommand " + errDesc);
        ArrayList errors = new ArrayList();
        errors.add(buildError(errType, errCode, errDesc));
        String replyContents =
        buildReplyDocumentWithErrors(eControlArea, localResponseDoc, errors);
        return getMessage(msg, replyContents);
      }
   
      // Serialize the greeting and place it into the reply.
      String replyContents = null;
      try {
        localResponseDoc.getRootElement().getChild("DataArea").removeContent();
    localResponseDoc.getRootElement().getChild("DataArea").
        addContent((Element)greeting.buildOutputFromObject());
        replyContents = buildReplyDocument(eControlArea, localResponseDoc);
      }
      catch (EnterpriseLayoutException ele) {
        // There was an error building the Greeting element from the Greeting
        // object.
        String errType = "application";
        String errCode = "EnterpriseGreetingService-1004";
        String errDesc = "Error building Greeting element from the Greeting " +
          "object.  The exception is: " + ele.getMessage();
        logger.fatal("[GreetingRequestCommand " + errDesc);
        ArrayList errors = new ArrayList();
        errors.add(buildError(errType, errCode, errDesc));
        replyContents = buildReplyDocumentWithErrors(eControlArea,
          localResponseDoc, errors);
        return getMessage(msg, replyContents);
      }

      // Publish the create sync message.
      try { greeting.createSync(pub); }
      catch (EnterpriseObjectSyncException eose) {
        // An error occurred publishing the Greeting.Create-Sync message.
        // Log it and reply with an error.
        String errType = "application";
        String errCode = "EnterpriseGreetingService-1005";
View Full Code Here

Examples of org.apache.tuscany.container.groovy.mock.Greeting

        GroovyAtomicComponent component = new GroovyAtomicComponent(configuration, null);
        ObjectFactory<?> factory = createMock(ObjectFactory.class);
        expect((String) factory.getInstance()).andReturn("bar");
        replay(factory);
        component.addPropertyFactory("property", factory);
        Greeting greeting = (Greeting) component.getServiceInstance();
        assertEquals("bar", greeting.greet("foo"));
    }
View Full Code Here

Examples of org.apache.tuscany.container.groovy.mock.Greeting

        for (OutboundInvocationChain chain : wire.getInvocationChains().values()) {
            chain.setTargetInvoker(invoker);
        }
        component.addOutboundWire(wire);
        Greeting greeting = (Greeting) component.getServiceInstance();
        assertEquals("foo", greeting.greet("foo"));
        verify(invoker);
    }
View Full Code Here

Examples of org.apache.tuscany.container.groovy.mock.Greeting

        terminateWire(wire);
        for (InboundInvocationChain chain : wire.getInvocationChains().values()) {
            chain.setTargetInvoker(component.createTargetInvoker(null, chain.getOperation()));
        }
        component.addInboundWire(wire);
        Greeting greeting = (Greeting) component.getServiceInstance("Greeting");
        assertEquals("foo", greeting.greet("foo"));
    }
View Full Code Here

Examples of org.apache.tuscany.container.javascript.mock.Greeting

        ArtifactFactory.terminateWire(wire);
        for (InboundInvocationChain chain : wire.getInvocationChains().values()) {
            chain.setTargetInvoker(context.createTargetInvoker(null, chain.getOperation()));
        }
        context.addInboundWire(wire);
        Greeting greeting = (Greeting) context.getServiceInstance("Greeting");
        assertEquals("foo", greeting.greet("foo"));
        scope.stop();
    }
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.