Package com.sonyericsson.hudson.plugins.metadata.model.values

Examples of com.sonyericsson.hudson.plugins.metadata.model.values.StringMetadataValue


    public void testCleanGeneratedValues() throws Exception {
        TreeNodeMetadataValue[] treePath = TreeStructureUtil.createTreePath("generated", "root", "this", "is");
        treePath[0].setGenerated(false);
        TreeStructureUtil.getPath(treePath[0], "this").setGenerated(false);
        TreeStructureUtil.addValue(treePath[1], "Bouyah", "no description", "generated");
        treePath[0].addChild(new StringMetadataValue("keep", "valid"));
        TreeStructureUtil.addValue(treePath[0], "too", "", false, false, "and", "keep", "this");
        TreeStructureUtil.addValue(treePath[0], "yes", "no description", "remove");
        System.out.println(TreeStructureUtil.prettyPrint(treePath[0], ""));
        JobContributorsController.SaveableOperation operation = new JobContributorsController.SaveableOperation(
                mock(JobContributorsController.class), mock(AbstractProject.class), mock(User.class));
View Full Code Here


        FreeStyleBuild build = buildAndAssertSuccess(project);

        MetadataBuildAction action = build.getAction(MetadataBuildAction.class);
        assertNotNull(action);
        StringMetadataValue value = (StringMetadataValue)TreeStructureUtil.getPath(action, "build", "result");
        assertNotNull(value);
        assertEquals(Result.SUCCESS.toString(), value.getValue());
        assertNotNull(TreeStructureUtil.getPath(action, "build", "duration", "display"));
        NumberMetadataValue longValue = (NumberMetadataValue)TreeStructureUtil.getPath(action,
                "build", "duration", "ms");
        assertNotNull(longValue);
        Assert.assertThat(longValue.getValue(), greaterThanOrEqualTo(1000L));
View Full Code Here

        FreeStyleBuild build = buildAndAssertSuccess(project);
        MetadataBuildAction action = build.getAction(MetadataBuildAction.class);
        assertNotNull(action);

        StringMetadataValue buildValue = (StringMetadataValue)TreeStructureUtil.getPath(action, "tree", "string");
        StringMetadataValue jobValue = (StringMetadataValue)TreeStructureUtil.
                getPath(metadataJobProperty, "tree", "string");
        assertNotNull(buildValue);
        assertEquals(buildValue.getValue(), jobValue.getValue());
    }
