Пример #1
0
 public void setDateTo(Project obj, int index) {
   Calendar calendar = Calendar.getInstance();
   calendar.setTime(obj.getDateFrom());
   calendar.add(Calendar.DAY_OF_YEAR, 1 + index % 10);
   Date dateTo = calendar.getTime();
   obj.setDateTo(dateTo);
 }
Пример #2
0
 /** Test the makeUntitledProject() function. */
 public void testMakeUntitledProject() {
   Project p = ProjectManager.getManager().getCurrentProject();
   assertEquals(2, p.getDiagrams().size());
   assertEquals("untitledModel", Model.getFacade().getName(p.getModel()));
   // maybe next test is going to change in future
   assertEquals(p.getRoot(), p.getModel());
 }
Пример #3
0
 public ArrayList<Project> getProjectsWithoutDetails()
     throws java.rmi.RemoteException, SQLException {
   ResultSet result =
       connection.createStatement().executeQuery("Select * from Projects where active = 1");
   ArrayList<Project> projects = new ArrayList<Project>();
   DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
   while (result.next()) {
     try {
       Date projectDate = format.parse(result.getString(3));
       Project p =
           new Project(
               result.getString(2),
               projectDate,
               result.getDouble(4),
               result.getString(5),
               result.getBoolean(6));
       int projectId = result.getInt(1);
       p.setId(projectId);
       projects.add(p);
     } catch (ParseException e) {
       e.printStackTrace();
     }
   }
   System.out.println("Get Projects without Details Executed");
   return projects;
 }
Пример #4
0
  /* method initializes Issue fields */
  private Issue initIssue(HttpServletRequest req, String issueID) throws LogicException {
    FeatureLogic fl = new FeatureLogic();
    IssueLogic il = new IssueLogic();
    Project project = new Project();
    Build build = new Build();
    HttpSession session = req.getSession(false);
    Member modifiedBy = (Member) session.getAttribute("member");
    project.setId(Integer.parseInt(req.getParameter(PARAM_PROJECT)));
    build.setId(Integer.parseInt(req.getParameter(PARAM_BUILD)));

    Issue issue = il.issueToView(Integer.parseInt(issueID));
    issue.setModifiedBy(modifiedBy);
    issue.setSummary(req.getParameter(PARAM_SUMMARY));
    issue.setDescription(req.getParameter(PARAM_DESC));
    issue.setStatus(fl.findFeature(STATUS, Integer.parseInt(req.getParameter(PARAM_STATUS))));
    issue.setType(fl.findFeature(TYPE, Integer.parseInt(req.getParameter(PARAM_TYPE))));
    issue.setPriority(fl.findFeature(PRIORITY, Integer.parseInt(req.getParameter(PARAM_PRIORITY))));
    issue.setProject(project);
    issue.setBuild(build);
    if (req.getParameter(PARAM_ASSIGNEE) != null) {
      Member member = new Member();
      member.setId(Integer.parseInt(req.getParameter(PARAM_ASSIGNEE)));
      issue.setAssignee(member);
    }
    return issue;
  }
