A Java-based web application for creating, visualizing, and managing computational graphs using a publish-subscribe messaging system with interactive web interface.
- Dynamic Graph Creation: Build computational graphs using configuration files
- Multi-Agent System: Support for various computational agents (PlusAgent, MaxAgent, MinAgent, MultiplyAgent, AverageAgent, IncAgent)
- Real-time Visualization: Interactive SVG-based graph visualization in web browser
- Publish-Subscribe Architecture: Event-driven messaging system between topics and agents
- Web Interface: Complete web-based interface for graph management and visualization
- HTTP Server: Custom multi-threaded HTTP server implementation
- File Upload: Configuration file upload and processing capabilities
- Extended Testing Suite: Additional validation and testing components in main_trains folder
- Graph Engine: Topic and Agent management with publish-subscribe messaging
- HTTP Server: Custom implementation with servlet-based request handling
- Web Interface: HTML/CSS/JavaScript frontend for graph interaction
- Visualization: SVG-based dynamic graph rendering
- Testing & Validation: Extended test suite with additional checks and validations
- PlusAgent: Adds two input values
- MaxAgent: Finds maximum of two input values
- MinAgent: Finds minimum of two input values
- MultiplyAgent: Multiplies two input values
- AverageAgent: Calculates average of two input values
- IncAgent: Increments input value by 1
- Java 11 or higher
- Web browser (Chrome, Firefox, Safari, Edge)
- Command line terminal
-
Clone or download the project
git clone <repository-url> cd WebGraphApp/project_biu
-
Compile the project
javac -d . *.java server/*.java servlets/*.java graph/*.java views/*.java
-
Start the server
java Main
-
Access the application
- Open your web browser
- Navigate to:
http://localhost:8080/app/index.html
The main_trains folder contains additional validation and testing components with enhanced checks:
-
Navigate to testing suite
cd WebGraphApp/main_trains -
Compile testing components
javac -d . *.java
-
Run extended tests
java TestRunner
WebGraphApp/
├── project_biu/ # Main application
│ ├── Main.java # Application entry point
│ ├── server/ # HTTP server implementation
│ │ ├── HTTPServer.java # Server interface
│ │ ├── MyHTTPServer.java # Server implementation
│ │ └── RequestParser.java # HTTP request parser
│ ├── servlets/ # Request handlers
│ │ ├── Servlet.java # Servlet interface
│ │ ├── ConfLoader.java # Configuration file loader
│ │ ├── GraphUpdateServlet.java # Graph visualization handler
│ │ ├── HtmlLoader.java # Static file server
│ │ └── TopicDisplayer.java # Topic information display
│ ├── graph/ # Graph engine
│ │ ├── Agent.java # Agent interface
│ │ ├── Topic.java # Topic implementation
│ │ ├── Message.java # Message data structure
│ │ ├── Graph.java # Graph container
│ │ ├── TopicManagerSingleton.java # Topic management
│ │ └── [Various Agent implementations]
│ └── views/ # Visualization components
│ └── HtmlGraphWriter.java # SVG graph renderer
├── main_trains/ # 🆕 Extended testing suite
│ ├── TestRunner.java # Test execution framework
│ ├── ValidationSuite.java # Additional validation checks
│ ├── GraphTester.java # Graph functionality tests
│ ├── AgentValidator.java # Agent behavior validation
│ └── [Additional test components]
├── html_files/ # Web interface files
│ ├── index.html # Main application page
│ ├── graph.html # Graph visualization page
│ └── [CSS/JS files]
└── config_files/ # Sample configuration files
├── test_config.conf
├── test_config2.conf
└── test_config3.conf
- Basic functionality testing
- Web interface validation
- HTTP server testing
The main_trains folder provides comprehensive testing with additional checks:
- Enhanced Agent Validation: Extended validation of agent behavior and edge cases
- Graph Integrity Checks: Advanced graph structure and connectivity validation
- Performance Testing: Load testing and performance benchmarks
- Error Handling Tests: Comprehensive error scenario testing
- Integration Tests: End-to-end system integration validation
- Stress Testing: High-load and concurrent operation testing
cd main_trains
# Run all validation tests
java TestRunner --all
# Run specific test suites
java TestRunner --agents # Agent-specific tests
java TestRunner --graph # Graph structure tests
java TestRunner --performance # Performance benchmarks
java TestRunner --integration # Integration testsExtended tests generate detailed reports including:
- Test execution summaries
- Performance metrics
- Coverage analysis
- Error logs and debugging information
Create a .conf file with agent definitions:
# Basic configuration example
graph.PlusAgent
A,B
C
graph.MaxAgent
A,B
D
graph.IncAgent
C
E
graph.MultiplyAgent
D,E
FFormat:
- Line 1: Agent class (e.g.,
graph.PlusAgent) - Line 2: Input topics (comma-separated)
- Line 3: Output topic
- Empty line between agents
-
Via Web Interface:
- Go to
http://localhost:8080/app/index.html - Click "Choose File" and select your
.conffile - Click "Upload Configuration"
- Go to
-
Via HTTP POST:
curl -X POST -F "confFile=@config.conf" http://localhost:8080/upload
- Web Interface: Use the topic input forms on the main page
- HTTP GET:
http://localhost:8080/publish?topic=A&msg=10
- Navigate to:
http://localhost:8080/graph - The graph updates automatically when configuration or values change
- Topics appear as rectangles (cyan/teal color)
- Agents appear as circles (red/coral color)
- Arrows show data flow direction
graph.PlusAgent
A,B
SUM_AB
graph.MultiplyAgent
A,B
PRODUCT_AB
graph.MaxAgent
SUM_AB,PRODUCT_AB
RESULTgraph.PlusAgent
A,B
C
graph.MultiplyAgent
A,B
D
graph.IncAgent
C
E
graph.IncAgent
D
F
graph.AverageAgent
E,F
FINAL_RESULT| Method | Endpoint | Description |
|---|---|---|
| GET | /app/ |
Serve static HTML files |
| POST | /upload |
Upload configuration file |
| GET | /publish |
Publish message to topic |
| GET | /graph |
Get graph visualization |
/publish:?topic=<topic_name>&msg=<message_value>/graph: No parameters (returns complete graph)
- Responsive Layout: Graphs automatically adjust to content size
- Node Types:
- Topics: Rectangular nodes with topic name and current value
- Agents: Circular nodes with agent name only
- Interactive Elements: Click nodes for detailed information
- Real-time Updates: Graph refreshes when data changes
- Professional Styling: Clean, modern appearance with proper spacing
- Input: Values published to input topics (A, B, etc.)
- Processing: Agents subscribe to topics and process incoming messages
- Propagation: Agents publish results to output topics
- Cascade: Output topics trigger downstream agents
- Visualization: Graph displays current state and values
-
Create agent class implementing
Agentinterface:public class CustomAgent implements Agent { // Implementation }
-
Add to configuration: Use
graph.CustomAgentin config files -
Test with extended suite: Run validation tests in
main_trains
- Modify files in
html_files/directory - Static files served automatically by
HtmlLoaderservlet - Add new servlets for additional functionality
- Basic testing: Use standard project_biu tests
- Extended validation: Run comprehensive tests in main_trains folder
- Performance analysis: Use built-in benchmarking tools
# Generate JavaDoc for main application
cd project_biu
javadoc -d javadoc -sourcepath . server/*.java servlets/*.java graph/*.java views/*.java -private -author -version
# Generate JavaDoc for testing suite
cd ../main_trains
javadoc -d test_javadoc -sourcepath . *.java -private -author -version
# Open documentation
start javadoc/index.html-
Port 8080 already in use
- Change port in
Main.javaconstructor:new MyHTTPServer(8081, 5)
- Change port in
-
Configuration file not loading
- Check file format (no extra spaces, correct line breaks)
- Ensure agent classes exist in classpath
- Run validation tests in
main_trainsfor detailed diagnostics
-
Graph not displaying
- Verify server is running on correct port
- Check browser console for JavaScript errors
- Ensure configuration is loaded successfully
- Use extended test suite for comprehensive validation
-
Agents not processing
- Check that input topics receive values
- Verify agent subscription setup
- Check server logs for errors
- Run agent validation tests in
main_trains
- Basic logging: Check server console output and
server_error.logfile - Extended diagnostics: Use test reports from
main_trainsvalidation suite - Performance monitoring: Run performance tests for bottleneck identification
cd main_trains
# Diagnose specific issues
java TestRunner --debug --component=agents # Debug agent issues
java TestRunner --debug --component=graph # Debug graph issues
java TestRunner --debug --component=server # Debug server issues
# Generate diagnostic reports
java TestRunner --report --output=debug_report.htmlThis project is developed for educational purposes as part of advanced programming coursework.
- Almog Sharoni
- Yuval Harary
This is an academic project. For suggestions or improvements, please contact the authors.
- v1.0: Initial release with basic functionality
- v1.1: Added extended testing suite in main_trains folder with comprehensive validation checks
Version: 1.1
Last Updated: December 2024
Testing Suite: Enhanced validation available in main_trains/