View Full Code Here

     */
    public void testFilter() throws IOException {
        FreeStyleProject project = createFreeStyleProject();
        FreeStyleProject project2 = createFreeStyleProject();
        List<MetadataValue> list = new LinkedList<MetadataValue>();
        StringMetadataValue value = new StringMetadataValue("name", "description", "value");
        list.add(value);

        MetadataJobProperty property = project.getProperty(MetadataJobProperty.class);
        assertNotNull(property);
        property.addChildren(list);
View Full Code Here

     */
    public void testFilterACL() throws Exception {
        FreeStyleProject project = createFreeStyleProject("open");
        FreeStyleProject project2 = createFreeStyleProject("secure");
        List<MetadataValue> list = new LinkedList<MetadataValue>();
        StringMetadataValue value = new StringMetadataValue("name", "description", "value");
        list.add(value);
        MetadataJobProperty property = project.getProperty(MetadataJobProperty.class);
        property.addChildren(list);
        list = new LinkedList<MetadataValue>();
        value = new StringMetadataValue("name", "description", "value");
        list.add(value);
        MetadataJobProperty property2 = project2.getProperty(MetadataJobProperty.class);
        property2.addChildren(list);

        MetadataViewJobFilter filter = new MetadataViewJobFilter("name=value");
View Full Code Here

     */
    public void testSearchACL() throws Exception {
        FreeStyleProject project = createFreeStyleProject("open");
        FreeStyleProject project2 = createFreeStyleProject("secure");
        List<MetadataValue> list = new LinkedList<MetadataValue>();
        StringMetadataValue value = new StringMetadataValue("name", "description", "value");
        list.add(value);
        MetadataJobProperty property = project.getProperty(MetadataJobProperty.class);
        property.addChildren(list);
        list = new LinkedList<MetadataValue>();
        value = new StringMetadataValue("name", "description", "value");
        list.add(value);
        MetadataJobProperty property2 = project2.getProperty(MetadataJobProperty.class);
        property2.addChildren(list);

        //First search without ACL
View Full Code Here

        PluginImpl.getInstance().setDefinitions(list);
        FreeStyleProject freeStyleProject = createFreeStyleProject();
        configRoundtrip(freeStyleProject);
        MetadataJobProperty property = freeStyleProject.getProperty(MetadataJobProperty.class);
        assertNotNull("No MetadataJobProperty", property);
        StringMetadataValue choiceValue = (StringMetadataValue)TreeStructureUtil.getLeaf(property, "choices");
        assertNotNull(choiceValue);
        assertEquals("first", choiceValue.getValue());
    }
View Full Code Here

        PluginImpl.getInstance().setDefinitions(list);
        FreeStyleProject freeStyleProject = createFreeStyleProject();
        configRoundtrip(freeStyleProject);
        MetadataJobProperty property = freeStyleProject.getProperty(MetadataJobProperty.class);
        assertNotNull("No MetadataJobProperty", property);
        StringMetadataValue stringMetadataValue =
                (StringMetadataValue)TreeStructureUtil.getLeaf(property, "tree", "string");
        assertNotNull(stringMetadataValue);
        assertEquals("myValue", stringMetadataValue.getValue());
    }
View Full Code Here

    public void testGetStringValueForDefinition() {
        MetadataValueDefinitionHelper helper = new MetadataValueDefinitionHelper(values);
        MetadataDefinition definitionLeaf = TreeStructureUtil.getLeaf(startTreeNode, "child1", "child12");
        Object valueForDefinition = helper.getValueForDefinition(definitionLeaf);
        Assert.assertThat(valueForDefinition, instanceOf(StringMetadataValue.class));
        StringMetadataValue stringMetadataValue = (StringMetadataValue)valueForDefinition;
        assertThat(stringMetadataValue.getValue(), equalTo("nonDefaultVal"));
        assertThat(helper.getValues().size(), equalTo(0));
    }
View Full Code Here

    @Test
    public void testBuildEnvironmentFor() throws Exception {

        TreeNodeMetadataValue allShouldBeExposed = new TreeNodeMetadataValue("allExposed", "");
        allShouldBeExposed.setExposeToEnvironment(true);
        StringMetadataValue exposedParentExposed = new StringMetadataValue(
                "exposedParentExposed", "", "exposedParentExposedValue", true);
        StringMetadataValue notExposedParentExposed = new StringMetadataValue(
                "notExposedParentExposed", "", "notExposedParentExposedValue", false);
        allShouldBeExposed.addChild(exposedParentExposed);
        allShouldBeExposed.addChild(notExposedParentExposed);

        TreeNodeMetadataValue allShouldNotBeExposed = new TreeNodeMetadataValue("notAllExposed", "");
        StringMetadataValue exposedParentNotExposed = new StringMetadataValue(
                "exposedParentNotExposed", "", "exposedParentNotExposedValue", true);
        StringMetadataValue notExposedParentNotExposed = new StringMetadataValue(
                "notExposedParentNotExposed", "", "notExposedParentNotExposedValue", false);
        allShouldBeExposed.addChild(exposedParentExposed);
        allShouldBeExposed.addChild(notExposedParentExposed);
        allShouldNotBeExposed.addChild(exposedParentNotExposed);
        allShouldNotBeExposed.addChild(notExposedParentNotExposed);

        MetadataBuildAction buildAction = new MetadataBuildAction();
        buildAction.addChild(allShouldBeExposed);
        buildAction.addChild(allShouldNotBeExposed);

        AbstractBuild build = mock(AbstractBuild.class);
        when(build.getAction(MetadataBuildAction.class)).thenReturn(buildAction);

        MetadataEnvironmentContributor contributor = new MetadataEnvironmentContributor();
        EnvVars variables = new EnvVars();
        contributor.buildEnvironmentFor(build, variables, null);
        assertEquals(exposedParentExposed.getValue(), variables.get(exposedParentExposed.getEnvironmentName()));
        assertEquals(notExposedParentExposed.getValue(), variables.get(notExposedParentExposed.getEnvironmentName()));
        assertEquals(exposedParentNotExposed.getValue(), variables.get(exposedParentNotExposed.getEnvironmentName()));
        assertEquals(null, variables.get(notExposedParentNotExposed.getEnvironmentName()));

    }
View Full Code Here

TOP

Related Classes of com.sonyericsson.hudson.plugins.metadata.model.values.StringMetadataValue

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.