Пример #5
0
  /**
   * Test deleting a package with a Class with a Activity diagram. The diagram should be deleted,
   * too.
   */
  public void testDeletePackageWithClassWithActivityDiagram() {
    Project p = ProjectManager.getManager().getCurrentProject();
    assertEquals(2, p.getDiagrams().size());

    int sizeMembers = p.getMembers().size();
    int sizeDiagrams = p.getDiagrams().size();

    // test with a package and a class and activity diagram
    Object package1 = Model.getModelManagementFactory().buildPackage("test1", null);
    Object aClass = Model.getCoreFactory().buildClass(package1);

    // build the Activity Diagram
    Object actgrph = Model.getActivityGraphsFactory().buildActivityGraph(aClass);
    UMLActivityDiagram d = new UMLActivityDiagram(Model.getFacade().getNamespace(actgrph), actgrph);
    p.addMember(d);
    assertEquals(sizeDiagrams + 1, p.getDiagrams().size());
    assertEquals(sizeMembers + 1, p.getMembers().size());

    p.moveToTrash(package1);

    assertTrue("Class not in trash", Model.getUmlFactory().isRemoved(aClass));
    assertTrue("ActivityGraph not in trash", Model.getUmlFactory().isRemoved(actgrph));
    assertEquals(sizeDiagrams, p.getDiagrams().size());
    assertEquals(sizeMembers, p.getMembers().size());
  }
  @Test
  public void testGetRecsPerImage() throws DatabaseException {
    Project census = new Project("census", 2, 3, 4, 5);
    dbProjects.add(census);

    assertEquals(dbProjects.getRecsPerImage(census.getId()), 2);
  }
  @Test
  public void testAdd() throws DatabaseException {

    Project census = new Project("census", 2, 3, 4, 5);
    Project births = new Project("births", 6, 7, 8, 9);

    dbProjects.add(census);
    dbProjects.add(births);

    List<Project> all = dbProjects.getAll();
    assertEquals(2, all.size());

    boolean foundAge = false;
    boolean foundPlace = false;

    for (Project p : all) {

      assertFalse(p.getId() == -1);

      if (!foundAge) {
        foundAge = areEqual(p, census, false);
      }
      if (!foundPlace) {
        foundPlace = areEqual(p, births, false);
      }
    }

    assertTrue(foundAge && foundPlace);
  }
Пример #8
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    final Project project = getItem(position);

    if (convertView == null) {
      convertView =
          LayoutInflater.from(getContext())
              .inflate(R.layout.activity_custom_project_listview, parent, false);
    }

    TextView projectName = (TextView) convertView.findViewById(R.id.projectNameTextView);
    TextView partnerCount = (TextView) convertView.findViewById(R.id.partnerCountTextView);

    projectName.setText(project.getProjectName());
    partnerCount.setText(
        Integer.toString(project.getPartnerCount())
            + " Partner"
            + (project.getPartnerCount() == 1 ? "" : "s"));
    convertView.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            Intent intent = new Intent(getContext(), ProjectHost.class);
            intent.putExtra("ProjectTitle", project.getProjectName());
            intent.putExtra("BasePath", project.getFilepath());
            // intent.putExtra("TopicSubject",topic.getTopicTitle());
            // intent.putExtra("BoardId", topic.getOnBoard());
            // intent.putExtra("UserId", UserId);
            mContext.startActivity(intent);
          }
        });
    return convertView;
  }
Пример #9
0
 @Test
 public void testGetters() {
   assertEquals(ID, project.getId());
   assertEquals(NAME, project.getName());
   assertEquals(SHORT_NAME, project.getShortName());
   assertEquals(DESCRIPTION, project.getDescription());
 }
  // Get details of Task/Card/Story
  @RequestMapping(value = "/{userId}/edit/{type}/{typeId}", method = RequestMethod.GET)
  public String getTypeDetails(
      @ModelAttribute("project") Project project,
      @PathVariable Long userId,
      @PathVariable String type,
      @PathVariable Long typeId,
      ModelMap model) {

    if (type.contentEquals("story")) {
      List ls = userDao.getStoryById(typeId);
      Story s = (Story) ls.get(0);
      model.addAttribute("story", s);
    } else if (type.contentEquals("cards")) {
      List lc = userDao.getCardById(typeId);
      Card c = (Card) lc.get(0);
      model.addAttribute("cards", c);
    } else if (type.contentEquals("tasks")) {
      List lt = userDao.getTaskById(typeId);
      Task t = (Task) lt.get(0);
      model.addAttribute("tasks", t);
    }

    List p = userDao.getProjectById(userId);
    Project ps = (Project) p.get(0);
    model.addAttribute("project", ps.getProjectname());
    model.addAttribute("type", type);
    model.addAttribute("userid", userId);
    return "Details";
  }
