text:
package org.apache.juddi.v3.tck;

import java.util.List;
import javax.xml.ws.BindingProvider;

import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.juddi.v3.client.UDDIConstants;
import org.apache.juddi.v3.client.config.UDDIClient;
import org.apache.juddi.v3.client.transport.Transport;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Assume;
import org.junit.BeforeClass;
import org.junit.Test;
import org.uddi.api_v3.CategoryBag;
import org.uddi.api_v3.FindQualifiers;
import org.uddi.api_v3.FindService;
import org.uddi.api_v3.KeyedReference;
import org.uddi.api_v3.ServiceInfo;
import org.uddi.api_v3.ServiceList;
import org.uddi.v3_service.UDDIInquiryPortType;
import org.uddi.v3_service.UDDIPublicationPortType;
import org.uddi.v3_service.UDDISecurityPortType;

/**
 * Test to verify JUDDI-456
 *
 * Test does a find_service with the combinedCategoryBags findQualifier set,
 * expects back one service with a serviceKey of
 * uddi:uddi.tompublisher.com:servicetest02.
 *
 * @author Tom Cunningham
 * @author Alex O'Ree
 */
public class UDDI_120_CombineCategoryBagsFindServiceIntegrationTest {

        final static String TOM_PUBLISHER_TMODEL_XML = "uddi_data/tompublisher/tModelKeyGen.xml";
        final static String TOM_PUBLISHER_TMODEL01_XML = "uddi_data/tompublisher/tModel01.xml";
        final static String TOM_PUBLISHER_TMODEL02_XML = "uddi_data/tompublisher/tModel02.xml";
        final static String TOM_PUBLISHER_TMODEL_KEY = "uddi:uddi.tompublisher.com:keygenerator";
        final static String TOM_PUBLISHER_TMODEL01_KEY = "uddi:uddi.tompublisher.com:tmodeltest01";
        final static String TOM_PUBLISHER_TMODEL01_NAME = "tmodeltest01";
        final static String TOM_PUBLISHER_TMODEL02_KEY = "uddi:uddi.tompublisher.com:tmodeltest02";
        final static String TOM_BUSINESS1_XML = "uddi_data/tompublisher/juddi456-business1.xml";
        final static String TOM_BUSINESS2_XML = "uddi_data/tompublisher/juddi456-business2.xml";
        final static String TOM_BUSINESS5_XML = "uddi_data/tompublisher/juddi456-business5.xml";
        final static String TOM_BUSINESS1_KEY = "uddi:uddi.tompublisher.com:businesstest01";
        final static String TOM_BUSINESS2_KEY = "uddi:uddi.tompublisher.com:businesstest02";
        final static String TOM_BUSINESS5_KEY = "uddi:uddi.tompublisher.com:businesstest05";
        final static String SERVICE_KEY1 = "uddi:uddi.tompublisher.com:servicetest01";
        final static String SERVICE_KEY5 = "uddi:uddi.tompublisher.com:servicetest05";
        final static String TOM_PUBLISHER_SERVICEINFO_NAME = "servicetest01";
        private static Log logger = LogFactory.getLog(UDDI_120_CombineCategoryBagsFindServiceIntegrationTest.class);
        protected static TckTModel tckTModel = null;
        protected static TckBusiness tckBusiness = null;
        protected static String authInfoJoe = null;
        private static UDDIInquiryPortType inquiry = null;
        private static UDDIClient manager;

        @AfterClass
        public static void stopManager() throws ConfigurationException {
             Assume.assumeTrue(TckPublisher.isEnabled());
                tckTModel.deleteCreatedTModels(authInfoJoe);
                manager.stop();
        }

