Examples of Item


Examples of org.hibernate.search.test.configuration.Item

  }

  private void storeDemoData(FullTextSessionBuilder builder) {
    FullTextSession fullTextSession = builder.openFullTextSession();
    Transaction transaction = fullTextSession.beginTransaction();
    Item ssd = new Item();
    ssd.setDescription( "intel solid state disk" );
    Item wd = new Item();
    wd.setDescription( "western digital hibrid disk" );
    fullTextSession.persist( ssd );
    fullTextSession.persist( wd );
    transaction.commit();
    fullTextSession.close();
  }
View Full Code Here

Examples of org.hibernate.test.cache.infinispan.functional.Item

      ctx.close();
      jndiServer.stop();
   }

   public void testPersistAndLoadUnderJta() throws Exception {
      Item item;
      SessionFactory sessionFactory = buildSessionFactory();
      try {
         UserTransaction ut = (UserTransaction) ctx.lookup("UserTransaction");
         ut.begin();
         try {
            Session session = sessionFactory.openSession();
            session.getTransaction().begin();
            item = new Item("anItem", "An item owned by someone");
            session.persist(item);
            session.getTransaction().commit();
            session.close();
         } catch(Exception e) {
            ut.setRollbackOnly();
            throw e;
         } finally {
            if (ut.getStatus() == Status.STATUS_ACTIVE)
               ut.commit();
            else
               ut.rollback();
         }

         ut = (UserTransaction) ctx.lookup("UserTransaction");
         ut.begin();
         try {
            Session session = sessionFactory.openSession();
            session.getTransaction().begin();
            Item found = (Item) session.load(Item.class, item.getId());
            Statistics stats = session.getSessionFactory().getStatistics();
            log.info(stats.toString());
            assertEquals(item.getDescription(), found.getDescription());
            assertEquals(0, stats.getSecondLevelCacheMissCount());
            assertEquals(1, stats.getSecondLevelCacheHitCount());
            session.delete(found);
            session.getTransaction().commit();
            session.close();
View Full Code Here

Examples of org.hibernate.test.domain.Item

        sessionFactory.getCache().evictEntityRegion(Item.class);

        Session s = sessionFactory.openSession();
        Transaction t = s.beginTransaction();
        Item i = new Item();
        i.setName("Widget");
        i.setDescription("A realy top-quality, full-featured widget.");
        s.persist(i);
        t.commit();
        s.close();


        SecondLevelCacheStatistics slcs = getSecondLevelCacheStatistics(Item.class);
        log.info(slcs.toString());

        Session session = sessionFactory.openSession();
        Item loaded = (Item) session.get(Item.class, i.getId());
        assertThat(loaded).isNotNull();
        session.close();

        log.info(slcs.toString());
        assertThat(slcs.getPutCount()).isEqualTo(1);
View Full Code Here

Examples of org.hibernate.test.jpa.Item

      return;
    }
    String check = "EJB3 Specification";
    Session s1 = getSessions().openSession();
    Transaction t1 = s1.beginTransaction();
    Item item = new Item( check );
    s1.saveitem );
    t1.commit();
    s1.close();

    Long itemId = item.getId();
    long initialVersion = item.getVersion();

    // Now, open a new Session and re-load the item...
    s1 = getSessions().openSession();
    t1 = s1.beginTransaction();
    item = ( Item ) s1.get( Item.class, itemId );

    // now that the item is associated with the persistence-context of that session,
    // open a new session and modify it "behind the back" of the first session
    Session s2 = getSessions().openSession();
    Transaction t2 = s2.beginTransaction();
    Item item2 = ( Item ) s2.get( Item.class, itemId );
    item2.setName( "EJB3 Persistence Spec" );
    t2.commit();
    s2.close();

    // at this point, s1 now contains stale data, so try an hql query which
    // returns said item and make sure we get the previously associated state
    // (i.e., the old name and the old version)
    item2 = ( Item ) s1.createQuery( "select i from Item i" ).list().get( 0 );
    assertTrue( item == item2 );
    assertEquals( "encountered non-repeatable read", check, item2.getName() );
    assertEquals( "encountered non-repeatable read", initialVersion, item2.getVersion() );

    t1.commit();
    s1.close();

    // clean up
View Full Code Here

Examples of org.jabber.protocol.disco_items.Item

        answer.getShowOrStatusOrPriority().add(x);
        transport.marshall(answer);
    }

    protected Item createItem(String jid, String name, String node) {
        Item answer = new Item();
        answer.setJid(jid);
        answer.setName(name);
        answer.setNode(node);
        return answer;
    }
View Full Code Here

Examples of org.jahia.services.uicomponents.bean.toolbar.Item

        }
        String title = itemTitle;


        // create the toolitem
        Item item = new Item();
        item.setTitle(title);
        item.setActionItem(new RedirectWindowActionItem());
        item.setDisplayTitle(true);

        // add url property
        Property property = new Property();
        property.setName("js.url");
        property.setValue(jsParamName);
        item.addProperty(property);




        return item;
View Full Code Here

Examples of org.javalite.activejdbc.test_models.Item

public class OptimisticLockingOverrideVersionColumnTest extends ActiveJDBCTest {

    @Test
    public void shouldSetVersionToOneWhenCreatingNewRecord(){
        deleteAndPopulateTable("items");
        Item m = new Item();
        m.set("item_number", 1);
        m.set("item_description", "descr 1");
        m.saveIt();
        Item m1 = Item.findById(1);
        a(m1.get("lock_version")).shouldBeEqual(1);
    }
View Full Code Here

Examples of org.jboss.as.quickstarts.cdi.service.Item

    @EJB
    private ItemServiceBean itemService;

    @Test
    public void testAuditInterceptor() {
        Item item = new Item();
        item.setName("testItem");
        itemService.create(item);
        item = itemService.getList().get(0);
        // assert that no history entries were added since interceptors are disabled
        assertEquals(0, History.getItemHistory().size());
    }
View Full Code Here

Examples of org.jboss.errai.demo.grocery.client.shared.Item

    // TODO (after ERRAI-366): make this method package-private
    @EventHandler("saveButton")
    public void onSaveButtonClicked(ClickEvent event) {
        Department resolvedDepartment = Department.resolve(em, department.getText());
        Item item = itemBinder.getModel();
        item.setDepartment(resolvedDepartment);
        item.setAddedBy(user);
        item.setAddedOn(new Date());

        final Set<ConstraintViolation<Item>> violations = validator.validate(item);
        if (violations.size() > 0) {
          ConstraintViolation<Item> violation = violations.iterator().next();
          overallErrorMessage.setText(violation.getPropertyPath() + " " + violation.getMessage());
View Full Code Here

Examples of org.jboss.ide.eclipse.freemarker.model.Item

  protected void assertListEnd(Iterator<Item> i) {
    assertDirective(i, ListEndDirective.class);
  }

  protected void assertDirective(Iterator<Item> i, Class<?> cl) {
    Item item;
    item = i.next();
    assertEquals(cl, item.getClass());
    assertEquals(0, item.getChildItems().size());
  }
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.