Package com.volantis.mcs.assets

Examples of com.volantis.mcs.assets.AssetGroup


     * This method tests the method public MarinerURL rewriteAssetURL (
     * MarinerRequestContext,Asset,AssetGroup,MarinerURL ) for the
     * com.volantis.mcs.runtime.DefaultAssetURLRewriter class.
     */
    public void testRewriteAssetURLDynamicVisual() throws Exception {
        AssetGroup assetGroup = new AssetGroup("Default Group");
        MarinerURL url = new MarinerURL("http://test.com:8080/this=that");

        // Asset construction
        String value = "Dynamic Value";
        DynamicVisualAsset asset = new DynamicVisualAsset();
View Full Code Here


    /**
     * Test the rewriting with a text asset and complete url
     */
    public void testRewriteAssetURLTextAsset() throws Exception {
        AssetGroup assetGroup = new AssetGroup("Default Group");
        assetGroup.setProject(createProject("/base"));
        MarinerURL url = new MarinerURL("http://test.com:8080/this=that");

        TextAsset asset = new TextAsset("TestText");
        String expected = url.getExternalForm();

View Full Code Here

     * Test the rewriting with a valid assetgroup without an external repository.
     */
    public void testRewriteAssetURLComputeURLValidAssetGroup()
            throws Exception {
        // Asset group must not be null!
        AssetGroup assetGroup = new AssetGroup("Default Group");
        assetGroup.setProject(createProject("/base"));
        assetGroup.setPrefixURL("http://prefix/");

        MarinerURL url = new MarinerURL("this=that");
        TextAsset asset = new TextAsset("TestText");
        String expected = assetGroup.getPrefixURL() + url.getExternalForm();

        doRewriterTest(asset, assetGroup, url, expected);
    }
View Full Code Here

     * Test the rewriting with a valid assetgroup without an external repository
     * and with various combination of server/client side url's.
     */
    public void testRewriteAssetURLCompleteURLNoBaseURL() throws Exception {
        // Asset group must not be null!
        AssetGroup assetGroup = new AssetGroup("Default Group");
        assetGroup.setProject(createProject("/base"));

        MarinerURL url = new MarinerURL("http://test.com/this=that");
        TextAsset asset = new TextAsset("TestText");
        String expected = url.getExternalForm();

        // Test if this is a server side URL.
        assetGroup.setLocationType(AssetGroup.ON_SERVER);
        doRewriterTest(asset, assetGroup, url, expected);

        // Test non-relative path
        assetGroup.setLocationType(AssetGroup.ON_DEVICE);
        url = new MarinerURL("http://test.com/this=that");
        doRewriterTest(asset, assetGroup, url, expected);

        // Test if this is a client side URL.
        // This has been changed to being a device to ensure it is tested
        // as client side and not resolved to a full URL.  The test mcs-config
        // includes an absolute asset base URL for testing combinations of
        // rewrites and the previous code of using ON_SERVER failed. For
        // reader info rather than JavaDoc as this is a normal comment:
        // @see testRelativeAndAbsolutePaths()
        // @see com.volantis.testtools.config.ConfigFileBuilder.DEFAULT_ASSET_BASE_URL
        assetGroup.setLocationType(AssetGroup.ON_DEVICE);
        url = new MarinerURL("/test/this=that");
        expected = url.getExternalForm();
        doRewriterTest(asset, assetGroup, url, expected);
    }
View Full Code Here

    /**
     * Test the rewriting with a valid assetgroup without an external repository.
     */
    public void testRewriteAssetURLConvertibleImage() throws Exception {
        AssetGroup assetGroup = new AssetGroup("Default Group");
        assetGroup.setProject(createProject("/base"));

        MarinerURL url = new MarinerURL("http://host.com/this=that");
        ConvertibleImageAsset asset = new ConvertibleImageAsset("Test");
        asset.setEncoding(ConvertibleImageAsset.PNG);
        asset.setValue("/image.gif");
View Full Code Here

        TextAsset asset = new TextAsset("Default Asset");
        asset.setValue(assetURL);
        asset.setProject(project);

        // AssetGroup Prefix
        AssetGroup assetGroup = new AssetGroup("Default Group");
        assetGroup.setPrefixURL(assetGroupURL);
        assetGroup.setLocationType(AssetGroup.ON_SERVER);
        assetGroup.setProject(project);

        MarinerURL url = new MarinerURL(assetURL);

        doRewriterTest(asset, assetGroup, url, expected);
    }
View Full Code Here

                        new MarinerURL(sAsset.getName()),
                        assetGroupName,
                PolicyType.BASE_URL);

        Policy policy = policyFetcher.fetchPolicy(reference);
        AssetGroup group = null;
        if (policy == null) {
            logger.warn("asset-group-not-found",
                    new Object[]{reference.getName(), asset.getName()});
        } else {
            ActivatedBaseURLPolicy baseURL = (ActivatedBaseURLPolicy) policy;

            group = new AssetGroup();
            group.setProject(baseURL.getActualProject());
            group.setName(assetGroupName);
            group.setPrefixURL(baseURL.getBaseURL());

            final BaseLocation baseLocation = baseURL.getBaseLocation();
            if (baseLocation == BaseLocation.DEVICE) {
                group.setLocationType(AssetGroup.ON_DEVICE);
            } else if (baseLocation == BaseLocation.CONTEXT) {
                group.setLocationType(AssetGroup.CONTEXT);
            } else if (baseLocation == BaseLocation.HOST) {
                group.setLocationType(AssetGroup.HOST);
            }
        }

        return group;
    }
View Full Code Here

    /**
     * This tests the method getPropertyArray(String elementName, String attributeName)
     */
    public void testGetPropertyArray() throws Exception {
        AssetGroup assetGroup = new AssetGroup();
        Object[] expectedArray = PropertyValueLookUp.getPropertyArray(assetGroup.getClass(), "cacheThisPolicy");
        assertNotNull(expectedArray);
        Object[] testArray = PropertyValueLookUp.getPropertyArray("assetGroup", "cacheThisPolicy");
        assertNotNull(testArray);
        assertEquals(expectedArray.length, testArray.length);
        for (int i = 0; i < expectedArray.length; i++) {
View Full Code Here

    /**
     * This tests the method getExternalPropertyArray(String elementName, String attributeName)
     */
    public void testGetExternalPropertyArray() throws Exception {
        AssetGroup assetGroup = new AssetGroup();
        Object[] expectedArray = PropertyValueLookUp.getExternalPropertyArray(assetGroup.getClass(), "cacheThisPolicy");
        assertNotNull(expectedArray);
        Object[] testArray = PropertyValueLookUp.getExternalPropertyArray("assetGroup", "cacheThisPolicy");
        assertNotNull(testArray);
        assertEquals(expectedArray.length, testArray.length);
        for (int i = 0; i < expectedArray.length; i++) {
View Full Code Here

                    } else {
                        String[] srcArray = pageContext.
                                retrieveImageAssetURLAsString(imageAsset);
                        url = srcArray[0];

                        AssetGroup assetGroup =
                                assetResolver.getAssetGroup(imageAsset);
                        if (assetGroup != null) {
                            pattributes.setLocalSrc(AssetGroup.ON_DEVICE ==
                                    assetGroup.getLocationType());
                        } else {
                            pattributes.setLocalSrc(false);
                        }

                        // Make a note of whether this image is a convertible
View Full Code Here

TOP

Related Classes of com.volantis.mcs.assets.AssetGroup

Copyright © 2018 www.massapicom. 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.