• Stars
    star
    152
  • Rank 239,833 (Top 5 %)
  • Language
    Java
  • License
    MIT License
  • Created about 5 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A tool to detect migration code between two Java third-party libraries

MigrationMiner

MigrationMiner is an open source tool that provides the developer with easy-to-use and comprehensive way of extracting, from given list of input projects, existing migrations between two third-party libraries using program analysis based on Abstract Syntax Tree (AST) code representation. In a nutshell, MigrationMiner (i) detects, (ii) extracts, (iii) filters, and (iv) collects code changes related to any performed migration. For a given input project, MigrationMiner detects any migration undergone between two java libraries and returns the names and versions of both retired and new libraries. Thereafter, MigrationMiner extracts the specific code changes, from the client code, and which belong to the migration changes (it should at least have one removed method from the retired library, and one added method from the new library) from all other unrelated code changes within the commits. Next, MigrationMiner filters code changes to only keep fragments that contain migration traces i.e., a code fragment, generated by the diff utility, which contains the removed and added methods, respectively from the retired and the new library. Finally, MigrationMiner collects the library API documentation that is associated with every method in the client code. The output of MigrationMiner, for each detected migration between two libraries, is a set of migration traces, with their code context, and their corresponding documentation.

When you use this tool, please cite this paper.

@inproceedings{alrubaye2019migrationminer,
  title={MigrationMiner: An Automated Detection Tool of Third-Party Java Library Migration at the Method Level},
  author={Alrubaye, Hussein and Mkaouer, Mohamed Wiem and Ouni, Ali},
  booktitle={2019 IEEE International Conference on Software Maintenance and Evolution (ICSME)},
  pages={414--417},
  year={2019},
  organization={IEEE}
}

This tool is not limited to library migration. You could use tool for:

  • Migration/upgrade for Android Apps at the method and library Level.
  • Migration/upgrade for Java Maven Projects at method and library Level.
  • Track third-party libraries upgrade/migration for a project.
  • Download third-party libraries used at given commit and extract source code + class/methods signature from jar file.
  • Download third-party libraries documentation used at given commit and convert jar file to a relational database.

Prerequisites

  • Install java JKD from here.
  • Install Eclipse IDE for Java Developers from here.
  • Install MYSQL Server from here.
  • If you using Ubuntu install curl by running the following commands "sudo apt install curl"

How to install and run the tool

To run the project on your local machine you can follow one of these two tutorials:

A- Using the tutorial video

  • You could run the project by following this video.

B- Using the following steps

  • First you need to build the dataset, by running the following script Database/MigrationMinerDBSQL.sql. Open a terminal and run the following commands
 mysql -u root -p
 source ./MigrationMinerDBSQL.sql

After running the commands, the database should be created with all tables and views.

  • Open eclipse IDE then go to File-> import-> Maven-> existing Maven Projects-> Select MigrationMiner directory.
  • Set your local MYSQL username and password in this file DatabaseLogin.java.
  • Update MigrationMiner/data/gitRepositories.csv with the list of git repositories that you want to use as input (they will be searched for potential library migrations).
  • Go to your github account under Settings > Developer Settings > Personal Access Tokens, add new token. Use token to set your GitHub token in this file GithubLogin.java. Your token will be used so that Migration Miner can search a large number of GitHub projects without authentication issues.
  • (Optional) We print alot of logs, to avoid console buffer overflow. In eclipse IDE go to preferences-> console-> limit console buffer size to small number such as 10000.
  • Run the Main.java.

Tool output

A- Ouput as Relational Database
  • After running Main.java, the database Tables will be filled with any migration infomation found. For each potential migration, the following information can be found in database, whose schema is as follows:

    • Repositories: Has the list of projects that scanned by the tool.
    • AppCommits: Has the list of projects' commits information (Commit Id, developer name, Commit text, and commit date).
    • ProjectLibraries: List of libraries that were added or removed at every commit.
    • MigrationRules: List of migration Rules that were detected from the Dataset.
    • MigrationSegments: List Of migration Fragments that were extract from software migration.
    • LibraryDocumenation: Library documentation associated with every library version that has been involved in any migration.
B- Ouput as HTML

There will be a generated HTML file named "MigrationMinnerOutput.html" that has the summary of all migrations detected, and for each migration, all its corresponding code fragments along with their Library documentation. An illutrative example of this file is in the following picture:

main

C- Ouput as Objects

After running Main.java, You could read the output as objects by writing the following code. or run TestClient.java. That could help you to integrate the tool with your code.

 
//Return list of migrations between two pairs of libraries( added/removed)
LinkedList<MigrationRule> migrationRules= new MigrationRuleDB().getMigrationRulesWithoutVersion(1);

for (MigrationRule migrationRule : migrationRules) {
 System.out.println("== Migration Rule "+ migrationRule.FromLibrary +
      " <==> "+  migrationRule.ToLibrary +"==");

 /*
 *  For every migrations, retrieve list of collected of fragments for migration at method level.
 *  every fragment has N added methods M removed methods
 */
 ArrayList<Segment> segmentList = new MigrationSegmentsDB().getSegmentsObj(migrationRule.ID);

 for (Segment segment : segmentList) {

  segment.print();

  // Print all removed method signatures With Docs
  printMethodWithDocs( migrationRule.FromLibrary,segment.removedCode);  

  // Print all added method signatures With Docs
  printMethodWithDocs( migrationRule.ToLibrary,segment.addedCode);

 } // End fragment for every migration

}  // End library migration