        @BeforeClass
        public static void startManager() throws ConfigurationException {
             Assume.assumeTrue(TckPublisher.isEnabled());
                manager = new UDDIClient();
                manager.start();

                logger.debug("Getting auth tokens..");
                try {
                        Transport transport = manager.getTransport("uddiv3");
                        UDDISecurityPortType security = transport.getUDDISecurityService();
                        authInfoJoe = TckSecurity.getAuthToken(security, TckPublisher.getJoePublisherId(), TckPublisher.getJoePassword());
                        //Assert.assertNotNull(authInfoJoe);
                        UDDIPublicationPortType publication = transport.getUDDIPublishService();
                        inquiry = transport.getUDDIInquiryService();

                        if (!TckPublisher.isUDDIAuthMode()){
                                TckSecurity.setCredentials((BindingProvider) publication, TckPublisher.getJoePublisherId(), TckPublisher.getJoePassword());
                                TckSecurity.setCredentials((BindingProvider) inquiry, TckPublisher.getJoePublisherId(), TckPublisher.getJoePassword());
                        }
                        tckTModel = new TckTModel(publication, inquiry);
                        tckBusiness = new TckBusiness(publication, inquiry);
                } catch (Exception e) {
                        logger.error(e.getMessage(), e);
                        Assert.fail("Could not obtain authInfo token.");
                }
        }

        @Test
        public void findServiceByCategoryBag() {
             Assume.assumeTrue(TckPublisher.isEnabled());
                try {
                        tckTModel.saveTModel(authInfoJoe, TOM_PUBLISHER_TMODEL_XML, TOM_PUBLISHER_TMODEL_KEY);
                        tckTModel.saveTModel(authInfoJoe, TOM_PUBLISHER_TMODEL01_XML, TOM_PUBLISHER_TMODEL01_KEY);
                        tckTModel.saveTModel(authInfoJoe, TOM_PUBLISHER_TMODEL02_XML, TOM_PUBLISHER_TMODEL02_KEY);

                        tckBusiness.saveBusinesses(authInfoJoe, TOM_BUSINESS1_XML, TOM_BUSINESS1_KEY, 1);
                        tckBusiness.saveBusinesses(authInfoJoe, TOM_BUSINESS2_XML, TOM_BUSINESS2_KEY, 1);
                        tckBusiness.saveBusinesses(authInfoJoe, TOM_BUSINESS5_XML, TOM_BUSINESS5_KEY, 1);
                        try {
                                int size = 0;
                                ServiceList sl = null;

                                FindService fs = new FindService();

                                //by default keys are ADD, we should only find service 5
                                KeyedReference keyRef1 = new KeyedReference();
                                keyRef1.setTModelKey(TOM_PUBLISHER_TMODEL01_KEY);
                                keyRef1.setKeyValue("value-z");

                                KeyedReference keyRef2 = new KeyedReference();
                                keyRef2.setTModelKey(TOM_PUBLISHER_TMODEL02_KEY);
                                keyRef2.setKeyValue("value-x");

                                CategoryBag cb = new CategoryBag();
                                cb.getKeyedReference().add(keyRef1);
                                cb.getKeyedReference().add(keyRef2);
                                fs.setCategoryBag(cb);

                                sl = inquiry.findService(fs);
                                if (sl.getServiceInfos() == null) {
                                        Assert.fail("Should have found one entry on FindService with TModelBag, "
                                                + "found " + size);
                                }
                                size = sl.getServiceInfos().getServiceInfo().size();
                                if (size != 1) {
                                        Assert.fail("Should have found one entry on FindService with TModelBag, "
                                                + "found " + size);
                                } else {
                                        List<ServiceInfo> siList = sl.getServiceInfos().getServiceInfo();
                                        String serviceKey = siList.get(0).getServiceKey();
                                        if (!SERVICE_KEY5.equals(serviceKey)) {
                                                Assert.fail("Should have found service key " + SERVICE_KEY5
                                                        + " but found [" + serviceKey + "]");
                                        }
                                }
                        } catch (Exception e) {
                                e.printStackTrace();
                                Assert.fail(e.getMessage());
                        }
                } finally {
                        tckBusiness.deleteBusinesses(authInfoJoe, TOM_BUSINESS1_XML, TOM_BUSINESS1_KEY, 1);
                        tckBusiness.deleteBusinesses(authInfoJoe, TOM_BUSINESS2_XML, TOM_BUSINESS2_KEY, 1);
                        tckBusiness.deleteBusinesses(authInfoJoe, TOM_BUSINESS5_XML, TOM_BUSINESS5_KEY, 1);

                        tckTModel.deleteTModel(authInfoJoe, TOM_PUBLISHER_TMODEL_XML, TOM_PUBLISHER_TMODEL_KEY);
                        tckTModel.deleteTModel(authInfoJoe, TOM_PUBLISHER_TMODEL01_XML, TOM_PUBLISHER_TMODEL01_KEY);
                        tckTModel.deleteTModel(authInfoJoe, TOM_PUBLISHER_TMODEL02_XML, TOM_PUBLISHER_TMODEL02_KEY);
                }
        }

