Examples of LoremIpsum


Examples of de.svenjacobs.loremipsum.LoremIpsum

                                AuthToken rootAuthToken = security.getAuthToken(getAuthTokenRoot);
                                System.out.println("root AUTHTOKEN = " + "don't log auth tokens!");
                                token = rootAuthToken.getAuthInfo();
                        }

                        LoremIpsum textgen = new LoremIpsum();
                        DatatypeFactory df = DatatypeFactory.newInstance();
                        GregorianCalendar gcal = new GregorianCalendar();
                        gcal.setTimeInMillis(System.currentTimeMillis());
                        XMLGregorianCalendar xcal = df.newXMLGregorianCalendar(gcal);
                        for (int i = 0; i < businesses; i++) {
                                // Creating the parent business entity that will contain our service.
                                BusinessEntity myBusEntity = new BusinessEntity();
                                Name myBusName = new Name();
                                myBusName.setLang("en");
                                myBusName.setValue("My Business " + i + " " + xcal.toString() + " " + textgen.getWords(5, 2) );
                                myBusEntity.getDescription().add(new Description( textgen.getWords(10, 2), null));
                                myBusEntity.getName().add(myBusName);

                                // Adding the business entity to the "save" structure, using our publisher's authentication info and saving away.
                                SaveBusiness sb = new SaveBusiness();
                                sb.getBusinessEntity().add(myBusEntity);
                                sb.setAuthInfo(token);
                                BusinessDetail bd = publish.saveBusiness(sb);
                                String myBusKey = bd.getBusinessEntity().get(0).getBusinessKey();
                                System.out.println("saved: Business key:  " + myBusKey);
                                for (int k = 0; k < servicesPerBusiness; k++) {
                                        // Creating a service to save.  Only adding the minimum data: the parent business key retrieved from saving the business
                                        // above and a single name.
                                        BusinessService myService = new BusinessService();
                                        myService.setBusinessKey(myBusKey);
                                        Name myServName = new Name();
                                        myServName.setLang("en");
                                        myServName.setValue("My Service " + i + " " + k + " " + xcal.toString()+ " " + textgen.getWords(5, 2) );
                                        myService.getName().add(myServName);
                                        myService.getDescription().add(new Description( textgen.getWords(10, 2), null));
                                       
                                        // Add binding templates, etc...
                                        BindingTemplate myBindingTemplate = new BindingTemplate();
                                        myBindingTemplate.setCategoryBag(new CategoryBag());
                                        KeyedReference kr = new KeyedReference();
                                        kr.setTModelKey(UDDIConstants.TRANSPORT_HTTP);
                                        kr.setKeyName("keyname1");
                                        kr.setKeyValue("myvalue1");

                                        myBindingTemplate.getCategoryBag().getKeyedReference().add(kr);

                                        KeyedReferenceGroup krg = new KeyedReferenceGroup();
                                        krg.setTModelKey(UDDIConstants.TRANSPORT_HTTP);
                                        kr = new KeyedReference();
                                        kr.setTModelKey(UDDIConstants.PROTOCOL_SSLv3);
                                        kr.setKeyName("keyname1grp");
                                        kr.setKeyValue("myvalue1grp");

                                        krg.getKeyedReference().add(kr);
                                        myBindingTemplate.getCategoryBag().getKeyedReferenceGroup().add(krg);

                                        myService.setCategoryBag(new CategoryBag());

                                        kr = new KeyedReference();
                                        kr.setTModelKey(UDDIConstants.TRANSPORT_HTTP);
                                        kr.setKeyName("Servicekeyname2grp");
                                        kr.setKeyValue("Servicemyvalue2grp");
                                        myService.getCategoryBag().getKeyedReference().add(kr);

                                        krg = new KeyedReferenceGroup();
                                        krg.setTModelKey(UDDIConstants.TRANSPORT_HTTP);
                                        kr = new KeyedReference();
                                        kr.setTModelKey(UDDIConstants.TRANSPORT_HTTP);
                                        kr.setKeyName("keyname1grp");
                                        kr.setKeyValue("myvalue1grp");

                                        krg.getKeyedReference().add(kr);
                                        myService.getCategoryBag().getKeyedReferenceGroup().add(krg);

                                        AccessPoint accessPoint = new AccessPoint();
                                        accessPoint.setUseType(AccessPointType.WSDL_DEPLOYMENT.toString());
                                        accessPoint.setValue("http://example.org/services/myservice" + i + k + "?wsdl");
                                        myBindingTemplate.setAccessPoint(accessPoint);
                                        myBindingTemplate.setTModelInstanceDetails(new TModelInstanceDetails());
                                        TModelInstanceInfo tii = new TModelInstanceInfo();
                                        Description d = new Description();
                                        d.setValue("Tmodel instance description");
                                        tii.getDescription().add(d);
                                        tii.setTModelKey(UDDIConstants.TRANSPORT_HTTP);
                                        tii.setInstanceDetails(new InstanceDetails());
                                        tii.getInstanceDetails().setInstanceParms("heres some useful stuff describing this endpoint, up to 4KB of data"+ " " + textgen.getWords(20, 2) );
                                        tii.getInstanceDetails().getDescription().add(d);
                                        OverviewDoc od = new OverviewDoc();
                                        d = new Description();
                                        d.setValue("ovweview doc description"+ " " + textgen.getWords(5, 2) );
                                        od.getDescription().add(d);
                                        od.setOverviewURL(new OverviewURL());
                                        od.getOverviewURL().setUseType("www");
                                        od.getOverviewURL().setValue("www.apache.org");
                                        tii.getInstanceDetails().getOverviewDoc().add(od);
View Full Code Here

Examples of org.apache.chemistry.opencmis.util.content.loremipsum.LoremIpsum

        ContentStreamImpl content = new ContentStreamImpl();
        content.setFileName("data.html");
        content.setMimeType("text/html");
        int len = fContentSizeInK * 1024; // size of document in K
       
        LoremIpsum ipsum = new LoremIpsum();
        String text = ipsum.generateParagraphsFullHtml(len, true);
        content.setStream(new ByteArrayInputStream(text.getBytes()));
        return content;
    }
View Full Code Here

Examples of org.apache.chemistry.opencmis.util.content.loremipsum.LoremIpsum

        ContentStreamImpl content = new ContentStreamImpl();
        content.setFileName("data.txt");
        content.setMimeType("text/plain");
        int len = fContentSizeInK * 1024; // size of document in K
       
        LoremIpsum ipsum = new LoremIpsum();
        String text = ipsum.generateParagraphsPlainText(len, 80, true);
        content.setStream(new ByteArrayInputStream(text.getBytes()));
        return content;
    }
