Examples of StringConcatenation


Examples of org.eclipse.xtend2.lib.StringConcatenation

  }
 
  @Test
  public void testOptionSource() {
    try {
      StringConcatenation _builder = new StringConcatenation();
      _builder.append("target \"TP1\"");
      _builder.newLine();
      _builder.newLine();
      _builder.append("with source");
      _builder.newLine();
      _builder.newLine();
      _builder.append("location \"http://location.org/p2\" {");
      _builder.newLine();
      _builder.append("\t");
      _builder.append("an.iu");
      _builder.newLine();
      _builder.append("}");
      _builder.newLine();
      final TargetPlatform tp1 = this.parser.parse(_builder);
      final ResolvedTargetPlatform resolvedTargetPlatform = ResolvedTargetPlatform.create(tp1, this.indexBuilder);
      MockMetadataRepositoryManager _mockMetadataRepositoryManager = new MockMetadataRepositoryManager(new IQueryResultProvider<IInstallableUnit>() {
        public List<IInstallableUnit> listIUs(final URI location) {
          List<IInstallableUnit> _xifexpression = null;
          String _string = location.toString();
          boolean _equals = "http://location.org/p2".equals(_string);
          if (_equals) {
            Version _createOSGi = Version.createOSGi(1, 0, 0, "thequalifier");
            MockIU _mockIU = new MockIU("an.iu", _createOSGi);
            _xifexpression = CollectionLiterals.<IInstallableUnit>newImmutableList(_mockIU);
          } else {
            return CollectionLiterals.<IInstallableUnit>emptyList();
          }
          return _xifexpression;
        }
      });
      NullProgressMonitor _nullProgressMonitor = new NullProgressMonitor();
      resolvedTargetPlatform.resolve(_mockMetadataRepositoryManager, _nullProgressMonitor);
      final TargetDefinitionGenerator gen = new TargetDefinitionGenerator();
      final String content = gen.generate(resolvedTargetPlatform, 1);
      StringConcatenation _builder_1 = new StringConcatenation();
      _builder_1.append("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>");
      _builder_1.newLine();
      _builder_1.append("<?pde?>");
      _builder_1.newLine();
      _builder_1.append("<!-- generated with https://github.com/mbarbero/fr.obeo.releng.targetplatform -->");
      _builder_1.newLine();
      _builder_1.append("<target name=\"TP1\" sequenceNumber=\"1\">");
      _builder_1.newLine();
      _builder_1.append("  ");
      _builder_1.append("<locations>");
      _builder_1.newLine();
      _builder_1.append("    ");
      _builder_1.append("<location includeMode=\"slicer\" includeAllPlatforms=\"false\" includeSource=\"true\" includeConfigurePhase=\"false\" type=\"InstallableUnit\">");
      _builder_1.newLine();
      _builder_1.append("      ");
      _builder_1.append("<unit id=\"an.iu\" version=\"1.0.0.thequalifier\"/>");
      _builder_1.newLine();
      _builder_1.append("      ");
      _builder_1.append("<repository location=\"http://location.org/p2\"/>");
      _builder_1.newLine();
      _builder_1.append("    ");
      _builder_1.append("</location>");
      _builder_1.newLine();
      _builder_1.append("  ");
      _builder_1.append("</locations>");
      _builder_1.newLine();
      _builder_1.append("</target>");
      _builder_1.newLine();
      String _string = _builder_1.toString();
      Assert.assertEquals(_string, content);
    } catch (Throwable _e) {
      throw Exceptions.sneakyThrow(_e);
    }
  }
View Full Code Here

Examples of org.eclipse.xtend2.lib.StringConcatenation

                  EList<Option> _options = o.getOptions();
                  final Option it = _options.get(i);
                  Option _element = e.getElement();
                  boolean _equals = Objects.equal(_element, it);
                  if (_equals) {
                    StringConcatenation _builder = new StringConcatenation();
                    _builder.append("Cannot define multiple option \'");
                    _builder.append(it, "");
                    _builder.append("\'.");
                    TargetPlatformValidator.this.error(_builder.toString(), o, TargetPlatformPackage.Literals.OPTIONS__OPTIONS, i, TargetPlatformValidator.CHECK__NO_DUPLICATE_OPTIONS_OPTIONS);
                  }
                }
              }
            }
          };
View Full Code Here

