@Override
    public void setConfigAttributes(Object attributes) {
        clear();
        if (attributes == null) {
            return;
        }
        List<Map> attrList = (List<Map>) attributes;
        for (Map attrMap : attrList) {
            String type = (String) attrMap.get("artifactTypeValue");
            if (TestArtifactConfig.TEST_PLAN_DISPLAY_NAME.equals(type) || BuildArtifactConfig.ARTIFACT_PLAN_DISPLAY_NAME.equals(type)) {
                String source = (String) attrMap.get(BuiltinArtifactConfig.SRC);
                String destination = (String) attrMap.get(BuiltinArtifactConfig.DEST);
                if (source.trim().isEmpty() && destination.trim().isEmpty()) {
                    continue;
                }
                if (TestArtifactConfig.TEST_PLAN_DISPLAY_NAME.equals(type)) {
                    this.add(new TestArtifactConfig(source, destination));
                } else {
                    this.add(new BuildArtifactConfig(source, destination));
                }

            } else {
                String artifactId = (String) attrMap.get(PluggableArtifactConfig.ID);
                String storeId = (String) attrMap.get(PluggableArtifactConfig.STORE_ID);
                String pluginId = (String) attrMap.get("pluginId");
                Map<String, Object> userSpecifiedConfiguration = (Map<String, Object>) attrMap.get("configuration");
                PluggableArtifactConfig pluggableArtifactConfig = new PluggableArtifactConfig(artifactId, storeId);
                this.add(pluggableArtifactConfig);
                if (userSpecifiedConfiguration == null) {
                    return;
                }

                if (StringUtils.isBlank(pluginId)) {
                    Configuration configuration = pluggableArtifactConfig.getConfiguration();

                    for (String key : userSpecifiedConfiguration.keySet()) {
                        Map<String, String> configurationMetadata = (Map<String, String>) userSpecifiedConfiguration.get(key);
                        if (configurationMetadata != null) {
                            boolean isSecure = Boolean.parseBoolean(configurationMetadata.get("isSecure"));
                            if (configuration.getProperty(key) == null) {
                                configuration.addNewConfiguration(key, isSecure);
                            }
                            if (isSecure) {
                                configuration.getProperty(key).setEncryptedValue(new EncryptedConfigurationValue(configurationMetadata.get("value")));
                            } else {
                                configuration.getProperty(key).setConfigurationValue(new ConfigurationValue(configurationMetadata.get("value")));
                            }
                        }
                    }
                } else {
                    for (Map.Entry<String, Object> configuration : userSpecifiedConfiguration.entrySet()) {
                        pluggableArtifactConfig.getConfiguration().addNewConfigurationWithValue(configuration.getKey(), String.valueOf(configuration.getValue()), false);
                    }
                }
            }
        }
    }
@Test
    public void shouldClearAllArtifactsWhenTheMapIsNull() {
        ArtifactTypeConfigs artifactTypeConfigs = new ArtifactTypeConfigs();
        artifactTypeConfigs.add(new BuildArtifactConfig("src", "dest"));

        artifactTypeConfigs.setConfigAttributes(null);

        assertThat(artifactTypeConfigs.size(), is(0));
    }