Пример #11
0
  /*
   * Launches against the agent& main
   */
  public void testAgentAndMain() throws Exception {
    Project project = workspace.getProject("p1");
    Run bndrun = new Run(workspace, project.getBase(), project.getFile("one.bndrun"));
    bndrun.setProperty("-runpath", "biz.aQute.remote.launcher");
    bndrun.setProperty("-runbundles", "bsn-1,bsn-2");
    bndrun.setProperty("-runremote", "agent,main;agent=1090");

    final RemoteProjectLauncherPlugin pl =
        (RemoteProjectLauncherPlugin) bndrun.getProjectLauncher();
    pl.prepare();

    List<? extends RunSession> sessions = pl.getRunSessions();
    assertEquals(2, sessions.size());

    RunSession agent = sessions.get(0);
    RunSession main = sessions.get(1);

    CountDownLatch agentLatch = launch(agent);
    CountDownLatch mainLatch = launch(main);

    agent.waitTillStarted(1000);
    main.waitTillStarted(1000);
    Thread.sleep(500);

    agent.cancel();
    main.cancel();

    agentLatch.await();
    mainLatch.await();
    assertEquals(-3, agent.getExitCode());
    assertEquals(-3, main.getExitCode());

    bndrun.close();
  }
Пример #12
0
  /**
   * Return the this if this is anything else but a library. If it is a library, return the members.
   * This could work recursively, e.g., libraries can point to libraries.
   *
   * @throws Exception
   */
  public List<Container> getMembers() throws Exception {
    List<Container> result = project.newList();

    // Are ww a library? If no, we are the result
    if (getType() == TYPE.LIBRARY) {
      // We are a library, parse the file. This is
      // basically a specification clause per line.
      // I.e. you can do bsn; version, bsn2; version. But also
      // spread it out over lines.
      InputStream in = null;
      BufferedReader rd = null;
      String line;
      try {
        in = new FileInputStream(getFile());
        rd = new BufferedReader(new InputStreamReader(in, Constants.DEFAULT_CHARSET));
        while ((line = rd.readLine()) != null) {
          line = line.trim();
          if (!line.startsWith("#") && line.length() > 0) {
            List<Container> list = project.getBundles(Strategy.HIGHEST, line, null);
            result.addAll(list);
          }
        }
      } finally {
        if (rd != null) {
          rd.close();
        }
        if (in != null) {
          in.close();
        }
      }
    } else result.add(this);

    return result;
  }
Пример #13
0
  private void importProjectAndData() {
    JFileChooser fileChooser = new JFileChooser();
    fileChooser.setApproveButtonText("Importa");
    fileChooser.setDialogTitle("Importa progetto e  dati");
    fileChooser.addChoosableFileFilter(new GenericFileFilter(".atd", "Arduino Trend Data"));
    int n = fileChooser.showOpenDialog(view);

    if (n == JFileChooser.APPROVE_OPTION) {

      try {
        project.importProjectAndData(fileChooser.getSelectedFile());
        file = null;
        inizializePens(project.getPenModels());
        modelListPens.update(null, null);
        view.setTitle(project.getTitle());
        view.trend.setModel(project.getTrendModel());
        view.trend.setMillsAtFirstRecord();
      } catch (IOException e) {
        view.popupErrorMessage(e.getMessage());
        e.printStackTrace();
      } catch (ClassNotFoundException e) {
        view.popupErrorMessage("File non trovato");
        e.printStackTrace();
      }
    }
  }