        @Test
        public void findNoServiceByCategoryBag() {
             Assume.assumeTrue(TckPublisher.isEnabled());
                try {
                        tckTModel.saveTModel(authInfoJoe, TOM_PUBLISHER_TMODEL_XML, TOM_PUBLISHER_TMODEL_KEY);
                        tckTModel.saveTModel(authInfoJoe, TOM_PUBLISHER_TMODEL01_XML, TOM_PUBLISHER_TMODEL01_KEY);
                        tckTModel.saveTModel(authInfoJoe, TOM_PUBLISHER_TMODEL02_XML, TOM_PUBLISHER_TMODEL02_KEY);

                        tckBusiness.saveBusinesses(authInfoJoe, TOM_BUSINESS1_XML, TOM_BUSINESS1_KEY, 1);
                        tckBusiness.saveBusinesses(authInfoJoe, TOM_BUSINESS2_XML, TOM_BUSINESS2_KEY, 1);
                        tckBusiness.saveBusinesses(authInfoJoe, TOM_BUSINESS5_XML, TOM_BUSINESS5_KEY, 1);
                        try {
                                int size = 0;
                                ServiceList sl = null;

                                FindService fs = new FindService();

                                //by default keys are ADD, we should only find service 5
                                KeyedReference keyRef1 = new KeyedReference();
                                keyRef1.setTModelKey(TOM_PUBLISHER_TMODEL01_KEY);
                                keyRef1.setKeyValue("value-y");

                                CategoryBag cb = new CategoryBag();
                                cb.getKeyedReference().add(keyRef1);
                                fs.setCategoryBag(cb);

                                sl = inquiry.findService(fs);
                                if (sl.getServiceInfos() != null) {
                                        Assert.fail("Should have found no entries on FindService, "
                                                + " found " + size);
                                }
                        } catch (Exception e) {
                                e.printStackTrace();
                                Assert.fail(e.getMessage());
                        }
                } finally {
                        tckBusiness.deleteBusinesses(authInfoJoe, TOM_BUSINESS1_XML, TOM_BUSINESS1_KEY, 1);
                        tckBusiness.deleteBusinesses(authInfoJoe, TOM_BUSINESS2_XML, TOM_BUSINESS2_KEY, 1);
                        tckBusiness.deleteBusinesses(authInfoJoe, TOM_BUSINESS5_XML, TOM_BUSINESS5_KEY, 1);

                        tckTModel.deleteTModel(authInfoJoe, TOM_PUBLISHER_TMODEL_XML, TOM_PUBLISHER_TMODEL_KEY);
                        tckTModel.deleteTModel(authInfoJoe, TOM_PUBLISHER_TMODEL01_XML, TOM_PUBLISHER_TMODEL01_KEY);
                        tckTModel.deleteTModel(authInfoJoe, TOM_PUBLISHER_TMODEL02_XML, TOM_PUBLISHER_TMODEL02_KEY);
                }
        }
        /*
         * For a combinedCategoryBag, we find a service if either the categoryBag on the service
         * matches, or one of the categoryBags on the bindings.
         */