Examples of org.eclipse.xtend2.lib.StringConcatenation

          };
          Iterable<IncludeDeclaration> _filter = IterableExtensions.<IncludeDeclaration>filter(_includes, _function);
          final Set<IncludeDeclaration> conflictualInclude = IterableExtensions.<IncludeDeclaration>toSet(_filter);
          final Procedure1<IncludeDeclaration> _function_1 = new Procedure1<IncludeDeclaration>() {
            public void apply(final IncludeDeclaration it) {
              StringConcatenation _builder = new StringConcatenation();
              _builder.append("ID \'");
              String _iD = location.getID();
              _builder.append(_iD, "");
              _builder.append("\' is duplicated in the included target platform");
              TargetPlatformValidator.this.error(_builder.toString(), it,
                TargetPlatformPackage.Literals.INCLUDE_DECLARATION__IMPORT_URI,
                TargetPlatformValidator.CHECK__LOCATION_ID_UNIQNESS);
            }
          };
          IterableExtensions.<IncludeDeclaration>forEach(conflictualInclude, _function_1);
View Full Code Here

Examples of org.eclipse.xtend2.lib.StringConcatenation

        }
      };
      final IncludeDeclaration cyclingImport = IterableExtensions.<IncludeDeclaration>findFirst(_includes, _function);
      boolean _notEquals = (!Objects.equal(cyclingImport, null));
      if (_notEquals) {
        StringConcatenation _builder = new StringConcatenation();
        _builder.append("Cycle detected in the included target platforms. Cycle is \'");
        Iterable<TargetPlatform> _drop = IterableExtensions.<TargetPlatform>drop(cycle, 1);
        final Function1<TargetPlatform, URI> _function_1 = new Function1<TargetPlatform, URI>() {
          public URI apply(final TargetPlatform it) {
            Resource _eResource = it.eResource();
            return _eResource.getURI();
          }
        };
        Iterable<URI> _map = IterableExtensions.<TargetPlatform, URI>map(_drop, _function_1);
        String _join = IterableExtensions.join(_map, "\'\' -> \'");
        _builder.append(_join, "");
        _builder.append("\'.");
        this.error(_builder.toString(), cyclingImport,
          TargetPlatformPackage.Literals.INCLUDE_DECLARATION__IMPORT_URI,
          TargetPlatformValidator.CHECK__INCLUDE_CYCLE);
      }
    }
  }
View Full Code Here

