Package org.drools.repository

Examples of org.drools.repository.RulesRepository.loadPackage()


    assertTrue(mig.needsMigration(repo));
    mig.migrate(repo);
    assertFalse(repo.getSession().hasPendingChanges());
    assertFalse(mig.needsMigration(repo));
    pkg = repo.loadPackage("testMigratePackage");
    assertTrue(pkg.containsAsset("drools"));
    AssetItem as = pkg.loadAsset("drools");
    assertEquals("some header", as.getContent());

View Full Code Here


    String s = new String(a.getBinaryContentAsBytes());
    assertEquals("qed", s);
    assertEquals("a comment", a.getCheckinComment());
    assertEquals("xls", a.getFormat());

    List<AssetItem> assets = RulesRepositoryTest.iteratorToList(repo.loadPackage("testRestPost").listAssetsByFormat(new String[] {"drl", "xls"}));
    assertEquals(2, assets.size());

  }

    @Test
View Full Code Here

  public void testPostNewPackage() throws Exception {
    RulesRepository repo = RepositorySessionUtil.getRepository();
    RestAPI api = new RestAPI(repo);

    api.post("/packages/testPostNewPackage/.package", new ByteArrayInputStream("qaz".getBytes()), "This is a new package");
    PackageItem pkg = repo.loadPackage("testPostNewPackage");
    assertEquals("qaz", pkg.getStringProperty(PackageItem.HEADER_PROPERTY_NAME));

    assertEquals("This is a new package", pkg.getCheckinComment());
  }
View Full Code Here

    assertEquals("a new comment", asset2_.getCheckinComment());
    assertTrue(asset2_.getLastModified().after(cd));

    //now check updating the package header
    api.put("packages/testRestPut/.package", Calendar.getInstance(), new ByteArrayInputStream("whee".getBytes()), "hey");
    pkg = repo.loadPackage("testRestPut");
    assertEquals("whee", pkg.getStringProperty(PackageItem.HEADER_PROPERTY_NAME));

    try {
      api.put("packages/testRestPut/asset1.drl", cd, new ByteArrayInputStream("qaz".getBytes()), "a new comment");
      fail("should not be able to do this as it is stale timestamp.");
View Full Code Here

                                         data );

        fact.execute( action,
                      "some message" );

        PackageItem pk = repo.loadPackage( "testAddFiles.package" );
        AssetItem asset = pk.loadAsset( "someFile" );

        assertEquals( "drl",
                      asset.getFormat() );
        assertEquals( "this is content",
View Full Code Here

        String s = new String(a.getBinaryContentAsBytes());
        assertEquals("qed", s);
        assertEquals("a comment", a.getCheckinComment());
        assertEquals("xls", a.getFormat());

        List<AssetItem> assets = RulesRepositoryTest.iteratorToList(repo.loadPackage("testRestPost").listAssetsByFormat(new String[] {"drl", "xls"}));
        assertEquals(2, assets.size());

    }

    @Test
View Full Code Here

    public void testPostNewPackage() throws Exception {
        RulesRepository repo = RepositorySessionUtil.getRepository();
        RestAPI api = new RestAPI(repo);

        api.post("/packages/testPostNewPackage/.package", new ByteArrayInputStream("qaz".getBytes()), "This is a new package");
        PackageItem pkg = repo.loadPackage("testPostNewPackage");
        assertEquals("qaz", pkg.getStringProperty(PackageItem.HEADER_PROPERTY_NAME));

        assertEquals("This is a new package", pkg.getCheckinComment());
    }
View Full Code Here

        assertEquals("a new comment", asset2_.getCheckinComment());
        assertTrue(asset2_.getLastModified().after(cd));

        //now check updating the package header
        api.put("packages/testRestPut/.package", Calendar.getInstance(), new ByteArrayInputStream("whee".getBytes()), "hey");
        pkg = repo.loadPackage("testRestPut");
        assertEquals("whee", pkg.getStringProperty(PackageItem.HEADER_PROPERTY_NAME));

        try {
            api.put("packages/testRestPut/asset1.drl", cd, new ByteArrayInputStream("qaz".getBytes()), "a new comment");
            fail("should not be able to do this as it is stale timestamp.");
View Full Code Here

        assertTrue(mig.needsMigration(repo));
        mig.migrate(repo);
        assertFalse(repo.getSession().hasPendingChanges());
        assertFalse(mig.needsMigration(repo));
        pkg = repo.loadPackage("testMigratePackage");
        assertTrue(pkg.containsAsset("drools"));
        AssetItem as = pkg.loadAsset("drools");
        assertEquals("some header", as.getContent());

View Full Code Here

        //Create a history package with no compiled binary stored.
        pkg.checkout();
        pkg.checkin( "version1" );
        //Verify history package binary.
        PackageItem p = repo.loadPackage( "testGetHistoryPackageBinary",
                                          2 );
        assertEquals( "version1",
                      p.getCheckinComment() );
        assertFalse( p.isBinaryUpToDate() );
        byte[] result = p.getCompiledPackageBytes();
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.