        @Test
        public void findServiceByCombinedCategoryBag() {
             Assume.assumeTrue(TckPublisher.isEnabled());
                try {
                        tckTModel.saveTModel(authInfoJoe, TOM_PUBLISHER_TMODEL_XML, TOM_PUBLISHER_TMODEL_KEY);
                        tckTModel.saveTModel(authInfoJoe, TOM_PUBLISHER_TMODEL01_XML, TOM_PUBLISHER_TMODEL01_KEY);
                        tckTModel.saveTModel(authInfoJoe, TOM_PUBLISHER_TMODEL02_XML, TOM_PUBLISHER_TMODEL02_KEY);

                        tckBusiness.saveBusinesses(authInfoJoe, TOM_BUSINESS1_XML, TOM_BUSINESS1_KEY, 1);
                        tckBusiness.saveBusinesses(authInfoJoe, TOM_BUSINESS2_XML, TOM_BUSINESS2_KEY, 1);
                        try {
                                int size = 0;
                                ServiceList sl = null;

                                FindService fs = new FindService();
                                FindQualifiers fqs = new FindQualifiers();
                                fqs.getFindQualifier().add(UDDIConstants.COMBINE_CATEGORY_BAGS);
                                fs.setFindQualifiers(fqs);

                                KeyedReference keyRef1 = new KeyedReference();
                                keyRef1.setTModelKey(TOM_PUBLISHER_TMODEL01_KEY);
                                keyRef1.setKeyValue("value-y");

                                CategoryBag cb = new CategoryBag();
                                cb.getKeyedReference().add(keyRef1);
                                fs.setCategoryBag(cb);

                                sl = inquiry.findService(fs);
                                if (sl.getServiceInfos() == null) {
                                        Assert.fail("Should have found one entry on FindService with TModelBag, "
                                                + "found " + size);
                                }
                                size = sl.getServiceInfos().getServiceInfo().size();
                                if (size != 1) {
                                        Assert.fail("Should have found one entry on FindService with TModelBag, "
                                                + "found " + size);
                                } else {
                                        List<ServiceInfo> siList = sl.getServiceInfos().getServiceInfo();
                                        String serviceKey = siList.get(0).getServiceKey();
                                        if (!SERVICE_KEY1.equals(serviceKey)) {
                                                Assert.fail("Should have found service key " + SERVICE_KEY1
                                                        + " but found [" + serviceKey + "]");
                                        }
                                }
                        } catch (Exception e) {
                                e.printStackTrace();
                                Assert.fail(e.getMessage());
                        }
                } finally {
                        tckBusiness.deleteBusinesses(authInfoJoe, TOM_BUSINESS1_XML, TOM_BUSINESS1_KEY, 1);
                        tckBusiness.deleteBusinesses(authInfoJoe, TOM_BUSINESS2_XML, TOM_BUSINESS2_KEY, 1);

                        tckTModel.deleteTModel(authInfoJoe, TOM_PUBLISHER_TMODEL_XML, TOM_PUBLISHER_TMODEL_KEY);
                        tckTModel.deleteTModel(authInfoJoe, TOM_PUBLISHER_TMODEL01_XML, TOM_PUBLISHER_TMODEL01_KEY);
                        tckTModel.deleteTModel(authInfoJoe, TOM_PUBLISHER_TMODEL02_XML, TOM_PUBLISHER_TMODEL02_KEY);
                }
        }
}