Examples of org.eclipse.xtend2.lib.StringConcatenation

              String _iD = it.getID();
              return Boolean.valueOf(externalIDs.contains(_iD));
            }
          };
          final Iterable<Location> externalLocationsWithConflictualID = IterableExtensions.<Location>filter(externalLocations, _function_4);
          StringConcatenation _builder = new StringConcatenation();
          _builder.append("The ID for location \'");
          _builder.append(locationURI, "");
          _builder.append("\' must be unique. Found \'");
          String _join = IterableExtensions.join(externalIDs, "\', \'");
          _builder.append(_join, "");
          _builder.append("\'  in \'");
          final Function1<Location, String> _function_5 = new Function1<Location, String>() {
            public String apply(final Location it) {
              Resource _eResource = it.eResource();
              URI _uRI = _eResource.getURI();
              return _uRI.toString();
            }
          };
          Iterable<String> _map_2 = IterableExtensions.<Location, String>map(externalLocationsWithConflictualID, _function_5);
          Set<String> _set = IterableExtensions.<String>toSet(_map_2);
          String _join_1 = IterableExtensions.join(_set, "\', \'");
          _builder.append(_join_1, "");
          _builder.append("\'.");
          final String msg = _builder.toString();
          final Function1<Location, Iterable<IncludeDeclaration>> _function_6 = new Function1<Location, Iterable<IncludeDeclaration>>() {
            public Iterable<IncludeDeclaration> apply(final Location location) {
              EList<IncludeDeclaration> _includes = targetPlatform.getIncludes();
              final Function1<IncludeDeclaration, Boolean> _function = new Function1<IncludeDeclaration, Boolean>() {
                public Boolean apply(final IncludeDeclaration it) {
                  boolean _xblockexpression = false;
                  {
                    final TargetPlatform direct = TargetPlatformValidator.this.indexBuilder.getImportedTargetPlatform(resource, it);
                    boolean _or = false;
                    EList<Location> _locations = direct.getLocations();
                    boolean _contains = _locations.contains(location);
                    if (_contains) {
                      _or = true;
                    } else {
                      LinkedList<TargetPlatform> _importedTargetPlatforms = TargetPlatformValidator.this.indexBuilder.getImportedTargetPlatforms(direct);
                      final Function1<TargetPlatform, EList<Location>> _function = new Function1<TargetPlatform, EList<Location>>() {
                        public EList<Location> apply(final TargetPlatform it) {
                          return it.getLocations();
                        }
                      };
                      List<EList<Location>> _map = ListExtensions.<TargetPlatform, EList<Location>>map(_importedTargetPlatforms, _function);
                      Iterable<Location> _flatten = Iterables.<Location>concat(_map);
                      Set<Location> _set = IterableExtensions.<Location>toSet(_flatten);
                      boolean _contains_1 = _set.contains(location);
                      _or = _contains_1;
                    }
                    _xblockexpression = _or;
                  }
                  return Boolean.valueOf(_xblockexpression);
                }
              };
              return IterableExtensions.<IncludeDeclaration>filter(_includes, _function);
            }
          };
          Iterable<Iterable<IncludeDeclaration>> _map_3 = IterableExtensions.<Location, Iterable<IncludeDeclaration>>map(externalLocationsWithConflictualID, _function_6);
          Iterable<IncludeDeclaration> _flatten = Iterables.<IncludeDeclaration>concat(_map_3);
          final Set<IncludeDeclaration> conflictualInclude = IterableExtensions.<IncludeDeclaration>toSet(_flatten);
          final Procedure1<IncludeDeclaration> _function_7 = new Procedure1<IncludeDeclaration>() {
            public void apply(final IncludeDeclaration it) {
              TargetPlatformValidator.this.error(msg, it,
                TargetPlatformPackage.Literals.INCLUDE_DECLARATION__IMPORT_URI,
                TargetPlatformValidator.CHECK__CONFLICTUAL_ID__BETWEEN_INCLUDED_LOCATION);
            }
          };
          IterableExtensions.<IncludeDeclaration>forEach(conflictualInclude, _function_7);
        }
        int _size_1 = externalIDs.size();
        boolean _equals = (_size_1 == 1);
        if (_equals) {
          final Sets.SetView<String> diff = Sets.<String>symmetricDifference(externalIDs, internalIDs);
          boolean _isEmpty = diff.isEmpty();
          boolean _not = (!_isEmpty);
          if (_not) {
            StringConcatenation _builder_1 = new StringConcatenation();
            _builder_1.append("The ID for location \'");
            _builder_1.append(locationURI, "");
            _builder_1.append("\' must be unique across included target platforms and the current one. Found \'");
            String _head = IterableExtensions.<String>head(externalIDs);
            _builder_1.append(_head, "");
            _builder_1.append("\'  in \'");
            final Function1<Location, String> _function_8 = new Function1<Location, String>() {
              public String apply(final Location it) {
                Resource _eResource = it.eResource();
                URI _uRI = _eResource.getURI();
                return _uRI.toString();
              }
            };
            Iterable<String> _map_4 = IterableExtensions.<Location, String>map(externalLocations, _function_8);
            Set<String> _set_1 = IterableExtensions.<String>toSet(_map_4);
            String _join_2 = IterableExtensions.join(_set_1, "\', \'");
            _builder_1.append(_join_2, "");
            _builder_1.append("\'.");
            _builder_1.newLineIfNotEmpty();
            final String msg_1 = _builder_1.toString();
            final Function1<Location, Boolean> _function_9 = new Function1<Location, Boolean>() {
              public Boolean apply(final Location it) {
                String _iD = it.getID();
                String _nullToEmpty = Strings.nullToEmpty(_iD);
                boolean _contains = externalIDs.contains(_nullToEmpty);
                return Boolean.valueOf((!_contains));
              }
            };
            Iterable<Location> _filter = IterableExtensions.<Location>filter(internalLocations, _function_9);
            final Procedure1<Location> _function_10 = new Procedure1<Location>() {
              public void apply(final Location it) {
                String _head = IterableExtensions.<String>head(externalIDs);
                Location _head_1 = IterableExtensions.<Location>head(externalLocations);
                String _uri = _head_1.getUri();
                TargetPlatformValidator.this.error(msg_1, it, TargetPlatformPackage.Literals.LOCATION__ID, TargetPlatformValidator.CHECK__INCLUDED_LOCATION_CONFLICTUAL_ID, _head, _uri);
              }
            };
            IterableExtensions.<Location>forEach(_filter, _function_10);
          }
        }
        boolean _and = false;
        int _size_2 = externalIDs.size();
        boolean _lessThan = (_size_2 < 1);
        if (!_lessThan) {
          _and = false;
        } else {
          int _size_3 = internalIDs.size();
          boolean _greaterThan_1 = (_size_3 > 1);
          _and = _greaterThan_1;
        }
        if (_and) {
          StringConcatenation _builder_2 = new StringConcatenation();
          _builder_2.append("The ID for location \'");
          _builder_2.append(locationURI, "");
          _builder_2.append("\' must be unique. Found \'");
          String _join_3 = IterableExtensions.join(internalIDs, "\', \'");
          _builder_2.append(_join_3, "");
          _builder_2.append("\'.");
          final String msg_2 = _builder_2.toString();
          final Procedure1<Location> _function_11 = new Procedure1<Location>() {
            public void apply(final Location it) {
              TargetPlatformValidator.this.error(msg_2, it, TargetPlatformPackage.Literals.LOCATION__ID, TargetPlatformValidator.CHECK__LOCATION_CONFLICTUAL_ID);
            }
          };
View Full Code Here

Examples of org.eclipse.xtend2.lib.StringConcatenation

  }
 
  @Test
  public void testEnvOS() {
    try {
      StringConcatenation _builder = new StringConcatenation();
      _builder.append("target \"TP1\"");
      _builder.newLine();
      _builder.newLine();
      _builder.append("environment Win32");
      _builder.newLine();
      final TargetPlatform tp1 = this.parser.parse(_builder);
      final ResolvedTargetPlatform resolvedTargetPlatform = ResolvedTargetPlatform.create(tp1, this.indexBuilder);
      final TargetDefinitionGenerator gen = new TargetDefinitionGenerator();
      final String content = gen.generate(resolvedTargetPlatform, 1);
      StringConcatenation _builder_1 = new StringConcatenation();
      _builder_1.append("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>");
      _builder_1.newLine();
      _builder_1.append("<?pde?>");
      _builder_1.newLine();
      _builder_1.append("<!-- generated with https://github.com/mbarbero/fr.obeo.releng.targetplatform -->");
      _builder_1.newLine();
      _builder_1.append("<target name=\"TP1\" sequenceNumber=\"1\">");
      _builder_1.newLine();
      _builder_1.append("  ");
      _builder_1.append("<environment>");
      _builder_1.newLine();
      _builder_1.append("    ");
      _builder_1.append("<os>win32</os>");
      _builder_1.newLine();
      _builder_1.append("  ");
      _builder_1.append("</environment>");
      _builder_1.newLine();
      _builder_1.append("</target>");
      _builder_1.newLine();
      String _string = _builder_1.toString();
      Assert.assertEquals(_string, content);
    } catch (Throwable _e) {
      throw Exceptions.sneakyThrow(_e);
    }
  }