Пример #14
0
  @Test
  public void testCopyProject()
      throws IOException, NoProjectLoadedException, ProjectFileParsingException, Exception {
    System.out.println("---  testCopyAndRunProject");

    String projNameNew = "TestingGranCell";
    File projDirNew = new File(MainTest.getTempProjectDirectory(), projNameNew);

    if (projDirNew.exists()) {
      GeneralUtils.removeAllFiles(projDirNew, false, true, true);
    }

    System.out.println("Ex " + projDirNew.getCanonicalFile() + ": " + projDirNew.exists());
    projDirNew.mkdir();

    File projFile = new File(projDirNew, projNameNew + ".ncx");

    File oldProjDir = new File(ProjectStructure.getnCModelsDir(), "GranuleCell");
    File oldProj = new File(oldProjDir, "GranuleCell.ncx");

    ProjectManager p = new ProjectManager();

    Project proj = p.copyProject(oldProj, projFile);

    System.out.println("Created project at: " + proj.getProjectFile().getCanonicalPath());

    assertEquals(proj.getProjectName(), projNameNew);

    assertTrue(projFile.exists());
  }
  @Test
  public void should_analyse() {
    ProjectFileSystem fs = mock(ProjectFileSystem.class);
    when(fs.getSourceCharset()).thenReturn(Charset.forName("UTF-8"));
    InputFile inputFile =
        InputFileUtils.create(
            new File("src/test/resources/cpd"), new File("src/test/resources/cpd/Person.js"));
    when(fs.mainFiles(JavaScript.KEY)).thenReturn(ImmutableList.of(inputFile));
    Project project = new Project("key");
    project.setFileSystem(fs);
    SensorContext context = mock(SensorContext.class);

    sensor.analyse(project, context);

    verify(context)
        .saveMeasure(Mockito.any(Resource.class), Mockito.eq(CoreMetrics.FILES), Mockito.eq(1.0));
    verify(context)
        .saveMeasure(Mockito.any(Resource.class), Mockito.eq(CoreMetrics.LINES), Mockito.eq(22.0));
    verify(context)
        .saveMeasure(Mockito.any(Resource.class), Mockito.eq(CoreMetrics.NCLOC), Mockito.eq(10.0));
    verify(context)
        .saveMeasure(
            Mockito.any(Resource.class), Mockito.eq(CoreMetrics.FUNCTIONS), Mockito.eq(2.0));
    verify(context)
        .saveMeasure(
            Mockito.any(Resource.class), Mockito.eq(CoreMetrics.STATEMENTS), Mockito.eq(6.0));
    verify(context)
        .saveMeasure(
            Mockito.any(Resource.class), Mockito.eq(CoreMetrics.COMPLEXITY), Mockito.eq(3.0));
    verify(context)
        .saveMeasure(
            Mockito.any(Resource.class), Mockito.eq(CoreMetrics.COMMENT_LINES), Mockito.eq(2.0));
  }
Пример #16
0
  /**
   * Sets the project reference to this instance.
   *
   * <p>Since the reference is a containment reference, the opposite reference (Project.contract) of
   * the project will be handled automatically and no further coding is required to keep them in
   * sync. See {@link Project#setContract(Project)}.
   *
   * @param project
   */
  public void setProject(final Project project) {
    checkDisposed();

    if (settingProject) {
      // avoid loops
      return;
    }

    Project oldProject = this.project;

    // if the parent does not change, we can leave
    if (oldProject == project) {
      return;
    }

    try {
      // avoid loops
      settingProject = true;

      // First remove the element
      if (oldProject != null) {
        oldProject.setContract(null);
      }

      // Then assign the new value
      this.project = project;

      // Then add 'this' to the new value
      if (this.project != null) {
        this.project.setContract(this);
      }
    } finally {
      settingProject = false;
    }
  }