text:
    <title>Three.js polymer.js viewer example</title>

      <link rel="import" href="components/polymer/polymer.html">
      <link rel="import" href="components/polymer-three-js/three-js.html">

  <polymer-element name="object-attrs" attributes="autorotate fullscreen axes xpos width depth height radius hue saturation darkness offset" >

    <template>

             Object controls

              X position <input type="range" value="{{xpos}}">
              <input type="text" value="{{xpos}}">

              Width <input type="range" value="{{width}}" min=1>
              <input type="text" value="{{width}}">

              Depth <input type="range" value="{{depth}}" min=1>
              <input type="text" value="{{depth}}">

              Height <input type="range" value="{{height}}" min=1>
              <input type="text" value="{{height}}">

              Sphere radius <input type="range" value="{{radius}}" min=1>
              <input type="text" value="{{radius}}">

             View controls

              Autorotate view <input type="checkbox"  checked="{{autorotate}}">
              <input type="text" value="{{autorotate}}">

              Show axes <input type="checkbox" checked="{{axes}}">
              <input type="text" value="{{axes}}">

              Fullscreen <input type="checkbox" checked="{{fullscreen}}">
              <input type="text" value="{{fullscreen}}">

             Fx controls

              Saturation <input type="range" step="0.1" min="0" max="10"  value="{{saturation}}">
              <input type="text" value="{{saturation}}" >

              Hue <input type="range" step="0.01" min="0" max="1" value="{{hue}}">
              <input type="text" value="{{hue}}">

              Darkness <input type="range" step="0.1" min="0" max="10"  value="{{darkness}}">
              <input type="text" value="{{darkness}}" >

              Offset <input type="range" step="0.01" min="0" max="1" value="{{offset}}">
              <input type="text" value="{{offset}}">

        <three-js postProcess fullscreen="{{fullscreen}}">
          <three-stats id="stats" show></three-stats>
          <three-js-combinedCamera tracking x="100" y="100" z="200" orientation="top" cameraUp=[0,0,1] ></three-js-combinedCamera>
          <three-js-orbitControls cameraUp=[0,0,1] autoRotateSpeed="10" autoRotate="{{autorotate}}"> </three-js-orbitControls>

          <three-js-scene name="caramba" active>
            <three-js-object hierarchyRoot>
              <three-js-cube x="{{xpos}}" color="orange" w="{{width}}" d="{{depth}}" h="{{height}}" > </three-js-cube>
              <three-js-sphere color="blue" r="{{radius}}"  > </three-js-sphere>
            </three-js-object>

            <three-js-object helpersRoot>
              <three-axis-helper show="{{axes}}"> </three-axis-helper>
              <three-js-light x="50" y="30" z="200"></three-js-light>
              <three-js-light kind="spot" x="-150" y="350" rx="90" shadow></three-js-light>
            </three-js-object>
          </three-js-scene>

          <three-effect-composer >
            <vignette-fx darkness="{{darkness}}" offset="{{offset}}"> </vignette-fx>
            <hueSaturation-fx hue="{{hue}}" saturation="{{saturation}}"> </hueSaturation-fx>

          </three-effect-composer>

        </three-js>

    </template>

  </polymer-element>

  <object-attrs></object-attrs>

redpajama_set_name: RedPajamaGithub


text:
package io.permazen.cli;

import com.google.common.base.Preconditions;

import io.permazen.parse.ParseException;
import io.permazen.parse.ParseSession;
import io.permazen.parse.Parser;
import io.permazen.util.ParseContext;

import java.util.ArrayList;
import java.util.List;

public class CommandListParser implements Parser<List<CliSession.Action>> {

    private final Parser<CliSession.Action> commandParser;

    /**
     * Constructor.
     *
     * @param commandParser single command parser
     */
    public CommandListParser(Parser<CliSession.Action> commandParser) {
        Preconditions.checkArgument(commandParser != null, "null commandParser");
        this.commandParser = commandParser;
    }

    /**
     * Parse one or more commands and return the {@link CliSession.Action}s corresponding to the parsed commands.
     */
    @Override
    public List<CliSession.Action> parse(ParseSession session, ParseContext ctx, boolean complete) {
        final ArrayList<CliSession.Action> actions = new ArrayList<>();
        while (true) {
            ctx.skipWhitespace();
            if (ctx.isEOF() && !complete)
                break;
            actions.add(this.commandParser.parse(session, ctx, complete));
            if (ctx.isEOF() && !complete)
                break;
            if (!ctx.tryLiteral(";"))
                throw new ParseException(ctx).addCompletion("; ");
        }
        return actions;
    }
}