View Full Code Here

Examples of org.eclipse.xtend2.lib.StringConcatenation

            if (_t instanceof Exception) {
              final Exception e = (Exception)_t;
              String _message = e.getMessage();
              boolean _isNullOrEmpty_1 = StringExtensions.isNullOrEmpty(_message);
              if (_isNullOrEmpty_1) {
                StringConcatenation _builder = new StringConcatenation();
                _builder.append("Error occured while loading p2 repository at \'");
                String _uri_2 = location.getUri();
                _builder.append(_uri_2, "");
                _builder.append("\'.");
                this.error(_builder.toString(), location, TargetPlatformPackage.Literals.LOCATION__URI, TargetPlatformValidator.CHECK__LOCATION_URI);
              } else {
                String _message_1 = e.getMessage();
                this.error(_message_1, location, TargetPlatformPackage.Literals.LOCATION__URI, TargetPlatformValidator.CHECK__LOCATION_URI);
              }
            } else {
View Full Code Here

Examples of org.eclipse.xtend2.lib.StringConcatenation

        NullProgressMonitor _nullProgressMonitor_1 = new NullProgressMonitor();
        IQueryResult<IInstallableUnit> _query = metadataRepository.query(_createIUQuery, _nullProgressMonitor_1);
        final Set<IInstallableUnit> idResults = _query.toUnmodifiableSet();
        boolean _isEmpty = idResults.isEmpty();
        if (_isEmpty) {
          StringConcatenation _builder = new StringConcatenation();
          _builder.append("No installable unit with ID \'");
          String _iD_1 = iu.getID();
          _builder.append(_iD_1, "");
          _builder.append("\' can be found in \'");
          Location _location_1 = iu.getLocation();
          String _uri_1 = _location_1.getUri();
          _builder.append(_uri_1, "");
          _builder.append("\'.");
          this.error(_builder.toString(), iu, TargetPlatformPackage.Literals.IU__ID, TargetPlatformValidator.CHECK__IU_IN_LOCATION);
        } else {
          boolean _and = false;
          String _version = iu.getVersion();
          boolean _isNullOrEmpty = StringExtensions.isNullOrEmpty(_version);
          boolean _not = (!_isNullOrEmpty);
          if (!_not) {
            _and = false;
          } else {
            String _version_1 = iu.getVersion();
            boolean _equals = "lazy".equals(_version_1);
            boolean _not_1 = (!_equals);
            _and = _not_1;
          }
          if (_and) {
            String _iD_2 = iu.getID();
            String _version_2 = iu.getVersion();
            VersionRange _versionRange = new VersionRange(_version_2);
            IQuery<IInstallableUnit> _createQuery = QueryUtil.createQuery("latest(x | x.id == $0 && x.version ~= $1)", _iD_2, _versionRange);
            NullProgressMonitor _nullProgressMonitor_2 = new NullProgressMonitor();
            final IQueryResult<IInstallableUnit> versionResult = metadataRepository.query(_createQuery, _nullProgressMonitor_2);
            boolean _isEmpty_1 = versionResult.isEmpty();
            if (_isEmpty_1) {
              StringConcatenation _builder_1 = new StringConcatenation();
              _builder_1.append("No installable unit with ID \'");
              String _iD_3 = iu.getID();
              _builder_1.append(_iD_3, "");
              _builder_1.append("\' can be found with range constraint \'");
              String _version_3 = iu.getVersion();
              _builder_1.append(_version_3, "");
              _builder_1.append("\'.");
              this.error(_builder_1.toString(), iu, TargetPlatformPackage.Literals.IU__VERSION, TargetPlatformValidator.CHECK__IU_IN_LOCATION);
            }
          }
        }
      } catch (final Throwable _t) {
        if (_t instanceof Exception) {
View Full Code Here

Examples of org.eclipse.xtend2.lib.StringConcatenation

  }
 
  @Test
  public void testEnvOSWin32WSWin32() {
    try {
      StringConcatenation _builder = new StringConcatenation();
      _builder.append("target \"TP1\"");
      _builder.newLine();
      _builder.newLine();
      _builder.append("environment Win32 wiN32");
      _builder.newLine();
      final TargetPlatform tp1 = this.parser.parse(_builder);
      final ResolvedTargetPlatform resolvedTargetPlatform = ResolvedTargetPlatform.create(tp1, this.indexBuilder);
      final TargetDefinitionGenerator gen = new TargetDefinitionGenerator();
      final String content = gen.generate(resolvedTargetPlatform, 1);
      StringConcatenation _builder_1 = new StringConcatenation();
      _builder_1.append("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>");
      _builder_1.newLine();
      _builder_1.append("<?pde?>");
      _builder_1.newLine();
      _builder_1.append("<!-- generated with https://github.com/mbarbero/fr.obeo.releng.targetplatform -->");
      _builder_1.newLine();
      _builder_1.append("<target name=\"TP1\" sequenceNumber=\"1\">");
      _builder_1.newLine();
      _builder_1.append("  ");
      _builder_1.append("<environment>");
      _builder_1.newLine();
      _builder_1.append("    ");
      _builder_1.append("<os>win32</os>");
      _builder_1.newLine();
      _builder_1.append("    ");
      _builder_1.append("<ws>win32</ws>");
      _builder_1.newLine();
      _builder_1.append("  ");
      _builder_1.append("</environment>");
      _builder_1.newLine();
      _builder_1.append("</target>");
      _builder_1.newLine();
      String _string = _builder_1.toString();
      Assert.assertEquals(_string, content);
    } catch (Throwable _e) {
      throw Exceptions.sneakyThrow(_e);
    }
  }
View Full Code Here

Examples of org.eclipse.xtend2.lib.StringConcatenation

          dupEnvIt.remove();
        }
      }
    }
    for (final String errorEnv : dupEnv) {
      StringConcatenation _builder = new StringConcatenation();
      _builder.append("\'");
      _builder.append(errorEnv, "");
      _builder.append("\' is not a valid environment specification value.");
      EList<String> _env_1 = env.getEnv();
      int _indexOf = _env_1.indexOf(errorEnv);
      this.error(_builder.toString(), env,
        TargetPlatformPackage.Literals.ENVIRONMENT__ENV, _indexOf, TargetPlatformValidator.CHECK__ENVIRONMENT_VALIDITY);
    }
  }
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.