Пример #17
0
 /**
  * Checks whether or not a class is suitable to be adapted by TaskAdapter. If the class is of type
  * Dispatchable, the check is not performed because the method that will be executed will be
  * determined only at runtime of the actual task and not during parse time.
  *
  * <p>This only checks conditions which are additionally required for tasks adapted by
  * TaskAdapter. Thus, this method should be called by Project.checkTaskClass.
  *
  * <p>Throws a BuildException and logs as Project.MSG_ERR for conditions that will cause the task
  * execution to fail. Logs other suspicious conditions with Project.MSG_WARN.
  *
  * @param taskClass Class to test for suitability. Must not be <code>null</code>.
  * @param project Project to log warnings/errors to. Must not be <code>null</code>.
  * @see Project#checkTaskClass(Class)
  */
 public static void checkTaskClass(final Class<?> taskClass, final Project project) {
   if (!Dispatchable.class.isAssignableFrom(taskClass)) {
     // don't have to check for interface, since then
     // taskClass would be abstract too.
     try {
       final Method executeM = taskClass.getMethod("execute", (Class[]) null);
       // don't have to check for public, since
       // getMethod finds public method only.
       // don't have to check for abstract, since then
       // taskClass would be abstract too.
       if (!Void.TYPE.equals(executeM.getReturnType())) {
         final String message =
             "return type of execute() should be "
                 + "void but was \""
                 + executeM.getReturnType()
                 + "\" in "
                 + taskClass;
         project.log(message, Project.MSG_WARN);
       }
     } catch (NoSuchMethodException e) {
       final String message = "No public execute() in " + taskClass;
       project.log(message, Project.MSG_ERR);
       throw new BuildException(message);
     } catch (LinkageError e) {
       String message = "Could not load " + taskClass + ": " + e;
       project.log(message, Project.MSG_ERR);
       throw new BuildException(message, e);
     }
   }
 }
  /** @throws Exception If failed. */
  public void testAntGarTaskToString() throws Exception {
    String tmpDirName = GridTestProperties.getProperty("ant.gar.tmpdir");
    String srcDirName = GridTestProperties.getProperty("ant.gar.srcdir");
    String baseDirName = tmpDirName + File.separator + System.currentTimeMillis() + "_6";
    String metaDirName = baseDirName + File.separator + "META-INF";
    String garFileName = baseDirName + ".gar";

    // Make base and META-INF dir.
    boolean mkdir = new File(baseDirName).mkdirs();

    assert mkdir;

    mkdir = new File(metaDirName).mkdirs();

    assert mkdir;

    // Copy files to basedir
    U.copy(new File(srcDirName), new File(baseDirName), true);

    IgniteDeploymentGarAntTask garTask = new IgniteDeploymentGarAntTask();

    Project garProject = new Project();

    garProject.setName("Gar test project");

    garTask.setDestFile(new File(garFileName));
    garTask.setBasedir(new File(garFileName));
    garTask.setProject(garProject);
    garTask.setDescrdir(new File(garFileName));

    garTask.toString();
  }
Пример #19
0
  @Test
  public void testGetNumFields() throws DatabaseException {
    Project census = new Project("census", 2, 3, 4, 5);
    dbProjects.add(census);

    assertEquals(dbProjects.getNumFields(census.getId()), 5);
  }
  // ---------------------------------------------------------------//
  public void projectModifier(
      String Mode, Project project, HashMap<String, ArrayList<Task>> taskManager)
      throws SQLException {

    int proid = -7777;
    Connection conn = null;
    PreparedStatement prepStmt = null;
    try {
      conn = select();
      if (Mode.equals("New Project")) proid = insertProject(project, conn);
      else proid = editProject(project, conn);
      project.setProjectID(proid);
      for (Task ts : taskManager.get("toInsert")) {
        addTasktoProject(project.getProjectID(), ts, conn);
      }
      for (Task ts : taskManager.get("toDelete")) {
        deleteTask(ts, conn);
      }
      for (Task ts : taskManager.get("toEdit")) {
        updateTasktoProject(ts, conn);
      }
    } finally {
      if (prepStmt != null) conn.close();
      if (conn != null) conn.close();
    }
  }