View Full Code Here

Examples of org.apache.chemistry.opencmis.util.content.loremipsum.LoremIpsum

    }
   
    @Test
    public void testGenerateLoreIpsumPlainTextWriter() throws IOException  {
        LOG.debug("Generate new Lore Ipsum as plain text with PrintWriter: ");
        LoremIpsum ipsum = new LoremIpsum();
        StringWriter writer = new StringWriter();
        ipsum.generateParagraphsPlainText(writer, 2048, true);
        LOG.debug(writer.toString());
        LOG.debug("End Test.");
    }
View Full Code Here

Examples of org.apache.chemistry.opencmis.util.content.loremipsum.LoremIpsum

    }
   
    @Test
    public void testGenerateLoreIpsumPlainTextFormattedWriter() throws IOException {
        LOG.debug("Generate new Lore Ipsum as plain text with 60 columns with PrintWriter: ");
        LoremIpsum ipsum = new LoremIpsum();
        StringWriter writer = new StringWriter();
        ipsum.generateParagraphsPlainText(writer, 256, 60, false);
        LOG.debug(writer.toString());
        LOG.debug("End Test.");
    }
View Full Code Here

Examples of org.apache.chemistry.opencmis.util.content.loremipsum.LoremIpsum

          sample.append(buffer, 0, read);
        }
      } while (read>=0);

     
      LoremIpsum ipsum = new LoremIpsum(sample.toString());
      String output = ipsum.generateParagraphsPlainText(4096, 80, false);
      LOG.debug(output);
        LOG.debug("End Test.");
    }
View Full Code Here

Examples of org.apache.chemistry.opencmis.util.content.loremipsum.LoremIpsum

      doGenerate(" .\n\n .");
    }
   
    private void doGenerate(String text) {
      try {
        generator = new LoremIpsum(text, dictionary);
        generator.generateParagraph(false);
        fail("Sample text " + text + " should generate exception.");
      } catch (RuntimeException e) {
        assertTrue(e.getMessage().contains("Invalid sample text"));
      }
View Full Code Here

Examples of org.apache.chemistry.opencmis.util.content.loremipsum.LoremIpsum

      doGenerateNoDict("  \n\n  ");
    }
   
    private void doGenerateNoDict(String dict) {
      try {
        generator = new LoremIpsum(sample, dict);
        generator.generateParagraph(false);
        fail("Dictionary " + dict + " should generate exception.");
      } catch (RuntimeException e) {
        assertEquals(e.getMessage(), "Invalid dictionary.");
      }
View Full Code Here

Examples of org.apache.chemistry.opencmis.util.content.loremipsum.LoremIpsum

    }
   
    @Test
    public void testGenerateLoreIpsum() {
      LOG.debug("Generate new Lore Ipsum text: ");
      LoremIpsum ipsum = new LoremIpsum();
      String[] newParagraphs = new String[4];
      for (int i=0; i<newParagraphs.length; i++) {
        newParagraphs[i] = ipsum.generateParagraph(false);
        LOG.debug(newParagraphs[i]);
        LOG.debug("");
        LOG.debug("");
      }
    }
View Full Code Here

Examples of org.apache.chemistry.opencmis.util.content.loremipsum.LoremIpsum

    }
   
    @Test
    public void testGenerateLoreIpsumHtml1() {
      LOG.debug("Generate new Lore Ipsum as html paragraphs:");
      LoremIpsum ipsum = new LoremIpsum();
      String output = ipsum.generateParagraphsHtml(2048, true);
      LOG.debug(output);
      LOG.debug("");
    }
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.