Examples of ContentSource


Examples of org.fakereplace.client.ContentSource

    private void handleArtifact(final ZipFile zipFile, final Map<String, ResourceData> resources) {
        Enumeration<? extends ZipEntry> entries = zipFile.entries();
        while (entries.hasMoreElements()) {
            final ZipEntry entry = entries.nextElement();
            if (!entry.isDirectory()) {
                resources.put(entry.getName(), new ResourceData(entry.getName(), entry.getTime(), new ContentSource() {
                    @Override
                    public byte[] getData() throws IOException {
                        final InputStream stream = zipFile.getInputStream(entry);
                        try {
                            return Util.getBytesFromStream(stream);
View Full Code Here

Examples of org.rhq.core.domain.content.ContentSource

            // create a content source type and a content source
            ContentSourceType type = new ContentSourceType("testGetSyncResultsListCST");
            Set<ContentSourceType> types = new HashSet<ContentSourceType>();
            types.add(type);
            contentSourceMetadataManager.registerTypes(types); // this blows away any previous existing types
            ContentSource contentSource = new ContentSource("testGetSyncResultsListCS", type);
            contentSource = contentSourceManager.simpleCreateContentSource(overlord, contentSource);

            // make sure we have nothing yet
            PageList<ContentSourceSyncResults> list;
            list = contentSourceManager.getContentSourceSyncResults(overlord, contentSource.getId(),
                PageControl.getUnlimitedInstance());
            assert list.size() == 0 : "-->" + list;

            // create our first INPROGRESS result
            ContentSourceSyncResults results = new ContentSourceSyncResults(contentSource);
            results = contentSourceManager.persistContentSourceSyncResults(results);
            assert results != null;

            // make sure it persisted
            list = contentSourceManager.getContentSourceSyncResults(overlord, contentSource.getId(),
                PageControl.getUnlimitedInstance());
            assert list.size() == 1 : "-->" + list;
            assert list.get(0).getId() == results.getId() : "-->" + list;

            // try to create another INPROGRESS, this is not allowed so null must be returned by persist
            ContentSourceSyncResults another = new ContentSourceSyncResults(contentSource);
            another = contentSourceManager.persistContentSourceSyncResults(another);
            assert another == null : "Not allowed to have two INPROGRESS results persisted";

            // verify that we really did not persist a second one
            list = contentSourceManager.getContentSourceSyncResults(overlord, contentSource.getId(),
                PageControl.getUnlimitedInstance());
            assert list.size() == 1 : "-->" + list;
            assert list.get(0).getId() == results.getId() : "-->" + list;

            // try to create another but this one is a FAILURE, this is allowed
            another = new ContentSourceSyncResults(contentSource);
            another.setStatus(ContentSyncStatus.FAILURE);
            another.setEndTime(System.currentTimeMillis());
            another = contentSourceManager.persistContentSourceSyncResults(another);
            assert another != null : "Allowed to have two results persisted if only one is INPROGRESS";

            // verify that we really did persist a second one
            list = contentSourceManager.getContentSourceSyncResults(overlord, contentSource.getId(),
                PageControl.getUnlimitedInstance());
            assert list.size() == 2 : "-->" + list;
            assert list.get(0).getId() == another.getId() : "-->" + list;
            assert list.get(1).getId() == results.getId() : "-->" + list;

            // delete the content source and make sure we cascade delete the results
            contentSourceManager.deleteContentSource(overlord, contentSource.getId());

            list = contentSourceManager.getContentSourceSyncResults(overlord, contentSource.getId(),
                PageControl.getUnlimitedInstance());
            assert list.size() == 0 : "-->" + list;

            contentSourceMetadataManager.registerTypes(new HashSet<ContentSourceType>());
        } catch (Throwable t) {
View Full Code Here

Examples of org.rhq.core.domain.content.ContentSource

            type = contentSourceManager.getContentSourceType(type.getName());
            assert type != null;
            assert type.getId() > 0;

            // create content source
            ContentSource contentSource = new ContentSource("testMergeSyncReportCS", type);
            contentSource = contentSourceManager.simpleCreateContentSource(overlord, contentSource);
            assert contentSource != null;
            contentSourceId = contentSource.getId();
            assert contentSourceId > 0;

            // create a repo
            Repo repo = new Repo("testRepo");
            repo = repoManager.createRepo(overlord, repo);
View Full Code Here

Examples of org.rhq.core.domain.content.ContentSource

            // create content source type and content source
            ContentSourceType type = new ContentSourceType("testMergeSyncReportAMUCST");
            Set<ContentSourceType> types = new HashSet<ContentSourceType>();
            types.add(type);
            contentSourceMetadataManager.registerTypes(types); // this blows away any previous existing types
            ContentSource contentSource = new ContentSource("testMergeSyncReportAMUCS", type);
            contentSource.setLazyLoad(true);
            contentSource.setDownloadMode(DownloadMode.DATABASE);
            contentSource = contentSourceManager.simpleCreateContentSource(overlord, contentSource);
            contentSourceId = contentSource.getId();
            assert contentSourceId > 0;

            // create repo
            Repo repo = new Repo("testRepo");
            repo = repoManager.createRepo(overlord, repo);
View Full Code Here

Examples of org.rhq.core.domain.content.ContentSource

            // create content source type and content source and repo
            ContentSourceType type = new ContentSourceType("testMergeSyncReportAMU2CST");
            Set<ContentSourceType> types = new HashSet<ContentSourceType>();
            types.add(type);
            contentSourceMetadataManager.registerTypes(types); // this blows away any previous existing types
            ContentSource contentSource = new ContentSource("testMergeSyncReportAMU2CS", type);
            contentSource.setLazyLoad(true);
            contentSource.setDownloadMode(DownloadMode.DATABASE);
            contentSource = contentSourceManager.simpleCreateContentSource(overlord, contentSource);
            contentSourceId = contentSource.getId();
            assert contentSourceId > 0;

            Repo repo = new Repo("testMergeSyncReportAMU2Ch");
            repo = repoManager.createRepo(overlord, repo);
            repoId = repo.getId();
View Full Code Here

Examples of org.rhq.core.domain.content.ContentSource

    public void testDeleteContentSource() throws Exception {
        PageControl pc = PageControl.getUnlimitedInstance();
        // getTransactionManager().begin();
        try {
            ContentSourceType type = null;
            ContentSource contentSource = null;

            int csTypeCount = contentSourceManager.getAllContentSourceTypes().size();
            List csList = contentSourceManager.getAllContentSources(overlord, pc);
            int csCount = contentSourceManager.getAllContentSources(overlord, pc).size();

            // create the content source type
            type = new ContentSourceType("testDel-" + RandomStringUtils.randomAlphanumeric(6));

            Set<ContentSourceType> types = new HashSet<ContentSourceType>();
            types.add(type);
            contentSourceMetadataManager.registerTypes(types); // this blows away any previous existing types
            type = contentSourceManager.getContentSourceType(type.getName());
            assert type != null;
            assert type.getId() > 0;

            // test the getAll API
            assert (csTypeCount + 1) == contentSourceManager.getAllContentSourceTypes().size();

            // create the content source
            contentSource = new ContentSource("testDel-" + RandomStringUtils.randomAlphanumeric(6), type);
            contentSource = contentSourceManager.simpleCreateContentSource(overlord, contentSource);
            assert contentSource != null;
            int contentSourceId = contentSource.getId();
            assert contentSourceId > 0;

            // test the getAll API
            assert (csCount + 1) == contentSourceManager.getAllContentSources(overlord, pc).size();
View Full Code Here

Examples of org.rhq.core.domain.content.ContentSource

    @Test(enabled = TESTS_ENABLED)
    public void testUpdateContentSourceNoConfig() throws Exception {
        try {
            ContentSourceType type = null;
            ContentSource contentSource = null;

            // create the content source type
            type = new ContentSourceType("testUpdateContentSourceCST");
            Set<ContentSourceType> types = new HashSet<ContentSourceType>();
            types.add(type);
            contentSourceMetadataManager.registerTypes(types); // this blows away any previous existing types
            type = contentSourceManager.getContentSourceType(type.getName());
            assert type != null;
            assert type.getId() > 0;

            // create the content source - note it doesn't have any config yet
            contentSource = new ContentSource("testUpdateContentSource", type);
            contentSource = contentSourceManager.simpleCreateContentSource(overlord, contentSource);
            assert contentSource != null;
            int contentSourceId = contentSource.getId();
            assert contentSourceId > 0;

            // now update its description
            ContentSource loaded = contentSourceManager.getContentSource(overlord, contentSourceId);
            assert loaded != null : "should exist";
            assert loaded.getDescription() == null;
            loaded.setDescription("new updated description");
            loaded = contentSourceManager.updateContentSource(overlord, loaded, false);
            assert loaded != null : "should have been updated";
            loaded = contentSourceManager.getContentSource(overlord, contentSourceId);
            assert loaded.getDescription().equals("new updated description");

            // now give it a config
            assert loaded.getConfiguration() == null : "should not have a config yet";
            Configuration config = new Configuration();
            config.put(new PropertySimple("updateCSName", "updateCSValue"));
            loaded.setConfiguration(config);
            loaded = contentSourceManager.updateContentSource(overlord, loaded, false);
            assert loaded != null : "should have been updated";
            config = loaded.getConfiguration();
            assert config != null : "should have a config now";
            assert config.getSimple("updateCSName").getStringValue().equals("updateCSValue") : config;
            assert loaded.getDescription().equals("new updated description") : "desc should still be there";

            // delete the content source
            contentSourceManager.deleteContentSource(overlord, contentSourceId);
            assert null == contentSourceManager.getContentSource(overlord, contentSourceId) : "should have been deleted";
        } catch (Exception e) {
View Full Code Here

Examples of org.rhq.core.domain.content.ContentSource

    @Test(enabled = TESTS_ENABLED)
    public void testUpdateContentSourceConfig() throws Exception {
        try {
            ContentSourceType type = null;
            ContentSource contentSource = null;

            // create the content source type
            type = new ContentSourceType("testUpdateContentSourceCST2");
            Set<ContentSourceType> types = new HashSet<ContentSourceType>();
            types.add(type);
            contentSourceMetadataManager.registerTypes(types); // this blows away any previous existing types
            type = contentSourceManager.getContentSourceType(type.getName());
            assert type != null;
            assert type.getId() > 0;

            // create the content source - note it has a config that should be persisted
            Configuration config = new Configuration();
            config.put(new PropertySimple("updateCSName", "updateCSValue"));
            contentSource = new ContentSource("testUpdateContentSource2", type);
            contentSource.setConfiguration(config);
            contentSource = contentSourceManager.simpleCreateContentSource(overlord, contentSource);
            assert contentSource != null;
            int contentSourceId = contentSource.getId();
            assert contentSourceId > 0;

            // now update its config
            ContentSource loaded = contentSourceManager.getContentSource(overlord, contentSourceId);
            assert loaded != null : "should exist";
            assert loaded.getConfiguration() != null;
            assert loaded.getConfiguration().getSimple("updateCSName").getStringValue().equals("updateCSValue");
            loaded.getConfiguration().getSimple("updateCSName").setStringValue("UPDATED");
            loaded = contentSourceManager.updateContentSource(overlord, loaded, false);
            assert loaded != null : "should have been updated";
            assert loaded.getConfiguration() != null;
            assert loaded.getConfiguration().getSimple("updateCSName").getStringValue().equals("UPDATED");
            loaded = contentSourceManager.getContentSource(overlord, contentSourceId);
            assert loaded != null : "should exist";
            assert loaded.getConfiguration() != null;
            assert loaded.getConfiguration().getSimple("updateCSName").getStringValue().equals("UPDATED");

            // now delete its config
            loaded.setConfiguration(null);
            loaded = contentSourceManager.updateContentSource(overlord, loaded, false);
            assert loaded != null : "should have been updated";
            assert loaded.getConfiguration() == null : "config should be null -> " + loaded.getConfiguration();

            // delete the content source
            contentSourceManager.deleteContentSource(overlord, contentSourceId);
            assert null == contentSourceManager.getContentSource(overlord, contentSourceId) : "should have been deleted";
        } catch (Exception e) {
View Full Code Here

Examples of org.rhq.core.domain.content.ContentSource

    }

    @Test(enabled = TESTS_ENABLED)
    public void testConstraintViolation() throws Exception {
        ContentSourceType type = null;
        ContentSource contentSource = null;

        try {
            type = new ContentSourceType("testConstraintViolationCST");
            Set<ContentSourceType> types = new HashSet<ContentSourceType>();
            types.add(type);
            contentSourceMetadataManager.registerTypes(types); // this blows away any previous existing types
            type = contentSourceManager.getContentSourceType(type.getName());
            assert type != null;
            assert type.getId() > 0;
            contentSource = new ContentSource("testConstraintViolation", type);
            contentSource = contentSourceManager.simpleCreateContentSource(overlord, contentSource);
            assert contentSource != null;
            int contentSourceId = contentSource.getId();
            assert contentSourceId > 0;

            ContentSource dup = new ContentSource("testConstraintViolation", type);

            try {
                contentSourceManager.simpleCreateContentSource(overlord, dup);
                assert false : "Should not have been able to create the same content source";
            } catch (Exception expected) {
View Full Code Here

Examples of org.rhq.core.domain.content.ContentSource

     */
    @Test(enabled = TESTS_ENABLED)
    public void testMergeWithRepo() throws Exception {
        try {
            ContentSourceType type = null;
            ContentSource contentSource = null;

            // create the content source type
            type = new ContentSourceType("testMergeWithRepoCST");
            Set<ContentSourceType> types = new HashSet<ContentSourceType>();
            types.add(type);
            contentSourceMetadataManager.registerTypes(types); // this blows away any previous existing types
            type = contentSourceManager.getContentSourceType(type.getName());
            assert type != null;
            assert type.getId() > 0;

            // create the content source
            contentSource = new ContentSource("testMergeWithRepoCS", type);
            contentSource = contentSourceManager.simpleCreateContentSource(overlord, contentSource);
            assert contentSource != null;
            int contentSourceId = contentSource.getId();
            assert contentSourceId > 0;

            // create a repo and associate the new content source with it
            Repo repo = new Repo("testMergeWithRepo");
            repo = repoManager.createRepo(overlord, repo);
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.