Пример #21
0
  /**
   * Opens a project.
   *
   * @param directory Where the project is stored.
   * @return the BProject that describes the newly opened project or null if it cannot be opened.
   */
  public final BProject openProject(File directory) {
    if (!myWrapper.isValid()) throw new ExtensionUnloadedException();

    // Yes somebody may just call it with null, for fun..
    if (directory == null) return null;

    Project openProj = Project.openProject(directory.getAbsolutePath(), null);
    if (openProj == null) return null;

    // a hack, since bluej does not handle "opening" of projects correctly.
    // this code should really be into openProject or it should not be possible to open
    // a project is the initial package name is not there.
    Package pkg = openProj.getCachedPackage(openProj.getInitialPackageName());
    if (pkg == null) return null;

    // I make a new identifier out of this
    Identifier aProject = new Identifier(openProj, pkg);

    // This will make the frame if not already there. should not be needed...
    try {
      aProject.getPackageFrame();
    } catch (ExtensionException exc) {
    }

    // Note: the previous Identifier is not used here.
    return openProj.getBProject();
  }
Пример #22
0
 /**
  * Extracts the module name from the specified project. If empty then the provided default name is
  * used.
  *
  * @param defaultName the default module name to use
  * @param project the maven 2 project
  * @return the module name to use
  */
 private String extractModuleName(final String defaultName, final Project project) {
   if (StringUtils.isBlank(project.getProjectName())) {
     return defaultName;
   } else {
     return project.getProjectName();
   }
 }
Пример #23
0
  /**
   * Test deleting a package that contains a Class with Statechart diagram. The diagram should be
   * deleted, too.
   */
  public void testDeletePackageWithStateDiagram() {
    Project p = ProjectManager.getManager().getOpenProjects().get(0);
    assertEquals(2, p.getDiagramList().size());

    int sizeMembers = p.getMembers().size();
    int sizeDiagrams = p.getDiagramList().size();

    // test with a class and class diagram
    Object package1 = Model.getModelManagementFactory().buildPackage("test1");
    Object aClass = Model.getCoreFactory().buildClass(package1);

    // try with Statediagram
    Object machine = Model.getStateMachinesFactory().buildStateMachine(aClass);
    UMLStateDiagram d = new UMLStateDiagram(Model.getFacade().getNamespace(machine), machine);
    p.addMember(d);
    assertEquals(sizeDiagrams + 1, p.getDiagramList().size());
    assertEquals(sizeMembers + 1, p.getMembers().size());

    p.moveToTrash(package1);
    Model.getPump().flushModelEvents();

    assertTrue("Class not in trash", Model.getUmlFactory().isRemoved(aClass));
    assertTrue("Statemachine not in trash", Model.getUmlFactory().isRemoved(machine));
    assertEquals(sizeDiagrams, p.getDiagramList().size());
    assertEquals(sizeMembers, p.getMembers().size());
  }
Пример #24
0
 private void configureTest(final Project project, final JavaPluginConvention convention) {
   project
       .getTasks()
       .withType(
           Test.class,
           new Action<Test>() {
             public void execute(Test test) {
               configureTestDefaults(test, project, convention);
             }
           });
   project.afterEvaluate(
       new Action<Project>() {
         public void execute(Project project) {
           project
               .getTasks()
               .withType(
                   Test.class,
                   new Action<Test>() {
                     public void execute(Test test) {
                       overwriteIncludesIfSinglePropertyIsSet(test);
                       overwriteDebugIfDebugPropertyIsSet(test);
                     }
                   });
         }
       });
 }
Пример #25
0
 private void addWorkers() {
   ResourceType type;
   ArrayList<Resource> users = null;
   ArrayList<Project> projects = null;
   Random random = new Random(1l);
   try {
     type = resourceTypeDAO.getResourceTypeByResourceTypeName("human");
     users = resourceDAO.getResourcesByResourceType(type);
     projects = projectDAO.getAllProjects();
   } catch (Exception e) {
     e.printStackTrace();
   }
   for (Project project : projects) {
     int workers = random.nextInt(11) + 5;
     Resource user = users.get(random.nextInt(users.size()));
     try {
       resourceDAO.insertUserTask(user.getResourceID(), project.getProjectID(), true);
     } catch (UserWorkOnThisProjectException e) {
       e.printStackTrace();
     }
     for (int i = 0; i < workers; ++i) {
       user = users.get(random.nextInt(users.size()));
       try {
         resourceDAO.insertUserTask(
             user.getResourceID(), project.getProjectID(), (random.nextInt(5) == 0));
       } catch (UserWorkOnThisProjectException e) {
         System.out.println(
             "User already assigned, but don't worry, there are plenty to choose from");
       }
     }
   }
 }