/* 
* This method takes list of methods signatures with library that methods belong to.
* It will print the signatures and Docs for every method
*/
void printMethodWithDocs(String libraryName,ArrayList<String> listOfMethods ) {

 // For every add method print the Docs
 for(String methodSignature: listOfMethods){

  // Convert  method signatures as String to Object
  MethodObj methodFormObj= MethodObj.GenerateSignature(methodSignature);

  //retrieve Docs from the library for method has that name
  ArrayList<MethodDocs>  toLibrary = new LibraryDocumentationDB()
                                           .getDocs( libraryName,methodFormObj.methodName);

  //Map method signatures to docs
  MethodDocs methodFromDocs = MethodDocs.GetObjDocs(toLibrary, methodFormObj);

  if(methodFromDocs.methodObj== null) {
   System.err.println("Cannot find Docs for: "+ methodSignature);
   continue;
  }
  methodFromDocs.print();      
 }
}

MigrationMiner has been used so far in the following papers:

License

This software is licensed under the MIT license.

More Repositories

1

AndroidTutorialForBeginners

Step by step to build Android apps using Android Studio
Java
4,306
star
2

KotlinUdemy

Learn how to make online games, and apps for Android O, like Pokémon , twitter,Tic Tac Toe, and notepad using Kotlin
Kotlin
1,821
star
3

DataStructureAndAlgorithms

Write code that run faster, use less memory and prepare for your Job Interview
Java
869
star
4

PythonTutorial

Step by step to build apps with Python. Code files for YouTube tutorial
Python
737
star
5

iOSAppDevelopment

step by step to start build apps with iOS 10 and swift 3
Swift
364
star
6

XamarinAndroidTutorial

Step by step to build android apps with C#. Code files for YouTube tutorial
C#
186
star
7

QuranOnAndroid

listen to quran online free open source project
Java
118
star
8

PHPTutorials

Tutorials about learning PHP And MYSQL
PHP
102
star
9

FindMyPhoneBuzzle

Find my phone app have seven bugs you have to fix them to be your own app
Java
93
star
10

lahthaNews

This app helps you to know all the news about the Arabic region from you lovely channels that you would like to follow.
C#
82
star
11

RubyTutorials

Ruby teaching Tutorials snapped files
Ruby
54
star
12

iosUdemy

Learn how to make online games, and apps for iOS11, like Pokémon , Twitter, Whatsapp , CoreML (Machine Learning)
Swift
48
star
13

MachineLearning

implement machine learning algorithms
R
46
star
14

SellingApp

Selling tool app
Java
46
star
15

AndroidVulnerability

44
star
16

swa

How to hack web App
PHP
42
star
17

FamilyIn

easy way to find and track all your family member
Java
37
star
18

BootStrap

HTML
35
star
19

PythonUdemy

Python code for Udemy course
Python
33
star
20

Alrubaye.net

ASP
31
star
21

CPlusPlusTutorial

Step by step to learn C++
C++
28
star
22

TeachKidsProgramming

Teaching kids programming using google blocky framework
JavaScript
27
star
23

Unity2DGameTutorial

Build 2D game with youtube Tutorial show how we build it step by step
C#
26
star
24

MigrationMapper

Tool to find method mapping between two APIs by mining existing API Migration
HTML
25
star
25

JavaEssentialTrainingJavaForAndroid

Java Essential Training Java For Android source
Java
25
star
26

AndroidListview

How to use list View in android
Java
21
star
27

FinishThisApp

Repository for list of task-driven Apps that we teach how to build then in Youtube
Kotlin
21
star
28

CrownGame

Crown Game is turn base game used dice for two players to play online
PHP
19
star
29

DjangoProject

Python
19
star
30

JavaWebService

build Java WebService
Java
18
star
31

QuranWindowsPhone

open source project for quran online listen n windows
C#
17
star
32

AndroidUITesting

Android UI login page Testing
Java
16
star
33

LaravelBlogProject

Laravel Bloger Project
PHP
15
star
34

angular2

angular2 basic
JavaScript
15
star
35

DBmanager

manage your connect to database from .net
Visual Basic
13
star
36

ReactProject

react introduction and connection to mysql use ember
HTML
13
star
37

AdsVulnerablilty

Detecting dangerous permissions that used by Android Third-party libraries
Shell
12
star
38

RubyOnRailsBloger

Ruby On Rails bloger system open source
Ruby
12
star
39

emberjs

Step by step to learn EmberJs
JavaScript
11
star
40

AsynTaskWithNodeServer

Java
10
star
41

OnlineTutorials

This attached files for online tutorials
Java
10
star
42

XamarinForms

short text file that support to youtube tutorial
9
star
43

ChromeVulnerableLibraries

Empirical Study of Using Vulnerable Libraries in the Architecture of Chrome
Java
9
star
44

empirical-refactoring

Wesbite
9
star
45

SoftwareArchitectureTactics

implement number of Software Architecture Titicaca
C#
8
star
46

Connect-IOS-with-SQLSERVER

how to connect IOS apps with sqlserver
Objective-C
6
star
47

SAM2017

5
star