Examples of NotificationResponse


Examples of org.jruby.pg.internal.messages.NotificationResponse

    /******     PG::Connection INSTANCE METHODS: NOTIFY     ******/

    @JRubyMethod
    public IRubyObject notifies(ThreadContext context) {
      NotificationResponse notification = postgresqlConnection.notifications();
      if (notification == null)
        return context.nil;
      RubyHash hash = new RubyHash(context.runtime);

      RubySymbol relname = context.runtime.newSymbol("relname");
      RubySymbol pid = context.runtime.newSymbol("be_pid");
      RubySymbol extra = context.runtime.newSymbol("extra");

      hash.op_aset(context, relname, context.runtime.newString(notification.getCondition()));
      hash.op_aset(context, pid, context.runtime.newFixnum(notification.getPid()));
      hash.op_aset(context, extra, context.runtime.newString(notification.getPayload()));

      return hash;
    }
View Full Code Here

Examples of org.jruby.pg.internal.messages.NotificationResponse

    }

    @JRubyMethod(name = {"wait_for_notify", "notifies_wait"}, optional = 1)
    public IRubyObject wait_for_notify(ThreadContext context, IRubyObject[] args, Block block) {
      try {
        NotificationResponse notification = postgresqlConnection.waitForNotify();
        if (block.isGiven()) {
          if (block.arity() == Arity.NO_ARGUMENTS) return block.call(context);
          RubyString condition = context.runtime.newString(notification.getCondition());
          RubyFixnum pid = context.runtime.newFixnum(notification.getPid());
          String javaPayload = notification.getPayload();
          IRubyObject payload = javaPayload == null ? context.nil : context.runtime.newString(javaPayload);
          if (!block.arity().isFixed()) {
            return block.call(context, condition, pid, payload);
          } else if (block.arity().required() == 2) {
            return block.call(context, condition, pid);
          } else if (block.arity().required() == 3) {
            return block.call(context, condition, pid, payload);
          }
          throw context.runtime.newArgumentError("Expected a block with arity 2 or 3");
        } else {
          return context.runtime.newString(notification.getCondition());
        }
      } catch (IOException e) {
        throw newPgError(context, e.getLocalizedMessage(), null, getClientEncodingAsJavaEncoding(context));
      }
    }
View Full Code Here

Examples of org.kuali.rice.ken.api.notification.NotificationResponse

        try {
          TestUtils utils = new TestUtils();
          // send notification
          final SendNotificationService sendNotificationService = (SendNotificationService) GlobalResourceLoader.getService(
              new QName(KenApiConstants.Namespaces.KEN_NAMESPACE_2_0, "sendNotificationService"));
          NotificationResponse response = sendNotificationService.invoke(utils.getTestNotificationXml());
     
          assertEquals("response status is not success", NotificationConstants.RESPONSE_STATUSES.SUCCESS, response.getStatus());
        } catch (Exception e) {
          log.error("exception occured", e);
          fail("exception occured");
        }
       
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.