Пример #26
0
 /**
  * trigger method is used to update foreign keys in the dataObjects this method is used before
  * saving objects in database thank's to the "saved fragment"
  *
  * @param old_id represents the past id of our GpsGeom
  * @param new_id represents the new id of our GpsGeom
  * @param photo represents the photo which we are working on and therefore is related to this
  *     gpsGeom
  * @param list_projet represents the projects that are related to this gpsGeom
  * @param list_element represents the projects that are related to this gpsGeom
  */
 public void trigger(
     long old_id,
     long new_id,
     Photo photo,
     ArrayList<Project> list_projet,
     ArrayList<Element> list_element) {
   /** we update gpsGeom_id from past to new in the photo that is geolocalised by this gpsGeom */
   if (photo.getGpsGeom_id() == old_id) {
     photo.setGpsGeom_id(new_id);
   }
   /**
    * we update gpsGeom_id from past to new in the projects that are geolocalised by this gpsGeom
    */
   if (list_projet != null) {
     for (Project p : list_projet) {
       if (p.getGpsGeom_id() == old_id) {
         p.setGpsGeom_id(new_id);
       }
     }
   }
   /**
    * we update gpsGeom_id from past to new in the elements that are geolocalised by this gpsGeom
    */
   if (list_element != null) {
     for (Element e : list_element) {
       if (e.getGpsGeom_id() == old_id) {
         e.setGpsGeom_id(new_id);
       }
     }
   }
 }
Пример #27
0
  public static void testBumpIncludeFile() throws Exception {
    File tmp = new File("tmp-ws");
    if (tmp.exists()) IO.deleteWithException(tmp);
    tmp.mkdir();
    assertTrue(tmp.isDirectory());

    try {
      IO.copy(new File("test/ws"), tmp);
      Workspace ws = Workspace.getWorkspace(tmp);
      Project project = ws.getProject("bump-included");
      project.setTrace(true);
      Version old = new Version(project.getProperty("Bundle-Version"));
      assertEquals(new Version(1, 0, 0), old);
      project.bump("=+0");

      Processor processor = new Processor();
      processor.setProperties(project.getFile("include.txt"));

      Version newv = new Version(processor.getProperty("Bundle-Version"));
      System.err.println("New version " + newv);
      assertEquals(1, newv.getMajor());
      assertEquals(1, newv.getMinor());
      assertEquals(0, newv.getMicro());
    } finally {
      IO.deleteWithException(tmp);
    }
  }
  /**
   * @see android.app.ListActivity#onListItemClick(android.widget.ListView, android.view.View, int,
   *     long)
   */
  @Override
  protected void onListItemClick(ListView l, View v, int position, long id) {
    Project selectedProject = mAdapter.getItem(position);

    storeProjectInfo(selectedProject.getId(), selectedProject.getName());

    finish();
  }
Пример #29
0
 private static void checkPackageInfoFiles(
     Project project, String packageName, boolean expectPackageInfo, boolean expectPackageInfoJava)
     throws Exception {
   File pkgInfo = IO.getFile(project.getSrc(), packageName + "/packageinfo");
   File pkgInfoJava = IO.getFile(project.getSrc(), packageName + "/package-info.java");
   assertEquals(expectPackageInfo, pkgInfo.exists());
   assertEquals(expectPackageInfoJava, pkgInfoJava.exists());
 }
 protected void setUp() throws Exception {
   super.setUp();
   Project project =
       (Project)
           createNewValueMaker(getRootObject(), null)
               .makeNewValue(Project.class, null, "Parent project");
   ms = project.getMungeSettings();
 }